Hello,
I am trying to fit a gamm (package mgcv) model with a smooth term, a linear
term, and an interaction between the two. The reason I am using gamm rather than
gam is that there are repeated measures in time (which is the smooth term x1),
so I am including an AR1 autocorrelation term. The model I have so far ended up
with is of the type
gamm(y ~ s(x1) + s(x1, by=x2), correlation = corAR1(form= ~ x1|Unit))
where Units are replicate experimental units from which we have sampled.
I have a few questions that I have been unable to find answers to:
1) Is this model doing what I hope it is doing (see above)? Prior to adding the
AR1 component, I used gam and was able to run the (more intuitive) model
gam(y ~ s(x1) + x2 + s(x1, by=x2))
with a separate term (and output) for the linear x2, but unfortunately I
don't seem to get this to work with gamm. Can I somehow estimate the
significance (and slope) of the linear term with a gamm model?
2) When I run the gamm model above, I end up with a significant intercept,
significant smooth term x1 and a significant interaction s(x1):x2. The
interaction has an edf of 6.87, i.e. it is far from linear. My next question is
how to interpret this interaction: If I plot the interaction with x1 (time) on
x-axis and s(x1):x2 on y-axis, can I somehow relate the value of the interaction
term at a particular point in time to the slope of the linear x2 term at that
point in time?
Appreciate any help with this as I am relatively new to both r and gam(m).
Aino Hosia
Postdoc
Institute of Marine Research
PO Box 1870 Nordnes, N-5817 Bergen, Norway
(Nordnesgaten 50)
Tel: +47 55 23 53 49
E-mail: aino.hosia at imr.no