[R] Selection of regressors

beginner paxkn at nottingham.ac.uk
Sat Aug 24 18:48:52 CEST 2013


I have a question about the package leaps which I am using for model
selection.

I would like to compare 4 different selection methods: forward, backward,
stepwise and best subset. I used the code below:

library(leaps) forward <- regsubsets(Response ~.,data = mydata, method =
"forward", nbest=1)
backward <- regsubsets(Response ~.,data = mydata, method = "backward",
nbest=1) stepwise <- regsubsets(Response ~., data = mydata, method =
"seqrep", nbest=1) best subset <- regsubsets(Response ~.,data = mydata,
method = "forward", nbest=1)


opt = par (mfrow =c(2,2)) plot(forward, scale = "adjr2", main = "Forward
Selection") plot(backward, scale = "adjr2", main = "Backward Selection")
plot(stepwise, scale = "adjr2", main = "Stepwise selection") plot(best
subset, scale = "adjr2", main = "Best subset selection")

Using these commands I obtained figures below:
<http://r.789695.n4.nabble.com/file/n4674451/leaps.png> 

I am wondering why figure A and D are similar to each other (and also figure
B aand C). I would expect different algorithms to select models in a
different way. For instance models selected with forward selection method
should be chosen based on the significance level/ AIC value. On the other
hand models selected with best subset selection method should be chosen
based on the sample satisitcs. I am also wondering why forward selection
does not choose one variable at the time adding it to the exisitng model ?
Also Fig B shows that backward selection starts with eight variables in the
model. Why it does not start with all the variables and excludes one at the
time ?

I would be very grateful for these clarifications.



--
View this message in context: http://r.789695.n4.nabble.com/Selection-of-regressors-tp4674451.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list