Interpretation of multiple logistic regression with interactions in R - Cross Validated most recent 30 from stats.stackexchange.com 2019-08-23T18:17:16Z https://stats.stackexchange.com/feeds/question/115188 http://www.creativecommons.org/licenses/by-sa/3.0/rdf https://stats.stackexchange.com/q/115188 6 Interpretation of multiple logistic regression with interactions in R user55651 https://stats.stackexchange.com/users/55651 2014-09-12T00:05:54Z 2014-09-12T17:31:41Z <p>I am trying to look at whether 2 variables (one dichotomous categorical and one continuous) predict the occurrence of a dichotomous categorical dependent variable.</p> <pre><code>dependent variable is LENIpos - 0 = no event, 1 = event predictor variables are Hip.Prox.Femur - 0 = no hip fracture, 1 = hip fracture and age (continuous) </code></pre> <p>Both predictor variables have significant p values in separate chi square test and Mann Whitney U test respectively.</p> <p>When I run a logistic regression <code>glm(LENIpos ~ age + Hip.Prox.Femur, family = "binomial)</code>, the variables come out as not significant. (1)</p> <p>However, when I run the logistic regression with interactions <code>glm(LENIpos ~ age * Hip.Prox.Femur...)</code> (2), they are no both significant. How is this to be interpreted?</p> <p>Example R outputs:</p> <p>(1)</p> <pre><code>Call: glm(formula = LENIpos ~ age + Hip.Prox.Fem, family = "binomial", data = dvt) Deviance Residuals: Min 1Q Median 3Q Max -0.9346 -0.7826 -0.4952 -0.3374 2.1897 Coefficients: Estimate Std. Error z value Pr(&gt;|z|) (Intercept) -3.46888 1.00693 -3.445 0.000571 *** age 0.02122 0.01519 1.397 0.162535 Hip.Prox.Femhip fracture 0.72410 0.57790 1.253 0.210212 (Dispersion parameter for binomial family taken to be 1) Null deviance: 145.23 on 151 degrees of freedom Residual deviance: 135.48 on 149 degrees of freedom AIC: 141.48 Number of Fisher Scoring iterations: 5 </code></pre> <p>(2)</p> <pre><code>glm(formula = LENIpos ~ age * Hip.Prox.Fem, family = "binomial", data = dvt) Deviance Residuals: Min 1Q Median 3Q Max -1.0364 -0.7815 -0.5373 -0.1761 2.3443 Coefficients: Estimate Std. Error z value Pr(&gt;|z|) (Intercept) -5.89984 1.98289 -2.975 0.00293 ** age 0.05851 0.02818 2.076 0.03788 * Hip.Prox.Femhip fracture 5.04990 2.46269 2.051 0.04031 * age:Hip.Prox.Femhip fracture -0.06058 0.03339 -1.814 0.06965 . (Dispersion parameter for binomial family taken to be 1) Null deviance: 145.23 on 151 degrees of freedom Residual deviance: 131.82 on 148 degrees of freedom AIC: 139.82 Number of Fisher Scoring iterations: 6 </code></pre> https://stats.stackexchange.com/questions/115188/-/115274#115274 2 Answer by EdM for Interpretation of multiple logistic regression with interactions in R EdM https://stats.stackexchange.com/users/28500 2014-09-12T15:26:34Z 2014-09-12T15:26:34Z <p>The relation of <code>age</code> or <code>Hip.Prox.Femhip</code> to the probability of <code>LENIpos</code> depends on the value of the other variable. That is suggested by the interaction term in your second model. In the usual R presentaton of regression coefficients, the coefficient for <code>age</code> in the second model is the relation of <code>LENIpos</code> to <code>age</code> in the absence of fracture, and the interaction term (<code>age:Hip.Prox.Femhip fracture</code>) is the <em>difference</em> from that relation in the presence of fracture. So the data seem consistent with age having a relation to<code>LENIpos</code> in the absence of fracture, but not in the presence of fracture. Plots of the +/- fracture subsets should help clarify this.</p> https://stats.stackexchange.com/questions/115188/-/115289#115289 1 Answer by gung for Interpretation of multiple logistic regression with interactions in R gung https://stats.stackexchange.com/users/7290 2014-09-12T17:31:41Z 2014-09-12T17:31:41Z <p>@EdM is right. The fact that the interaction's p-value is .06 (i.e., 'not-significant') is meaningless; you have an interaction. Let me add a few more details to supplement his (?) answer: </p> <ul> <li>A Mann-Whitney U-test of <code>age~LENIpos</code> isn't really the same as the univariate logistic regression of <code>LENIpos~age</code> (although the p-values will almost always be both significant or both not). You would do better to assess the univariate association by running the logistic regression. </li> <li><p>In R, a multiple linear regression comes with a global F-test of the model by default, but a multiple logistic regression does not (unfortunately). However, you can get a global test by assessing the difference between the null and residual deviances against a chi-squared distribution with the degrees of freedom equal to the difference between the null and residual dfs. Here is the test for your first model: </p> <pre><code>&gt; pchisq(q=145.23-135.48, df=151-149, lower.tail=FALSE)  0.007635094 </code></pre> <p>So it is clear that your first model is significant. </p></li> <li><p>This seeming paradox (both univariate analyses significant, and the two predictor model significant even though neither predictor itself is significant) has a hidden cause: Your two predictors are themselves correlated. (The general name for this is <a href="http://en.wikipedia.org/wiki/Multicollinearity" rel="nofollow noreferrer">multicollinearity</a>.) As a result, the model doesn't know which of the two to attribute the association and expands both standard errors to acknowledge this fact. </p> <p><em>(Note that the preceding discussion ignores the existence of the interaction.)</em> </p></li> </ul> <hr> <ul> <li><p>As @EdM states, plotting these functions can help you understand the interaction. Here is a basic plot with your output: </p> <pre><code>lo.to.p = function(lo){ odds = exp(lo) prob = odds / (odds+1) return(prob) } age = 0:80 lo.no = -5.89984 + 0.05851*age lo.fr = (-5.89984 + 5.04990) + (0.05851 + -0.06058)*age p.no = lo.to.p(lo.no) p.fr = lo.to.p(lo.fr) windows() plot( age, p.no, col="blue", type="l", ylim=c(0,1), ylab="probability of LENIpos") lines(age, p.fr, col="red") legend("topleft", legend=c("no fracture", "fracture"), lty=1, col=c("blue","red")) </code></pre></li> </ul> <p><img src="https://i.stack.imgur.com/jXIFo.png" alt="enter image description here"></p>