Wenxin Liu wrote:
Hello Lady or Sir,
I want to do model selection with 'step' function. But there is a trouble to
me.
For example, there are 5 independent variables, X0,X1,X2,X3 and X4; and 1
dependent variable y.
I want to run stepwise regression y ~ X0 + X1 + X2 + X3 + X4, and I want to
keep X0 always in the
model. Every time when I run command 'step' with 'keep', error information
"could not find function 'keep' "
is always shown. Could you tell me how to use the parameter 'keep' in
'step' function?
You're obviously not defining a keep() function.
Use the scope= argument:
fm <- lm(y ~ X0 + X1 + X2 + X3 + X4)
sfm <- step(fm, scope = list(lower = ~ X0))
See an example in ?stepAIC in the MASS package or the
book referenced there.
-Peter Ehlers
Thank you very much and best regards,
Wenxin Liu
2009.11.02
-------------------------------------------------------------------------------------
Wenxin Liu, Postdoc., Scientific staff
State Plant Breeding Institute(720)
University of Hohenheim
70593 Stuttgart, Germany
PhoneNo.: +49-(0)711-459-22670
Telefax : +49-(0)711-459-23841
Email : wenxin....@uni-hohenheim.de (academic)
or lwx.bios...@gmail.com (personal)
[[alternative HTML version deleted]]
______________________________________________
R-help@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.
______________________________________________
R-help@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.