On Fri, Dec 5, 2008 at 3:44 PM, B. Meijering <[EMAIL PROTECTED]> wrote: > Using lmer() on my data results in an error. The problem, I think, is my > model specification. However, lm() works ok. > I recreated this error with a more simple dataset. (See code below.)
> # word and letter recognition data > # two within factors: > # word length: 4, 5, 6 letters > # letter position: 1-4 (in 4-letter words), 1-5 (in 5-letter words), 1-6 (in > 6-letter words) > # one dependent variable: > # reaction time > # first fit a linear model with letter position nested in word length > lm(rt ~ length + length:pos, data=df) > # fit a mixed effects model, with subj (participant) as random effect > lmer(rt ~ length + length:pos + (1 | subj), data=df) > Using lmer() results in an error: Error in mer_finalize(ans) : Downdated X'X > is not positive definite, 13. I don't experience any problems using lm(). > Does anyone know where things go wrong? That, admittedly obscure, error message relates to the fixed-effects specification rt ~ length + length:pos being rank deficient. If you look at the summary of the linear model fit you will see that there are 3 coefficients that are not determined because of singularities. The lm function detects the singularities and fits a lower-rank model. The lmer function is not as sophisticated. It just detects the singularities and quits. The length and the position are confounded. > xtabs(~ len + pos, df) pos len 1 2 3 4 5 6 4 2 2 2 2 0 0 5 2 2 2 2 2 0 6 2 2 2 2 2 2 (By the way, I changed the name of the length variable to len as typing "length" makes me expect the function called length.) Even when you remove this confounding by creating the len:pos interaction separately as a factor, you will still get singularities because there is only one len:pos combination for len = 6. You will need to think of a way of parameterizing the fixed effects without the singularities. You can check for singularities in the summary of the lm fit. ______________________________________________ R-help@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.