Page 439 - Applied Statistics with R
P. 439

17.3. WORKING WITH LOGISTIC REGRESSION                            439


                      ## age                  0.062416    0.009723   6.419 1.37e-10 ***
                      ## ldl:famhistPresent   0.314311    0.114922   2.735   0.00624 **
                      ## ---
                      ## Signif. codes:   0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
                      ##
                      ## (Dispersion parameter for binomial family taken to be 1)
                      ##
                      ##      Null deviance: 596.11   on 461  degrees of freedom
                      ## Residual deviance: 477.46    on 455  degrees of freedom
                      ## AIC: 491.46
                      ##
                      ## Number of Fisher Scoring iterations: 5


                      Based on the   -test seen in the above summary, this interaction is significant.
                      The effect of LDL on the probability of CHD is different depending on family
                      history.


                      17.3.7.2 Polynomial Terms

                      Let’s take the previous model, and now add a polynomial term.

                      chd_mod_int_quad = glm(chd ~ alcohol + ldl + famhist + typea + age + ldl:famhist + I(ldl^2),
                                              data = SAheart, family = binomial)
                      summary(chd_mod_int_quad)


                      ##
                      ## Call:
                      ## glm(formula = chd ~ alcohol + ldl + famhist + typea + age + ldl:famhist +
                      ##      I(ldl^2), family = binomial, data = SAheart)
                      ##
                      ## Deviance Residuals:
                      ##      Min       1Q   Median        3Q      Max
                      ## -1.8953   -0.8311  -0.4556    0.9276   2.5204
                      ##
                      ## Coefficients:
                      ##                      Estimate Std. Error z value Pr(>|z|)
                      ## (Intercept)         -6.096747    1.065952  -5.720 1.07e-08 ***
                      ## alcohol              0.003842    0.004350   0.883   0.37716
                      ## ldl                  0.056876    0.214420   0.265   0.79081
                      ## famhistPresent      -0.723769    0.625167  -1.158   0.24698
                      ## typea                0.036248    0.012171   2.978   0.00290 **
                      ## age                  0.062299    0.009788   6.365 1.95e-10 ***
                      ## I(ldl^2)            -0.001587    0.015076  -0.105   0.91617
                      ## ldl:famhistPresent   0.311615    0.117559   2.651   0.00803 **
   434   435   436   437   438   439   440   441   442   443   444