[R] Stepwise regression
Maithili Shiva
maithili_shiva at yahoo.com
Wed Dec 10 07:34:56 CET 2008
Hi,
I have the response variable 'Y' and four predictors say X1, X2, X3 and X4. Assuming all the assmptions like Y follows normal distribution etc. hold and I want to run linear multiple regression. How do I run the stepwise regression (forward as well as the backward regression).
>From other software (i.e. minitab), I know only X1 and X2 are significant so my regression equation should be Y = constant + (b1) X1 + (b2) X2.
I am not sure whether I am using the correct R commands, which are as follows -
library (wle)
ONS <- mle.stepwise(Y ~ X1+X2+X3+X4, data=ONS)
summary(ONS)
The output looks something like this
OUTPUT
Forward selection procedure
F.in: 4
Last 3 iterations:
(Intercept) X1 X2 X3 X4
[1,] 1 0 0 0 1 15.57
[2,] 1 1 0 0 1 14.80
[3,] 1 1 1 0 1 61.56
I am not able to interpret this outcome as well.
Please guide.
With regards
Maithili
More information about the R-help
mailing list