2
$\begingroup$

My question concerns the interpretation of interaction in ols vs logistic regression.

Let us imagine that I have two independent variables, $y_{1}$ is the probability of watching TV at least once a day and $y_{2}$ the time in minutes of TV watching

I have two explanatory (categorical) variables : Female (0-1) and Year(1980-2015). I am interested in the change overtime of Female $\times$ Year.

I would fit my logistic regression with

$y_{1} = \alpha + \beta1_{Female} + \beta2_{2015} + \beta3_{Female × 2015}$

and my ols with

$y_{2} = \alpha + \beta1_{Female} + \beta2_{2015} + \beta3_{Female × 2015}$

In the logistic regression the reference is clear : Men in 1980. So, I have to interpret the interaction term as the comparison of Women in 2015 to Men in 1980.

However, someone told me that in ols, the reference was not the same as in logistic. I was wondering what exactly is the reference in the ols? (if any). (I guess not men in 1980, but what then ?).

$\endgroup$
8
  • $\begingroup$ For the model with $y_2$, the $\alpha$ parameter represents people who are not female, who are not in 2015, and who are not female in 2015. This can only be one thing... (As per your setup it's males in 1980). Your setup is essentially a diff in diff model, where females are the treatment group. $\endgroup$
    – Repmat
    Commented Nov 19, 2016 at 18:32
  • 2
    $\begingroup$ To see the argument more clearly think about what is left when all parameters are 0 (except the intercept) $\endgroup$
    – Repmat
    Commented Nov 19, 2016 at 18:47
  • 1
    $\begingroup$ @kjetilbhalvorsen would you be kind enough and expand a little more. thanks $\endgroup$
    – giac
    Commented Nov 19, 2016 at 20:13
  • 1
    $\begingroup$ @giacomoV he is talking about how you interpret the parameters. In logit you apply a non linear function, so the parameters are not partial effects (unlike OLS)... You can approximate these, most programs has some command for finding marginal effects $\endgroup$
    – Repmat
    Commented Nov 20, 2016 at 10:40
  • 1
    $\begingroup$ Also note: The OLS can predict -1000 or +1500 minutes of watching TV per day. At least with logistic regression you get predicted probabilities within 0 to 1. $\endgroup$
    – Björn
    Commented Jul 13, 2017 at 13:42

1 Answer 1

2
$\begingroup$

To see the difference in interpretations we will do some simulations in R. But first: interactions in linear models are usually interpreted via an additive model, so no interactions means a purely additive model. But, logistic regression is a multiplicative model, so interactions modeled via product terms do have a different meaning there. We set up a model to show this via simulations. First, we have two binary predictors coded as 0/1, and define probabilities via an additive probability model $p=\beta_0 +\beta_1 x_1 + \beta_2 x_2$. So, on this additive scale there is no interaction:

 set.seed(1234)
 beta_0  <- 0.1
 beta_1 <- 0.35
 beta_2 <- 0.35

We use a big sample size so randomness is unimportant:

 x_1  <-  c(rep(0,5000),rep(1,5000))
 x_2  <-  c(rep(0,2500),rep(1,2500),rep(0,2500),rep(1,2500))
 p  <- beta_0 + beta_1 * x_1 + beta_2 * x_2
 table(p)
p
 0.1 0.45  0.8 
2500 5000 2500 
 y  <- rbinom(length(p),1,p)

Then we can estimate a logistic regression model with interaction:

 mod  <-  glm(y ~ x_1+x_2+x_1:x_2, family=binomial()  )
 summary(mod)

Call:
glm(formula = y ~ x_1 + x_2 + x_1:x_2, family = binomial())

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.8020  -1.0888  -0.4648   1.2574   2.1349  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -2.17084    0.06596 -32.909  < 2e-16 ***
x_1          1.98470    0.07723  25.697  < 2e-16 ***
x_2          1.95885    0.07726  25.353  < 2e-16 ***
x_1:x_2     -0.36882    0.10055  -3.668 0.000244 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 13769  on 9999  degrees of freedom
Residual deviance: 11016  on 9996  degrees of freedom
AIC: 11024

Number of Fisher Scoring iterations: 4

Note the interaction term!

Can we recover the probabilities $p$ from this model output?

 newdata  <-  expand.grid(x_1=0:1,x_2=0:1)
 pred  <-  predict(mod,newdata=newdata,type="response")
 cbind(pred,newdata)
    pred x_1 x_2
1 0.1024   0   0
2 0.4536   1   0
3 0.4472   0   1
4 0.8028   1   1

Yes, we can.

Then, what happens if we fit a logistic model without interactions?

mod.wi  <-  glm(y ~ x_1+x_2, family=binomial()  )
 summary(mod.wi)

Call:
glm(formula = y ~ x_1 + x_2, family = binomial())

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.8449  -1.0642  -0.4994   1.2836   2.0705  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept) -2.01884    0.04838  -41.73   <2e-16 ***
x_1          1.77265    0.04914   36.07   <2e-16 ***
x_2          1.74662    0.04914   35.55   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 13769  on 9999  degrees of freedom
Residual deviance: 11030  on 9997  degrees of freedom
AIC: 11036

Number of Fisher Scoring iterations: 4

 anova(mod.wi, mod,test="Chisq")
Analysis of Deviance Table

Model 1: y ~ x_1 + x_2
Model 2: y ~ x_1 + x_2 + x_1:x_2
  Resid. Df Resid. Dev Df Deviance  Pr(>Chi)    
1      9997      11030                          
2      9996      11016  1   13.611 0.0002248 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
 pred.wi  <-  predict(mod.wi,newdata=newdata,type="response")
 cbind(pred.wi,newdata)
    pred.wi x_1 x_2
1 0.1172386   0   0
2 0.4387614   1   0
3 0.4323614   0   1
4 0.8176386   1   1

Note how the estimated parameters changes a lot, while the fitted probabilities do not change that much (about 0.02). But anyhow, for most people the fitted probabilities are easier to understand than the fitted log-oddsratios, so this teqnique of showing fitted probabilities is preferred for logistic regression, and should be more used. (with probabilities closer to zero or one the difference would be more pronounced. Try that yourself by editing the code above).

$\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.