# Can't find loglinear model's corresponding logistic regression model

I have the loglinear model with parameters x, y, z, v, xy, xv, and z*v. As far as i understand there should exist a logistic regression model that essentially is equivalent to this, using v as response variable. How do i find it, and how does it look like?

I have tried to derive it using the relationship described in http://teaching.sociology.ul.ie/SSS/lugano/node58.html. I end up with the parameters x, z and x*y for the logistic regression model which turns out to be incorrect when testing in R.

I have also tried many other combinations of parameters in R but neither of the parameters in these models has the same values as the parameters in my loglinear model.

The loglinear model and it's results looks like:

## Coefficients:

 Coefficient      Estimate     Std. Error   z value       Pr(>|z|)
(Intercept)        4.01862      0.11901    33.767         < 2e-16 ***
x             -0.35889    0.16723    -2.146          0.03187 *
y             -2.14736    0.04661    -46.068         < 2e-16 ***
v              1.78281    0.12707     14.030         < 2e-16 ***
z             -0.83773    0.17843     -4.695           2.67e-06 ***
x:y            -0.40431    0.09936     -4.069           4.72e-05 ***
x:v            -0.55058    0.16924     -3.253           0.00114 **
v:z             3.32798    0.18425     18.062         < 2e-16 ***


## Number of Fisher Scoring iterations: 4

The logistic regression model(using same data):

## Coefficients:

  Coefficient  Estimate   Std.Error       z value   Pr(>|z|)
(Intercept)   1.8298     0.1383         13.232    < 2e-16 ***
x         -0.5058    0.1909         -2.650     0.00806 **
z         3.3089     0.1846         17.922    < 2e-16 ***
y        -0.5234     0.3058         -1.712     0.08693 .
x:y        0.3586     0.5977          0.600     0.54854


## Number of Fisher Scoring iterations: 7

I would expect that for example the parameter x*v in the loglinear model would have equivalent estimate and variance as the x parameter in the logistic regression model, however this is not the case.

I am thankfull for help!

• It might help if you showed the structure and results of the 2 models. It's hard to gauge what might be going on without more information. – EdM Jul 11 '20 at 22:21

Although every logistic regression model might have a corresponding log-linear model (Poisson regression with categorical variables), the converse doesn't necessarily hold.

Your models involves 4 variables, with v having 2 levels. Work backwards from the logistic regression model. According to the page you link (where $$N$$ = 4 in this case, counting all variables in the log-linear model):

The general rule is the model should contain the $$N-1$$ and lower order interactions between the independent variables, and for every term in the logistic model formula, an interaction between in and the dependent variable. If Y is the dependent variable, and A, B and C are independent, with an interaction B:C the loglinear model will have the following design:

Y + A + B + C + A:B + A:C + B:C + A:B:C   <-- Nuisance terms

+Y:A + Y:B + Y:C + Y:B:C               <-- Model terms


This is exactly the situation in your logistic regression, with Y corresponding to your v, the B:C interaction corresponding to your x:y interaction, and A corresponding to your z. So the log-linear model corresponding to your logistic regression model is:

 n ~ v + x + y + z + x:z + x:y + y:z + x:y:z + v:z + v:x + v:y + v:x:y, family = poisson(link = log)


Your log-linear model, when expanded to this form, lacks the x:z and v:y two-way interactions and both 3-way interactions, x:y:z and v:x:y.

Note the requirement for constructing the log-linear equivalent to a logistic regression: "the model should contain the $$N-1$$ and lower order interactions between the independent variables," where $$N-1$$ is actually the number of independent variables in the logistic regression. Thus a log-linear model equivalent to a logistic regression model will include all interactions among the independent variables of the logistic regression. If a log-linear model doesn't include all of those interactions, I don't know that you can construct an equivalent logistic regression.