Import Data Set: Forward Selection
Import Data Set: Forward Selection
> summary(fullmodel)
Call:
lm(formula = y ~ ., data = fdata)
Residuals:
Min 1Q Median 3Q Max
-3.8504 -1.4017 0.0929 1.7541 3.7206
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.11351 5.88549 2.908 0.0131 *
x1 2.39009 1.05740 2.260 0.0432 *
x2 5.74422 4.35113 1.320 0.2114
x3 0.12998 0.52530 0.247 0.8087
x4 2.63623 4.34493 0.607 0.5553
x5 2.32382 1.46160 1.590 0.1378
x6 -1.62471 2.40137 -0.677 0.5115
x7 -0.09723 3.38794 -0.029 0.9776
x8 -0.04445 0.06212 -0.716 0.4879
x9 2.03656 1.97372 1.032 0.3225
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Call:
lm(formula = y ~ 1, data = fdata)
Residuals:
Min 1Q Median 3Q Max
-9.095 -5.071 1.405 3.655 10.805
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 34.995 1.308 26.77 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Step: AIC=49.39
y ~ x1
Step: AIC=48.26
y ~ x1 + x2
Call:
lm(formula = y ~ x1 + x2, data = fdata)
Coefficients:
(Intercept) x1 x2
9.321 2.923 5.550
Call:
lm(formula = y ~ x1 + x2, data = fdata)
Residuals:
Min 1Q Median 3Q Max
-4.8510 -2.0998 0.0266 1.3604 5.1215
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.3207 3.1373 2.971 0.00785 **
x1 2.9232 0.5162 5.663 1.85e-05 ***
x2 5.5497 3.2563 1.704 0.10462
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Backward Elimination
step(fullmodel, direction="backward")
Start: AIC=52.61
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
Step: AIC=50.61
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9
Step: AIC=48.72
y ~ x1 + x2 + x4 + x5 + x6 + x8 + x9
Step: AIC=47.81
y ~ x1 + x2 + x5 + x6 + x8 + x9
Step: AIC=46.96
y ~ x1 + x2 + x5 + x6 + x9
Call:
lm(formula = y ~ x1 + x2 + x5 + x6 + x9, data = fdata)
Coefficients:
(Intercept) x1 x2 x5 x6 x9
16.182 3.055 6.364 2.195 -1.837 1.823
>
be=lm(y~x1+x2+x5+x6+x9, data=fdata)
> summary(be)
Call:
lm(formula = y ~ x1 + x2 + x5 + x6 + x9, data = fdata)
Residuals:
Min 1Q Median 3Q Max
-3.8842 -1.5551 0.1727 1.5600 3.5507
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16.1817 4.5945 3.522 0.00283 **
x1 3.0551 0.5575 5.480 5.04e-05 ***
x2 6.3639 3.1010 2.052 0.05688 .
x5 2.1949 1.2324 1.781 0.09389 .
x6 -1.8373 0.9516 -1.931 0.07141 .
x9 1.8231 1.2774 1.427 0.17274
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Stepwise procedure
step(fullmodel, direction="both")
Start: AIC=52.61
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
Step: AIC=50.61
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x8 + x9
Step: AIC=48.72
y ~ x1 + x2 + x4 + x5 + x6 + x8 + x9
Step: AIC=47.81
y ~ x1 + x2 + x5 + x6 + x8 + x9
Step: AIC=46.96
y ~ x1 + x2 + x5 + x6 + x9
Call:
lm(formula = y ~ x1 + x2 + x5 + x6 + x9, data = fdata)
Coefficients:
(Intercept) x1 x2 x5 x6 x9
16.182 3.055 6.364 2.195 -1.837 1.823
>