1
$\begingroup$

As far as my understanding of logistic regression goes, only dummy coding is readily interpretable for this type of modelling. How to explain coefficients when effect coding is used in logistic regression?

Here is a simulation example for illustration:

podatki<-data.frame(category = c(rep("A",10000), rep("B",10000), rep("C",10000)),
                P=c(rbinom(10000,1,0.1), rbinom(10000,1,0.3), rbinom(10000,1,0.5)),
                Y=c(rnorm(10000,10,1), rnorm(10000,30,1), rnorm(10000,50,1)))

Specifying an effects coding matrix:

X<-matrix(c(1,1,0,1,0,1,1,-1,-1), nrow=3, byrow = TRUE)

$X=\left(\begin{array}{ccc} 1 & 1 & 0\\ 1 & 0 & 1 \\ 1 & -1 & -1\\ \end{array}\right)$

Appending the matrix to data:

tmp<-data.frame(cbind(Y=podatki$Y,P=podatki$P, matrix(c(rep(X[1,2:3],10000), rep(X[2,2:3],10000),rep(X[3,2:3],10000)),ncol=2, byrow=TRUE))) colnames(tmp)[3:4]<-c("b1","b2")

Running logistic and regression model:

summary(model<-glm(P~b1+b2, data=tmp, family = "binomial"))

summary(model<-lm(Y~b1+b2, data=tmp))

While results of linear regression are easy to interpret:

enter image description here

Intercept here represents unweighted mean $\bar{Y}=\frac{\bar{Y}_A+\bar{Y}_B+\bar{Y}_C}{3}$, while $b_1$ represents $\bar{Y}_A-\bar{Y}$ and $b_2$ represents $\bar{Y}_B-\bar{Y}$.

Results of logistic regression are not readily interpretable:

enter image description here

$\endgroup$
1
  • $\begingroup$ Can you state why these results are not interpretable? $\endgroup$
    – Todd D
    Commented Jul 20, 2018 at 15:35

2 Answers 2

2
$\begingroup$

You're modeling the expected value of the log odds with logistic regression, so I think the parameters would have the same interpretation as they do in linear regression except that instead of the mean of $Y$, you interpret your results in terms of the difference in expected log odds of the event occurring.

For example, for b2, you might say that the expected difference between the log odds of the event occurring group $B$ and the mean log odds is $0.155$. Likewise, you could say that the odds of the event occurring for group $B$ are $exp(.155)$ times the odds for the mean. I see little value in this interpretation, though; odds ratios are challenging to interpret even with reference coding.

$\endgroup$
0
0
$\begingroup$

Thank you guys for your input. I managed to derive a coding scheme to crack this problem. As Noah said, there is little value in interpreting the current intercept since it represents unweighted mean of log(odds):

$$\frac{log(\overline{OR_{A}})+log(\overline{OR_{B}})+log(\overline{OR_{C}})}{3}=\frac{log(\frac{0.1}{0.9})+log(\frac{0.3}{0.7})+log(\frac{0.5}{0.5})}{3} \approx -0.98$$

Probability of event occuring is $\overline{P}=0.3$. So I want intercept value to be equal to $log(0.3/0.7)=-0.85$,

I achieved this by weighting different terms in equation, for example by solving the following equation:

$$ x log(\overline{OR_{A}})+(1-x)log(\overline{OR_{C}})=-0.85$$

Then I designed a matrix of weighs for every coefficient according to effects coding definition:

$L=\left(\begin{array}{ccc} 0.386 & 0 & 0.614\\ 0.614 & 0 & -0.614 \\ -0.386 & 1 & -0.614\\ \end{array}\right)$

And solved a system of linear equations to get a coding scheme:

$$ X=L^{-1}$$

Here are the results:

enter image description here

These interpretations are more straigtforward. Coefficient $b1$ shows that $P_A$ is statistically significantly different from $\overline{P}$ and that $P_B$ is not (as it should be). By exponentiating the coefficients we can see the odds ratio change from the mean (for the given variable).

I would add reproducible code but editor is not behaving properly. The code is analog to the code provided in question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.