[R] question regarding GAM from a novice (in GAM as well as in R)
kjetil brinchmann halvorsen
kjetil at entelnet.bo
Sun Jul 13 00:22:01 CEST 2003
On 12 Jul 2003 at 18:50, Tor A Strand wrote:
Hei!
> Need to use generalized additive models and have therefore obtained R
>
> I am able to do the analysis but I have problems understanding the syntax
> and the options
>
> Can someone explain what some of the terms do in this model do:?
>
> c<-gam(depvar~var1+var2+s(var3)+s(var4, by=var5)+s(var6, var7)+s(var8,3),
> data=xdataset )
>
> I do not use the terms including var4- var8 in my model, just want to know
> what they do.
>
> +s(var4, by=var5)
Presumably var5 is a factor, separate smooths are calculated for each
level of the factor. This is a kind of interaction.
> +s(var6, var7)
This looks like a bivariate smooth, that is , a surface. Never tried
that.
> +s(var8,3)
second argument is the number of degrees of freedom.
>
> Furthermore, the results become rather different when I change the model to:
>
> c<-gam(depvar~var1+var2-1+s(var3)+s(var4, by=var5)+s(var6, var7)+s(var8,3),
> data=xdataset )
> # note just adding a -1
>
> Why.
This is removing the intercept from the model, and as all smooths are
centered at zero in some way, that should have more or less the same
effect as removing the intercept from a linear model. That can make a
HUGE difference.
>
> Please forgive my ignorance.
You probably have a local expert at Haukeland: Try to call
Tore Wenzel-Larsen if you need more help.
Kjetil Halvorsen
>
>
> Dr. Tor A Strand
> Centre for International Health
> Haukeland Hospital
> University of Bergen
> 5021 Bergen
> Norway
> Phone: (country prefix 47)
> Residence:56 51 10 88, office: 55 97 49 80,
> fax: 55 97 49 79, cellular: 90 97 10 86
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list