[R] stepwise regression-fitting all possible models
aspa
a.angelakopoulou at gmail.com
Tue Apr 13 18:51:52 CEST 2010
Dear All,
I am new to R and I would like to do the following:
I want to fit a logistic model with 3 predictors and then perform a stepwise
regression to select the best possible model using either the AIC/BIC
criterion.
I have used the stepAIC function which works fine but using this method only
likely candidates are evaluated (i.e. not all the models are fitted). We
should have 2^3=8 possible models.
So I want to do the following. Write a code in R which will allow me to fit
all 8 possible models. So, i guess the first combination will be c(0,0,0)
for the 3 predictors, then c(0,0,1) for then next one and so one until 8
models are fitted.
I would be really grateful if I could get some advise as to how to write the
coding to tell R to fit each of these models in turn and extract the
log-likelihood for each one of them so that I will be able to calculated
AIC/BIC afterwards.
Many thanks for your help,
A
--
View this message in context: http://n4.nabble.com/stepwise-regression-fitting-all-possible-models-tp1838735p1838735.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list