Skip to content
Prev 9052 / 20628 Next

GLMM with mgcv::gam

Apologies for the late response. see in-line.
On Mon, 2012-08-27 at 12:25 +0200, Andreas B?ck wrote:
No. Only `gamm()` in the mgcv package would do what you suggest. The
"re" basis derives from the linear mixed effect representation of the
penalised regression model that underlies the mgcv version of a GAM.
IIRC essentially the penalties on the smooth functions can be
represented as random effects in a LME. Simon's new "re" basis is
essentially exploiting this feature, again IIRC, by setting up a spline
basis that would produce a simple random effect when viewed from the LME
formulation of the model. (I speculate that this means that the "re"
basis is solely represented as a random effect, the other basis
functions in mgcv would be split into both fixed and random effects in
the LME representation).
Nope, although it is related. The penalised regression underlying the
gam() can be fitted via ML or REML (amongst other methods). As the
penalties on the splines can be viewed as random effects, REML fitting
might be expected to get the best estimation of their variance. From
what I recall of Simon's papers, there is little to choose between ML
and REML fitting in terms of performance on simulated data exercises,
though REML may have the edge. This was not looked at in terms of "re"
basis smooths however, but in terms of more general s() smooths.
If your problem involves a simple random effect then I don't think there
will be any major differences between the various approaches (other than
gamm() using glmmPQL() which you might want to avoid). You won't be able
to use glmer() with the same s() functions used in your gam() can't be
included in the glmer() formula. gamm4 does allow the s() from gam() to
be included (or most of them) so your options are gam() with a "re"
basis or gamm4 (which iterates gam() and glmer() IIRC). Do
read ?smooth.construct.re.smooth.spec from package mgcv which describes
where you might choose gamm4 over the "re" basis terms (essentially for
big problems with large numbers of random effects, the "re" basis in
gam() won't be as efficient as gamm4 because it doesn't exploit the
sparseness of the random effect structure).

HTH

G