Re: [R] Extracting variable names of final model in stepAIC

2008-08-05 Thread Prof Brian Ripley
The 'final model' returned by stepAIC is just a model fit, so you do this the same way as any fit. I'll assume you want to know for lm() fits, but this is fairly general. library(MASS) example(stepAIC) formula(quine.stp) attr(terms(quine.stp), "term.labels") (You are making a habit of asking

[R] Extracting variable names of final model in stepAIC

2008-08-04 Thread Chua Siang Li
Hello there. I uses the following codes for the purpose of variable selection. > lmModel <- lm(y~.,data.frame(y=y, x=x)) > step <- stepAIC(lmModel, direction="both") > step$anova Stepwise Model Path Analysis of Deviance Table Initial Model: y ~ x.Market.Price + x.Qua