I'm attempting to select a model using stepAIC. I want to use a forward selection procedure. I have specified a "scope" option, but must not be understanding how this works. My results indicate that the procedure begins and ends with the "full" model (i.e., all 17 independent variables)...not what I expected. Could someone please point out what I'm not understanding? My code is below. Thanks. Marc> m1.stepFwd <- stepAIC(m1, direction="forward",+ scope=list(upper=~age.refc.fo + dusz.cat.fo + + ed.du.f + emp.ref.f + geodist3.f + has.fone.f + + healthdu.f + help.du.f + inc.ref.f + maj.act.f + + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + + sex.ref.f + type.psu.f + urb.stat.f, lower=~1)) Start: AIC= 4752.19 response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + sex.ref.f + type.psu.f + urb.stat.f>> m1.stepFwd$anovaStepwise Model Path Analysis of Deviance Table Initial Model: response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + sex.ref.f + type.psu.f + urb.stat.f Final Model: response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + sex.ref.f + type.psu.f + urb.stat.f Step Df Deviance Resid. Df Resid. Dev AIC 1 NA NA 5311 4660.192 4752.192>[[alternative HTML version deleted]]
What's "m1"? Is it a fit to a ~1? I've used my own modification of stepAIC many times preceeded by "m1 <- lm(y~1, data=...)", and it has worked fine for me. hth. spencer graves MZodet at ahrq.gov wrote:> I'm attempting to select a model using stepAIC. I want to use a forward > selection procedure. I have specified a "scope" option, but must not be > understanding how this works. My results indicate that the procedure begins > and ends with the "full" model (i.e., all 17 independent variables)...not > what I expected. Could someone please point out what I'm not understanding? > My code is below. > > > > Thanks. > > > > Marc > > > > >>m1.stepFwd <- stepAIC(m1, direction="forward", > > > + scope=list(upper=~age.refc.fo + dusz.cat.fo + > > + ed.du.f + emp.ref.f + geodist3.f + has.fone.f + > > + healthdu.f + help.du.f + inc.ref.f + maj.act.f + > > + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + > > + sex.ref.f + type.psu.f + urb.stat.f, lower=~1)) > > Start: AIC= 4752.19 > > response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + > > geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + > > maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + > > sex.ref.f + type.psu.f + urb.stat.f > > > > > >>m1.stepFwd$anova > > > Stepwise Model Path > > Analysis of Deviance Table > > > > Initial Model: > > response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + > > geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + > > maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + > > sex.ref.f + type.psu.f + urb.stat.f > > > > Final Model: > > response ~ age.refc.fo + dusz.cat.fo + ed.du.f + emp.ref.f + > > geodist3.f + has.fone.f + healthdu.f + help.du.f + inc.ref.f + > > maj.act.f + marryref.f + msa.stat.f + regionrf.f + r.e.ref.f + > > sex.ref.f + type.psu.f + urb.stat.f > > > > > > Step Df Deviance Resid. Df Resid. Dev AIC > > 1 NA NA 5311 4660.192 4752.192 > > > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
It starts with the initial model you gave it, which contains all your explanatory variables already. You presumably wanted to use a simpler model to start with. As in: Arguments: object: an object representing a model of an appropriate class. This is used as the initial model in the stepwise search. On Wed, 18 Jun 2003 MZodet at ahrq.gov wrote:> I'm attempting to select a model using stepAIC. I want to use a forward > selection procedure. I have specified a "scope" option, but must not be > understanding how this works. My results indicate that the procedure begins > and ends with the "full" model (i.e., all 17 independent variables)...not > what I expected. Could someone please point out what I'm not understanding?[output snipped] -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Seemingly Similar Threads
- [PATCH] virtio-blk: Don't free ida when disk is in use
- [PATCH] virtio-blk: Don't free ida when disk is in use
- [PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
- [PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
- [PATCH v3] virtio-blk: handle block_device_operations callbacks after hot unplug