[R-sig-ME] Error with predict.merMod and random slopes

Stefan Th. Gries stgries at gmail.com
Mon Nov 18 03:24:24 CET 2013


Just a quick follow-up on the thread of

- <https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q4/021275.html>
- <https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q4/021279.html>
- <https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q4/021284.html>

because I ran into the same problem with this:

library(lme4)
example <- read.table(text="
X3 Y3 SPEAKER3
0.00655882 0.004769464 1
0.06138487 0.156728480 1
0.11072831 0.324273036 1
0.16555435 0.550263367 1
0.20119128 0.694429613 1
0.25875863 0.900938019 1
0.30810207 1.049000649 1
0.38485854 1.259405441 1
0.45339109 1.407468071 1
0.50821714 1.497084927 1
0.25327603 -0.006919691 2
0.32454988 0.121661015 2
0.38759984 0.312583881 2
0.49451063 0.515195902 2
0.54933667 0.643776607 2
0.67269528 0.854181398 2
0.81250169 1.134721120 2
0.88103425 1.267198211 2
0.94682550 1.384089761 2
0.72478000 1.010037000 2
0.66995397 0.148935710 3
0.75493434 0.230759795 3
0.90296467 0.374926041 3
0.97697983 0.456750126 3
1.03180588 0.519092287 3
1.13323406 0.647672992 3
1.27578178 0.803528393 3
1.41284689 0.900938019 3
1.51153378 0.986658489 3
0.57949100 0.047629699 3", header=TRUE, sep="")

model.lmer.3c <- lmer(Y3~X3+(X3|SPEAKER3), data=example)
predict(model.lmer.3c, newdata=data.frame(SPEAKER3=3, X3=0.4),
REform=NA) # no problem
#         1
# 0.4808733
predict(model.lmer.3c, newdata=data.frame(SPEAKER3=3, X3=0.4),
REform=NULL) # problem
# Error: sum(nb) == q is not TRUE

HTH,
STG
--
Stefan Th. Gries
-----------------------------------------------
University of California, Santa Barbara
http://www.linguistics.ucsb.edu/faculty/stgries



More information about the R-sig-mixed-models mailing list