[R] question regarding GAM from a novice (in GAM as well as in R)
Tor A Strand
Tor.Strand at cih.uib.no
Mon Jul 14 00:45:14 CEST 2003
On 7/13/03 12:22 AM, "kjetil brinchmann halvorsen" <kjetil at entelnet.bo>
wrote:
> 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
>
All of the above were extremely useful. I will also ask Tore.
Thanks
More information about the R-help
mailing list