On Tue, Oct 26, 2010 at 12:27 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:> Hello,
> and sorry for asking a question without the data - hope it can still
> be answered:
> I've run two things on the same data:
> # Using lme:
> mix.lme <- lme(DV ~a+b+c+d+e+f+h+i, random = random = ~ e+f+h+i|
> group, data = mydata)
> # Using lmer
> mix.lmer <- lmer(DV
> ~a+b+c+d+(1|group)+(e|group)+(f|group)+(h|group)+(i|group), data >
mydata)
Those models aren't the same and the model for lmer doesn't make
sense. You would need to write the random effects terms as
(0+e|group), etc. because (e|group) is the same as (1 + e|group) so
you are including (Intercept) random effects for group in each of
those 5 terms.
To generate the same model as you fit with lme you would use
mix.lmer <- lmer(DV ~a+b+c+d+(e+f+g+h+ii|group), mydata)
I wouldn't recommend it though as this requires estimating 21
variance and covariance parameters for the random effects. Almost
certainly the estimated variance-covariance matrix will end up being
singular. Unless you are careful you may not notice this.
> lme provided an output (fixed effects and random effects coefficients).
lme is not as picky about singularity of the variance-covariance
matrix as lmer is.
> lmer gave me an error: Error in mer_finalize(ans) : Downdated X'X is
> not positive definite, 10.
> I've rerun lmer with - but specifying the random effects for 2 fewer
> predictors. This time it ran and provided an output. (BTW, the random
> effects of lmer with 2 fewer predictors specified as random were very
> close to the output of lme).
Yes, lmer could converge in such as case but the parameter estimates
are not meaningful because of the ambiguity described above.
> Question:
> Looks like lmer could not invert the matrix, right?
Well, lmer never tries to invert matrices but it does factor them and
that is where the problem is recognized. However, I think that
singularity is a symptom of the problem, not the cause.
> But how come lme
> (which I thought was an earlier version of lmer) COULD invert it?
The computational methods in the two packages are quite different. I
think that the methods in lme4 are superior because we have learned a
bit in the last 10 years.
> Greatly appreciate a clarification!
>
>
> --
> Dimitri Liakhovitski
> Ninah Consulting
> www.ninah.com
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>