[R] lme4, error in mer_finalize(ans)

B. Meijering B.Meijering at student.rug.nl
Fri Dec 5 22:44:35 CET 2008


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

# make artificial data
length <- c(rep(4,4), rep(5,5), rep(6,6)) # independent 
variable "word length"
length <- factor(c(rep(length, 2)))
pos <- c(1:4, 1:5, 1:6) # independent variable "letter 
position"
pos <- factor(c(rep(pos, 2)))
rt <- c(rnorm(15, 200, sd=10), rnorm(15, 300, sd=15)) # 
dependent variable "reaction time"
df <- data.frame(subj=factor(c(rep(1:2, each=15))), 
length=length, pos=pos, rt=rt)

# to use lmer from lme4 package
library(lme4)

# 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?

~ Ben Meijering



More information about the R-help mailing list