[R] lme (or lmer) question
Douglas Bates
bates at stat.wisc.edu
Fri Oct 5 19:34:42 CEST 2007
On 10/5/07, Bert Gunter <gunter.berton at gene.com> wrote:
> Folks:
> In the following mixed effect model, the "x" and residual variance
> components are nonidentifiable. Yet lme() (or the equivalent in lmer())
> happily produces an answer in which the sum of the variance components is
> the correct estimate of the single variance parameter. Why? -- i.e. why
> doesn't lme complain?
> x <- 1:50
> y <- rnorm(50)
> m1 <- lme( y ~ 1, rand = ~1|x)
Because we hadn't anticipated that someone would try to do that when
we wrote lme? It's the situation of being unable to make the code
foolproof because the fools are so inventive. :-)
The lmer function (at least the development version) does throw an
error for that example although the error message is less than
transparent. Creating a kinder, gentler error message for this case
is on the ToDo list
> x <- 1:50
> y <- rnorm(50)
> lmer(y ~ 1 + (1|x))
Error: length(levels(dm$flist[[1]])) < length(Y) is not TRUE
The fact that you get a more-or-less arbitrary answer is related to
the way that the optimization of the log-likelihood (or the REML
criterion) is performed in lme.
More information about the R-help
mailing list