[R] lmer and glmmPQL

Douglas Bates dmbates at gmail.com
Wed Dec 7 15:27:36 CET 2005


On 12/5/05, Cox, Stephen <stephen.cox at ttu.edu> wrote:
> I have been looking into both of these approaches to conducting a GLMM,
> and want to make sure I understand model specification in each.  In
> particular - after looking at Bates' Rnews article and searching through
> the help archives, I am unclear on the specification of nested factors
> in lmer.  Do the following statements specify the same mode within each
> approach?
>
> m1 = glmmPQL(RICH ~ ZONE, family = poisson, data, random = ~ YEAR | SITE
> / QUADRAT)
> m2 = lmer(RICH ~ ZONE +(YEAR|SITE)+ (YEAR|QUADRAT), family = poisson,
> data)

If you want to ensure that QUADRAT is nested within SITE then use the
interaction operator explicitly

m2 <- lmer(RICH ~ ZONE +(YEAR|SITE)+ (YEAR|SITE:QUADRAT), family =
poisson, data)

For the grouping factors nested versus non-nested depends on the
coding.  If QUADRAT has a distinct level for each SITE:QUADRAT
combination then the nesting will automatically be detected.  However,
if the nesting is implicit (that is, if levels of QUADRAT are repeated
at different SITES) then it is necessary to use the interaction
operator.  There is no harm in using the interaction operator when the
nesting is explicit.
>
> As a follow up - what would be the most appropriate model formula (using
> glmmPQL syntax) to specify both a nested facor and repeated
> observations?  Specifically, I am dealing with experimental data with
> three factors.  ZONE is a fixed effect.  Three sites (SITE) are nested
> within each ZONE.  Multiple quadrats within each SITE are measured
> across multiple years.  I want to represent the nesting of SITE within
> ZONE and allow for repeated observations within each QUADRAT over time
> (the YEAR | QUADRAT random effect).  -- I am assuming that glmmPQL is
> the best option at this point because of recent discussion on Rhelp
> about issues associated with the Matrix package used in lmer (i.e., the
> anova results do not seem to match parameter tests).
>

I believe the anova problems only occur with a binomial response. 
They are caused by my failure to use the prior.weights appropriately. 
For a Poisson model this should not be a problem.

> Any information would be very much appreciated!
>
> Regards
>
> Stephen
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list