Page 396 - Applied Statistics with R
P. 396

396    CHAPTER 16. VARIABLE SELECTION AND MODEL BUILDING


                                 ## Step:   AIC=279.89
                                 ## hipcenter ~ HtShoes + Leg
                                 ##
                                 ##            Df Sum of Sq   RSS     AIC
                                 ## - Leg       1    3038.8 48105 278.73
                                 ## <none>                  45067 279.89
                                 ## - HtShoes   1    5004.4 50071 280.25
                                 ##
                                 ## Step:   AIC=278.73
                                 ## hipcenter ~ HtShoes
                                 ##
                                 ##            Df Sum of Sq    RSS     AIC
                                 ## <none>                   48105 278.73
                                 ## - HtShoes   1     83534 131639 313.35


                                 The procedure is exactly the same, except at each step we look to improve the
                                 BIC, which R still labels AIC in the output.

                                 The variable hipcenter_mod_back_bic stores the model chosen by this proce-
                                 dure.

                                 coef(hipcenter_mod_back_bic)



                                 ## (Intercept)      HtShoes
                                 ##  565.592659    -4.262091


                                 We note that this model is smaller, has fewer predictors, than the model chosen
                                 by AIC, which is what we would expect. Also note that while both models are
                                 different, neither uses both Ht and HtShoes which are extremely correlated.
                                 We can use information from the summary() function to compare their Adjusted
                                   2
                                    values. Note that either selected model performs better than the original
                                 full model.
                                 summary(hipcenter_mod)$adj.r.squared



                                 ## [1] 0.6000855

                                 summary(hipcenter_mod_back_aic)$adj.r.squared



                                 ## [1] 0.6531427
   391   392   393   394   395   396   397   398   399   400   401