Skip to content

compare GAMs with simple random effects

2 messages · Valerio Bartolino, Gavin Simpson

#
On Mon, 2011-10-10 at 23:53 +0200, Valerio Bartolino wrote:
I'll have a go as I haven't seen a response yet...
Yes, you should be able to compare the two models one with the re smooth
and one without. However, you'll have to be be very careful to ensure
you are really comparing like-with-like. gam() will be performing
smoothness selection for all terms in the model. There is no guarantee
that it will find the same smoothness to be optimal for the others terms
when the re smooth is and is not included in the model. If you just fit
the two models, you may well end up comparing the two models in terms of
the random effect term *and* different fixed effects, all at the same
time.

I guess you could fit the model with the re term, take the smoothness
complexity from each "fixed effect" term and tell gam() to use that and
not do smoothness selection (fx = TRUE IIRC), and fit the model without
the re smoother. That way the only difference between the two models is
the re smoother. You can use anova() on the two models, but do heed the
usual warnings about the interpretation of the p-value; you are testing
if the variance parameter for the random effect is equal to zero and as
you can't have negative variances, the test is on the boundary of the
allowed values and hence the p-value will be biased low.

You should also make sure you are fitting via method = "REML".
Yes, but you might wish to include it anyway, especially if it
represents something inherent to the experiment or population you are
studying. Just because it might not be needed in your sample of data
doesn't mean the effect in the population is not there.
I don't know how you can, however you could use gam.vcomp() on your
model to compute the SD of the variance components for each smooth term
in the model and their confidence intervals. This should allow you to
get a handle on the random effects terms that is more familiar to lme()
and lmer() like outputs.

But do read ?gam.vcomp and ?smooth.construct.re.smooth.spec for some of
the details.

HTH

G