[R-sig-ME] random effect with only one level
bbolker at gmail.com
Wed Dec 12 03:58:05 CET 2012
laurent stephane <laurent_step at ...> writes:
> The lmer() function seems to work well for a mixed model having a random
effect with only one level: it
> doesn't crash and there's not even a warning. I'm not a specialist about the
numerical mathematics behind
> lmer(), but isn't it possible to see somewhere in the output there's a problem
such as a convergence
> problem for instance ? (in such a situation SAS 9.2 returns a "note" about a
problem with some Hessian matrix).
I tried out a trivial example. I agree that it's a bit odd that
this doesn't break down anywhere, but the results are mostly sensible --
or at least not dangerous. The random-effects variance reported
is meaningless, but the coefficients and residual variances are
correct (they match the results of lm()), and the BLUP/conditional
mode of the single random-effects level is essentially zero.
Does that agree with your results?
So it might be nice to have a warning, but it doesn't strike
me as really dangerous.
d <- data.frame(x=runif(200),f="A")
d <- within(d, y <- rnorm(nrow(d),mean=2*x+3))
m2 <- lmer(y~x+(1|f),data=d)
m3 <- lm(y~x,data=d)
all.equal(fixef(m2),coef(m3)) ## TRUE
all.equal(attr(VarCorr(m2),"sc"),summary(m3)$sigma) ## TRUE
ranef(m2) ## 2e-12
More information about the R-sig-mixed-models