Skip to content
Prev 325192 / 398503 Next

gamm in mgcv random effect significance

I would be very nervous about relying on an anova call here. It will 
attempt a generalized likelihood ratio test, but gamm is using penalized 
quasi likelihood and there is really no likelihood here (even without 
the problem that if there was a likelihood the null hypothesis would 
still be on the edge of the feasible parameter space making the GLRT 
problematic). The best hope might be to model the random effect of xc 
using a term s(xc,bs="re") in the model formula (xc will need to be a 
factor for this), and then use summary on the gam part of the fitted 
model object to assess significance. If you do this you'll need to 
include the grouping factor explicitly in corAR1 (at present it's picked 
up from the random effect, so is nested in xc).
i.e
   g2 <- gamm(y ~ s(xc) +z+ int,family=binomial, weights=trial, random =
list(xc=~1),correlation=corAR1())
becomes something like...
   xf <- factor(xc)
   g2 <- gamm(y ~ s(xc) +z+ int + s(xf,bs="re"),family=binomial, 
weights=trial,
             correlation=corAR1(form=~1|xf))
   summary(g2$gam)

... I'm also a bit nervous about xc entering as an iid random effect and 
the argument of a smooth, however - does that model structure really 
make sense?

best,
Simon
On 11/06/13 18:08, William Shadish wrote: