[R] mle.stepwise

eariasca eariasca at math.ucsd.edu
Mon Feb 8 22:42:22 CET 2010


Hello,

I have a basic question on mle.stepwise, which seems to return  
strange answers, even on a basic example.  I posted this last May but  
never got an answer.  I resend it here hoping it will this time.

# BEGIN

require(wle)
x1 = runif(100)
x2 = runif(100)
y = 3 + 2*x1 + rnorm(100)	

# so x1 is in the model, but not x2

mle.stepwise(y ~ x1 + x2, type = "Backward")		

# Backward selection gets it right, the other two return non-sense

mle.stepwise(y ~ x1 + x2)	
mle.stepwise(y ~ x1 + x2, type = "Stepwise")

# If the variables are entered in a different order, the result changes

mle.stepwise(y ~ x2 + x1)
mle.stepwise(y ~ x2 + x1, type = "Stepwise")

# END

I am running R version 2.10.1 on Mac OS X 10.4.11 and wle 0.9-3.

Any idea?  Help much appreciated.

Thanks,
Ery



More information about the R-help mailing list