在 R 中,该step
命令旨在帮助您选择模型的输入变量,对吧?
以下来自
example(step)#-> swiss
&
step(lm1)
> step(lm1)
Start: AIC=190.69
Fertility ~ Agriculture + Examination + Education + Catholic +
Infant.Mortality
Df Sum of Sq RSS AIC
- Examination 1 53.03 2158.1 189.86
<none> 2105.0 190.69
- Agriculture 1 307.72 2412.8 195.10
- Infant.Mortality 1 408.75 2513.8 197.03
- Catholic 1 447.71 2552.8 197.75
- Education 1 1162.56 3267.6 209.36
Step: AIC=189.86
Fertility ~ Agriculture + Education + Catholic + Infant.Mortality
Df Sum of Sq RSS AIC
<none> 2158.1 189.86
- Agriculture 1 264.18 2422.2 193.29
- Infant.Mortality 1 409.81 2567.9 196.03
- Catholic 1 956.57 3114.6 205.10
- Education 1 2249.97 4408.0 221.43
Call:
lm(formula = Fertility ~ Agriculture + Education + Catholic + Infant.Mortality, data = swiss)
Coefficients:
(Intercept) Agriculture Education
62.1013 -0.1546 -0.9803
Catholic Infant.Mortality
0.1247 1.0784
现在,当我看到这个时,我猜最后一个 Step 表是我们应该使用的模型?最后几行包括“调用”函数,它描述了实际模型及其包含的输入变量,“系数”是这些值的实际参数估计值,对吧?所以这就是我想要的模型,对吧?我试图将此推断到我的项目中,那里有更多变量。