[R] Stepwise regression
dwinsemius at comcast.net
Sat Dec 13 02:34:59 CET 2008
On Dec 10, 2008, at 8:03 AM, Frank E Harrell Jr wrote:
> Maithili Shiva wrote:
>> 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?
I think Frank meant to say "knowing that only X1 and X2 are
"significant" does not mean you know that b3=b4=0'. His point I am
guessing, is that when there are valid reasons from prior work
regarding prediction of Y to think that X3 and X4 ought to be in the
model, that it is not proper to drop them just because your data does
not happen show them to be "significant".
>> 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)
>> The output looks something like this
>> 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
>> R-help at r-project.org mailing list
>> 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
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help