[R] Interactions in GAMMs
Vito Muggeo (UniPa)
vito.muggeo at unipa.it
Wed Jul 21 17:27:46 CEST 2010
Hi Karen,
I think you should decide what you mean for "interaction". s(x:y) is
meaningless
If you want to fit a surface you should use s(x,y).
If you want to fit a varying coefficient model (interaction between a
linear and a smooth term) you should use the argument by in s().
The help files of the mgcv package by S. Wood are quite clear and they
also include a lot of examples.
Hope this helps you
vito
Karen Moore ha scritto:
> Hi,
>
> I've an issue adding an interaction to a GAMM:
>
> My model was of form:
>
> gamm1 <- gamm(TOTSR ~ fROT + s(PH) + s(LOI) + s(ASP) + s(SQRT_ELEV) + CANCOV
> + s(SQRT_TOTCWD) + s(WELLF) + s(WELLN) + s(OLDWDLD) + s(DISTWOOD) +
> s(Annprec) + s(OLDWDLD:DISTWOOD) + (1|fSITE), family = poisson, data =
> BIOFOR2)
>
> with interaction of s(OLDWDLD:DISTWOOD).
>
> However I got this error message below but don't know what it means? (my
> data is composed of info for 150 plots)
>
> #I Warning messages:
> #2: In OLDWDLD:DISTWOOD :
> # numerical expression has 150 elements: only the first used
> #3: In OLDWDLD:DISTWOOD :
> # numerical expression has 150 elements: only the first used
>
> Can anyone offer advice on how to include this interaction in GAMM model?
> Thanks
>
> Karen Moore
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 23895240
fax: 091 485726/485612
http://dssm.unipa.it/vmuggeo
More information about the R-help
mailing list