[R] Interactions in GAMMs

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Jul 21 20:21:50 CEST 2010


On Wed, 2010-07-21 at 16:17 +0100, Karen Moore wrote:
> 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)

An interaction is formed in a GAMM using a smoother in two or more
dimensions, such as s(OLDWDLD, DISTWOOD) or te(OLDWDLD, DISTWOOD), the
latter allows for different basis function within the two smoothers and
for different inherent scales for the two variables.

IIRC the latter allows you to produce strictly nested models for
likelihood ratio testing:

te(OLDWDLD) + te(DISTWOOD)

is nested within

te(OLDWDLD, DISTWOOD)

HTH

G

> 
> #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.

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-help mailing list