[R] Problem with lmer and wiki example

James Widman jwidman at mi.nmfs.gov
Thu Feb 12 18:58:01 CET 2009


I am trying to duplicate the example by Spencer Graves in the wiki, 
using lmer with the Nozzle data.
http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests
However the Chisq value and the fitAB values that are calculated are 
different compared to those in the example. I also get a warning message 
when I attempt the fitAB. Does anyone have any guidance as to why this 
might happen and how to correct it?
I am using R on Kubutu in case that may be helpful.
Thanks

---- my code --
[Previously saved workspace restored]
 > rm(list=ls(all=TRUE))
 > list=ls(all=TRUE)
 > print(list)
character(0)
 > y <- c(6,6,-15, 26,12,5, 11,4,4, 21,14,7, 25,18,25,
+ 13,6,13, 4,4,11, 17,10,17, -5,2,-5, 15,8,1,
+ 10,10,-11, -35,0,-14, 11,-10,-17, 12,-2,-16, -4,10,24)
 > Nozzle <- data.frame(Nozzle=rep(LETTERS[1:3], 
e=15),Operator=rep(letters[1:5], e=3), flowRate=y)
 > summary(Nozzle)
Nozzle Operator flowRate
A:15 a:9 Min. :-35.000
B:15 b:9 1st Qu.: 0.000
C:15 c:9 Median : 7.000
d:9 Mean : 5.511
e:9 3rd Qu.: 13.000
Max. : 26.000
 > library(lme4)
Loading required package: Matrix
Loading required package: lattice
 > fitAB <- lmer(flowRate~Nozzle+(Nozzle|Operator),data=Nozzle, method="ML")
Warning messages:
1: In .local(x, ..., value) :
Estimated variance-covariance for factor ‘Operator’ is singular

2: In .local(x, ..., value) :
nlminb returned message false convergence (8)

 > fitB <- lmer(flowRate~1+(1|Operator), data=Nozzle, method="ML")
 > anova(fitAB, fitB)
Data: Nozzle
Models:
fitB: flowRate ~ 1 + (1 | Operator)
fitAB: flowRate ~ Nozzle + (Nozzle | Operator)
Df AIC BIC logLik Chisq Chi Df Pr(>Chisq)
fitB 2 359.36 362.98 -177.68
fitAB 9 362.13 378.39 -172.06 11.237 7 0.1286
----------------------------------------------------------------------
Output from Spencer Graves example
fitAB 9 359.88 376.14 -170.94 13.479 7 0.06126




More information about the R-help mailing list