[R] bug in either glmmPQL or lme/lmer
Jack Tanner
ihok at hotmail.com
Tue Jan 10 02:27:57 CET 2006
I know it's conventional to report bugs to the maintainer, but I'm not sure
which package actually contains this bug(s), so I apologize for sending this
to the list at large. I see the bug under both R 2.1.1, and R 2.2.1. (I sent
a related message a while ago, but this one has more detail.)
library(MASS)
library(nlme)
fit.model <- function(il, model.family) {
cs <- Initialize(corSymm(form=~1|id), data=il)
glmmPQL(score~test+coder, random=~1|id, family=model.family, data=il,
correlation=cs)
}
score <-
c(1,8,1,3,4,4,2,5,3,6,0,3,1,5,0,5,1,11,1,2,4,5,2,4,1,6,1,2,8,16,5,16,3,15,3,12,4,9,2,4,1,8,2,6,4,11,2,9,3,17,2,6)
id <- rep(1:13, rep(4, 13))
test <- gl(2, 1, length(score), labels=c("pre", "post"))
coder <- gl(2, 2, length(score), labels=c("two", "three"))
original <- data.frame(id, score, test, coder)
sorted.ok <- original[order(original$id, original$score, original$test,
original$coder),]
sorted2.ok <- original[order(original$id, original$test, original$score,
original$coder),]
sorted3.not.ok <- original[order(original$score, original$id, original$test,
original$coder),]
print(summary(fit.model(original, poisson)))
print(summary(fit.model(sorted.ok, poisson)))
print(summary(fit.model(sorted2.ok, poisson)))
print(summary(fit.model(sorted3.not.ok, poisson)))
That last line produces, under R version 2.1.1, 2005-06-20, i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
MASS nlme
"7.2-20" "3.1-65"
iteration 1
Error in logLik.reStruct(object, conLin) :
NA/NaN/Inf in foreign function call (arg 3)
That same last line produces, under R version 2.2.1, 2005-12-20,
i386-pc-mingw32
attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets"
[7] "base"
other attached packages:
MASS nlme
"7.2-24" "3.1-68.1"
iteration 1
Error in lme.formula(fixed = zz ~ test + coder, random = ~1 | id, data =
list( :
false convergence (8)
Moreover, summary(fit.model(original, poisson)) produces a different output
than either
summary(fit.model(sorted.ok, poisson)) or summary(fit.model(sorted2.ok,
poisson)), but the latter two do equal each other.
More information about the R-help
mailing list