[R] step.gam and number of tested smooth functions

From: <astrzelczak_at_ps.pl>
Date: Wed 12 Oct 2005 - 19:04:49 EST

Hi,

I'm working with step.gam in gam package. I'm interested both in spline and lowess functions and when I define all the models that I'm interested in I get something like that:

> gam.object.ALC<-gam(X143S~ALC,data=dane,family=binomial)
>

step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC+s(ALC,2)+s(ALC,3)+s(ALC,4)+s(ALC,6)+s(ALC,8)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))

Start:  X143S ~ ALC; AIC= 104.0815
Trial:  X143S ~  1; AIC= 111.1054
Trial:  X143S ~  s(ALC, 2); AIC= 103.3325
Step :  X143S ~ s(ALC, 2) ; AIC= 103.3325

Trial: X143S ~ s(ALC, 3); AIC= 102.9598 Step : X143S ~ s(ALC, 3) ; AIC= 102.9598

Trial: X143S ~ s(ALC, 4); AIC= 102.2103 Step : X143S ~ s(ALC, 4) ; AIC= 102.2103

Trial: X143S ~ s(ALC, 6); AIC= 102.4548

I have impression that the algorithm stops when the next trial gives higher AIC without examining further functions. When I deleted some of the spline functions that were worse than s(ALC,4) I got:

 >
step.gam.ALC<-step.gam(gam.object.ALC,scope=list("ALC"=~1+ALC++s(ALC,4)+lo(ALC,degree=1,span=.5)+lo(ALC,degree=2,span=.5)+lo(ALC,degree=1,span=.25)+lo(ALC,degree=2,span=.25)))

Start:  X143S ~ ALC; AIC= 104.0815
Trial:  X143S ~  1; AIC= 111.1054
Trial:  X143S ~  s(ALC, 4); AIC= 102.2103
Step :  X143S ~ s(ALC, 4) ; AIC= 102.2103

Trial: X143S ~ lo(ALC, degree = 1, span = 0.5); AIC= 99.8127 Step : X143S ~ lo(ALC, degree = 1, span = 0.5) ; AIC= 99.8127

Trial: X143S ~ lo(ALC, degree = 2, span = 0.5); AIC= 100.5275

Lowess turned out to be better in this situation. Is there any way to examine all the models without stopping when AIC is higher in the next trial? Or maybe manual handling is the only solution?

thanks for help in advance

Agnieszka Strzelczak



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 12 19:11:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:41 EST