Skip to content

Creation of a dummy variable with Lme4

1 message · Ben Bolker

#
On 14-02-28 12:07 PM, Camille Le Gall-Payne wrote:
[cc'ing to r-sig-mixed-models]
I hadn't seen this particular trick before, but I can see what you're
doing -- hopefully the dummy grouping variable you're creating here ends
up with an estimated variance of zero (otherwise I would worry about
whether your results are sensible or not).  You can use

 control=glmerControl(check.nlev.gtr.1="ignore")

in your glmer() call to override the error you would otherwise get.

  It's also worth considering that in lme4 > 1.0, the likelihood values
that are computed are commensurate with those returned by glm().  I
don't know offhand whether anova(m1,m0) (where m1 is a glmer fit/merMod
object and m0 is a glm fit/object) works, but there's no reason in
principle why it shouldn't.

   In principle you could also do this by extracting the deviance
function (dd <- update(m1,devFunOnly=TRUE)) and optimizing over the
fixed-effects parameters while holding the random-effects parameters at
0 (i.e. computing the profiled likelihood for zero random effects), but
this is really just a highly inefficient way to fit the same model that
you would get by leaving out the REs and using glm().

  Ben Bolker