Skip to content
Prev 324964 / 398503 Next

gamm in mgcv random effect significance

On Fri, 2013-06-07 at 13:12 -0700, William Shadish wrote:
gamm4() can't yes and out of the box mgcv::gam can't either but
see ?magic for an example of correlated errors and how the fits can be
manipulated to take the AR(1) (or any structure really as far as I can
tell) into account.

You might like to look at mgcv::bam() which allows an known AR(1) term
but do check that it does what you think; with a random effect spline
I'm not at all certain that it will nest the AR(1) in the random effect
level.

<snip />
Shouldn't you specify how the AR(1) is nested in the hierarchy here,
i.e. AR(1) within xc? maybe I'm not following your data structure
correctly.
gamm() fits via the lme() function of package nlme. To do what you want,
you need the anova() method for objects of class "lme", e.g.

anova(g1$lme, g2$lme)

Then I think you should check if the fits were done via REML and also be
aware of the issue of testing wether a variance term is 0.
Again, I think you need anova() on the $lme components.

HTH

G