1

I am looking for a variable selection technique in R to reduce the number of my regression predictors, where I can force the method to keep a specific variable within the model. Here is a toy example from the R help of ?step, the variable "Examination" will be removed:

summary(lm1 <- lm(Fertility ~ ., data = swiss));
slm1 <- step(lm1);
summary(slm1);
Marco
  • 29
  • 1
  • 3
  • 2
    This related thread might help: [Multiple regression with no origin and mix of directly entered and stepwise entered variables using R](http://stats.stackexchange.com/questions/9503/multiple-regression-with-no-origin-and-mix-of-directly-entered-and-stepwise-enter). – chl Jul 07 '11 at 06:14
  • 1
    (+1) to @chl, nice answer regarding `scope` option (and there is enough information on this pre-selection in `?step`). – Dmitrij Celov Jul 07 '11 at 06:48
  • thank you both for your answers! sorry that i missed the information i have been looking for in the R help. best m – Marco Jul 07 '11 at 08:07
  • 1
    Note that typical variable selection strategies (such as stepwise selection algorithms), which I suspect you have in mind based on the reference to `step()`, are not valid. If that doesn't make sense / you want to know why, you may want to read my answer here: [algorithms-for-automatic-model-selection](http://stats.stackexchange.com/questions/20836//20856#20856). – gung - Reinstate Monica May 26 '13 at 19:10

0 Answers0