How do the fits compare if you add 'method = "REML"' to the gam() call? Simon Wood has shown that GCV can overfit in some circumstances. You might need 'method = "ML"' as I forget what the default in gamm() is.

Some other points: you probably want bs = "cc" for the DOY smooth as it will stop there being a discontinuity between December and January.

You will therefore also need to add bs = c("cr" , "cc") in the te() smooth.

HTH

Gavin

Sent from my HTC

----- Reply message -----
From: "Thackeray, Stephen J." <sjtr@ceh.ac.uk>
Date: Wed, Feb 8, 2012 09:14
Subject: [R-sig-eco] Comparison of gam and gamm fits
To: "&apos;R-sig-ecology@r-project.org&apos;" <R-sig-ecology@r-project.org>

Dear list members,

I apologise in advance for the large-ish email, but I thought it was important to paste in some plots for what follows.

I am using generalised additive models to capture patterns of seasonal and interannual variation in the abundance of zooplankton, in a lake ecosystem. I am trying to fit models with smoothers for year and day of year to capture the "average" pattern in each of these temporal dimensions, and then have added a two-dimensional (tensor product) smoother to try to model any changes in the seasonal pattern among years. I am mindful that I may need to deal with correlated errors in these models and so would like to fit error structures to see if they improve model fit, judged by AIC. Therefore, as a first step I re-fitted the gam model using gamm, to allow later inclusion of a correlation structure:

Daph_gam4<-gam((DAPHG+0.1)~s(Year,bs="cr")+s(DOY,bs="cr")+te(Year,DOY),family=Gamma(link="log"),data=ZooDat2)
Daph_gam4_no_ac<-gamm((DAPHG+0.1)~s(Year,bs="cr")+s(DOY,bs="cr")+te(Year,DOY),family=Gamma(link="log"),data=ZooDat2)

...where DAPHG is the abundance of a particular species of interest and DOY= day of year. I am using a Gamma distribution as the data are heavily skewed and on a continuous scale (numbers per litre lake water).

The problem I am having is that these two models produce dramatically different fits, see the image plots below. In this case the result of the gam model (Daph_gam4, labelled gam in the plot) bears a much greater resemblance to the original data. Could anyone help me to understand why these two model fits are so very different, when they are fitting the same smoothers?

Any help much appreciated!

Steve





Dr Stephen  Thackeray
Lake Ecosystem Group
Centre for Ecology and Hydrology
Lancaster Environment Centre
Library Avenue
Bailrigg
Lancaster
LA1 4AP
sjtr@ceh.ac.uk<mailto:sjtr@ceh.ac.uk>



--
This message (and any attachments) is for the recipient ...{{dropped:9}}

