Dear R-users:
Im trying (using gam package) to develop a stepwise analysis. My gam
object contains five pedictor variables (a,b,c,d,e,f). I define the
step.gam:
step.gam(gamobject, scope=list("a"= ~s(a,4), "b"= ~s(b,4),
"c"= ~s(c,4),
"d"= ~s(d,4), "e"= ~s(e,4), "f"= ~s(f,4)))
However, the result shows a formula containing the whole model, without
eliminating any variable.
Anybody can help me?
Thanks
--
David Nogués Bravo
Functional Ecology and Biodiversity Department
Pyrenean Institute of Ecology
Spanish Research Council
Av. Montañana 1005
Zaragoza - CP 50059
976716142 - 976716019 (fax)
[[alternative HTML version deleted]]
On Wed, 2004-12-01 at 17:09, David Nogu??s wrote:> Dear R-users: > > Im trying (using gam package) to develop a stepwise analysis. My gam > object contains five pedictor variables (a,b,c,d,e,f). I define the > step.gam: > > step.gam(gamobject, scope=list("a"= ~s(a,4), "b"= ~s(b,4), "c"= ~s(c,4), > "d"= ~s(d,4), "e"= ~s(e,4), "f"= ~s(f,4))) >Your scope doesn't look much like Trevor Hastie's help page. Have you tried formulating your scope like Hastie tells you to do? That is, for "a" you should list all possible cases for stepping instead of only one. That is, something like ..."a" = ~ 1 + a + s(a, 2) + s(a, 4)..... Why do you want to use this kind of stepping, when the standard package mgcv has a much better way of model building using generalized cross validation? Dave Roberts discusses R/S-plus (or mgcv/gam package level) gam fitting in ecological context at http://labdsv.nr.usu.edu/splus_R/lab5/lab5.html. You may find some useful hints here, as Dave is partial to the traditional S-plus gam as well. cheers, jari oksanen -- Jari Oksanen -- Dept Biology, Univ Oulu, 90014 Oulu, Finland email jari.oksanen at oulu.fi, homepage http://cc.oulu.fi/~jarioksa/
> Dave Roberts discusses R/S-plus (or mgcv/gam package level) gam fitting > in ecological context at > http://labdsv.nr.usu.edu/splus_R/lab5/lab5.html. You may find some > useful hints here, as Dave is partial to the traditional S-plus gam as > well.This looks good to me, too. One or two things have changed since it was written, though - in particular mgcv does have summary and anova methods, and mgcv::gam can handle smooth interactions using s() or te() terms (gam::gam can handle smooth interactions using lo() terms, which behave more like mgcv s() terms rather than te() terms). Simon _____________________________________________________________________> Simon Wood simon at stats.gla.ac.uk www.stats.gla.ac.uk/~simon/ >> Department of Statistics, University of Glasgow, Glasgow, G12 8QQ >>> Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814