[R-sig-ME] Numerical integration for cross-classified random effects in lme4

Douglas Bates bates at stat.wisc.edu
Mon Oct 25 20:49:16 CEST 2010

On Sun, Oct 24, 2010 at 6:46 PM, Jeremy Koster <helixed2 at yahoo.com> wrote:
> Hi folks,
> This has likely been asked before, so please feel free to link any relevant posts . . .
> I am looking at a network of 300+ households.  The outcome variable is dichotomous -- i.e., does Household A share food with Household B?  Because food can flow both ways, one row in the dataset is for Household A to Household B, and then there's another row for B to A.  So I'd like to add a random effect for the dyad (DyadID).  In addition, some households just generally give more, and others generally receive more, so I'd like to add random effects for donating households (GNO) and receiving households (RNO).
> My impression was that it's possible to fit cross-classified random effects using numerical integration in lme4.  However, when I try to fit an empty model using this code:
> model.empty <- glmer (Sharing ~ 1 + (1|DyadID) + (1|GNO) + (1|RNO),family = binomial, nAGQ=10)
> Then I get the following error message:
> Error in validObject(.Object) :
>   invalid class "mer" object: AGQ method requires a single grouping factor

As the message indicates, adaptive Gauss-Hermite quadrature is only
available for models with random effects defined with respect to a
single grouping factor.

When there is only one grouping factor the observations can be split
according to the levels of the grouping factor and the integral
defining the likelihood of the parameters can be expressed as the
product of a number of low-dimensional integrals.  You need low
dimensional, preferably one-dimensional, integrals before you can hope
to apply AGQ.  For high-dimensional integrals that number of
evaluations of the conditional mean that would be required for a
single evaluation of the likelihood of the parameters would be

The Laplace approximation, which does require optimization of the
unscaled conditional density, but only requires evaluation of the
conditional mean at that point, is feasible for models with crossed
random effects.

More information about the R-sig-mixed-models mailing list