[R] passing model objects to anova()

David Orme d.orme at ic.ac.uk
Tue May 28 12:46:23 CEST 2002


I'm fitting a glm to a dataset...

>  objects()
  [1] "pop.div.full"                    "speciation.data"

...and then performing model simplification to give a series of model 
objects all of which have a common suffix.

>  objects()
  [1] "pop.div.full"                    "pop.div.gp.f.b.hm"
  [3] "pop.div.gp.fb.hm"                "pop.div.same.slopes"
  [5] "speciation.data"
I am using anova(model1, model2...) to test the significance of term 
deletion within the series of models. Is there any way to pass 
objects() called with a pattern to anova(). i.e something like...

>  anova(list = objects(pattern="pop.div"),test="Chisq")

instead of

>  anova(pop.div.full, pop.div.gp.f.b.hm, pop.div.gp.fb.hm, 

OK, in this example it isn't a lot of typing/cut and paste but it 
could be quite handy if there is a simple way of doing it, 
particularly when I have more than one set of full model and 
simplifications with different prefixes or with larger models with 
more simplifications.  Any suggestions gratefully received.

David Orme

>  R.version
platform ppc-apple-macos
arch     ppc
os       MacOS
system   ppc, MacOS
major    1
minor    5.0
year     2002
month    04
day      29
language R

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list