Example code:
Note that the p-value for Infant.Mortality
is 0.00169, by using the selection criterium of either 0.0016 or 0.0017 the variable becomes selected or not.
> library(StepReg)
> summary(lm(Fertility ~ Education + Catholic + Infant.Mortality, dat = swiss))
Call:
lm(formula = Fertility ~ Education + Catholic + Infant.Mortality,
data = swiss)
Residuals:
Min 1Q Median 3Q Max
-14.4781 -5.4403 -0.5143 4.1568 15.1187
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 48.67707 7.91908 6.147 2.24e-07 ***
Education -0.75925 0.11680 -6.501 6.83e-08 ***
Catholic 0.09607 0.02722 3.530 0.00101 **
Infant.Mortality 1.29615 0.38699 3.349 0.00169 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 7.505 on 43 degrees of freedom
Multiple R-squared: 0.6625, Adjusted R-squared: 0.639
F-statistic: 28.14 on 3 and 43 DF, p-value: 3.15e-10
> stepwise(Fertility ~., data = swiss , sle = 0.0016, select = "SL")$Process
Step EnteredEffect RemovedEffect DF NumberEffectIn NumberParmsIn SL
1 0 1 1 0 1 1
2 1 Education 1 1 2 3.65861696596238e-07
3 2 Catholic 1 2 3 0.000559833157909886
> stepwise(Fertility ~., data = swiss , sle = 0.0017, select = "SL")$Process
Step EnteredEffect RemovedEffect DF NumberEffectIn NumberParmsIn SL
1 0 1 1 0 1 1
2 1 Education 1 1 2 3.65861696596238e-07
3 2 Catholic 1 2 3 0.000559833157909886
4 3 Infant.Mortality 1 3 4 0.00169375295474758