[R] Stepwise regression

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Dec 10 14:03:42 CET 2008


Maithili Shiva wrote:
> 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.

Knowing that only X1 and X2 are "insignificant" does not mean you know 
that b3=b4=0, so why are you deleting X3 and X4 from the model?

Frank

> 
> 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
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list