O'Reilly logo

R Data Analysis Cookbook - Second Edition by Kuntal Ganguly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

For a description of steps 1 through 6, refer to the How it works section of the Performing linear regression recipe in this chapter (the previous recipe).

Step 7 runs the variable selection procedure. We have chosen to illustrate backward elimination in which the system first builds the model with all the predictors and eliminates predictors based on AIC scores. We show the sample output here:

Start: AIC=778.38 mpg ~ cylinders + displacement + horsepower + weight + acceleration Df Sum of Sq RSS AIC - acceleration 1 0.01 4232.1 776.38 - displacement 1 3.01 4235.1 776.58 <none> 4232.1 778.38 - horsepower 1 259.61 4491.7 793.05 - weight 1 349.99 4582.1 798.63 - cylinders 4 859.84 5091.9 822.17 Step: AIC=776.38 mpg ~ cylinders ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required