> res=residuals(lm)
> dy=step(lm) Start: AIC=
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9
Df Sum of Sq RSS AIC - x4 1 21 3184326 - x9 1 17149 3201454 - x7 1 17700 3202005 - x8 1 54295 3238599 - x6 1 89586 3273891
Step: AIC=
y ~ x1 + x2 + x3 + x5 + x6 + x7 + x8 + x9
Df Sum of Sq RSS AIC - x9 1 17428 3201754 - x7 1 18563 3202889 - x8 1 54437 3238763 - x6 1 91813 3276139
Step: AIC=
y ~ x1 + x2 + x3 + x5 + x6 + x7 + x8
Df Sum of Sq RSS AIC - x7 1 34634 3236387 - x6 1 74800 3276554 - x8 1 82150 3283904
- x3 1 3055353 6257107 - x2 1 5725836 8927590 - x5 1 9382624 - x1 1
Step: AIC=
y ~ x1 + x2 + x3 + x5 + x6 + x8
Df Sum of Sq RSS AIC - x8 1 70813 3307201 - x6 1 152777 3389165
Step: AIC=
y ~ x1 + x2 + x3 + x5 + x6
Df Sum of Sq RSS AIC - x6 1 137540 3444741
Step: AIC=
y ~ x1 + x2 + x3 + x5
Df Sum of Sq RSS AIC
lm(formula = y ~ x1 + x2 + x3 + x5, data = h)
Residuals:
Min 1Q Median 3Q Max
Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) ** x1 *** x2 *** x3 *** x5 *** ---
Signif. codes: 0 ‘***’ ‘**’ ‘*’ ‘.’ ‘ ’
Residual standard error: 364 on 26 degrees of freedom Multiple R-squared: , Adjusted R-squared: F-statistic: on 4 and 26 DF, p-value: <
1
R语言代码试题答案步骤
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)