[R-sig-ME] Extracting means and SE from lme & lmer with random terms
bbolker at gmail.com
Fri Jul 27 16:40:16 CEST 2012
Julie Kern <juliekern27 at ...> writes:
> Dear R gurus,
> I’ve done a lot of reading around this topic but can’t seem to find a
> solution that is working.
> I am running linear mixed models with lme & a few glmms with lmer
> (binomial response term). I would like to extract (not predict) the
> means & their SE of the fixed effects from the model but am having
> difficulties. For example, having run the model
> data=mydata, family=binomial, REML=FALSE)
> I would get a value for the mean proportion of males and females that
> vocalised during bouts as well as the standard error of the
Can you give us a (small!) reproducible example?
Do you get the desired results (in terms of which values are
computed) if you use glm() instead of lmer() and drop the random
A couple of notes:
* REML is silently ignored when fitting GLMMs (there is a bit
of commentary on this in http://glmm.wikidot.com/faq ; the development
version of lme4 produces a warning).
* the CRAN version of lme4 silently passes control to glmer() when
'family' is specified, but it is probably better to call glmer() explicitly
when doing GLMMs (the development version requires that you call glmer()
> I have tried using allEffects in the effects package but am only
> managing to get means. Is this because I have random terms in my model
> as well as fixed? If so how would you recommend I proceed?
> I have tried using attr(ranef(mymodel, postVar = TRUE)[],
> "postVar")as recommended on http://glmm.wikidot.com/faq but this
> produces a list of 40 or so numbers so I’ve clearly misunderstood
the incantation you reproduce here is for getting the variances
of the random effect 'estimates' (conditional modes), not for getting
the standard errors of the fixed-effect parameters.
More information about the R-sig-mixed-models