[R] lme() and nlme() give inconsistent numbers of degrees of freedom (PR#2384)
Jerome Asselin
jerome at hivnet.ubc.ca
Tue Apr 1 21:22:55 CEST 2003
I apologize for cross-posting.
In the reproducable example below, I fit the same model with lme() and
nlme(). However, I get 12 degrees of freedom with lme() and 2 df with
nlme().
library(nlme)
set.seed(14)
a <- 2
x <- rep(rnorm(3),rep(5,3))
id <- rep(c("a","b","c"),rep(5,3))
y <- a+x+rnorm(15)
data <- data.frame(y=y,id=id)
initx <- matrix(x[c(1,6,11)],dimnames=list(c("a","b","c"),"x"))
summary(fit.lme <-
lme(y ~ 1,data=data,random=~1|id,method="ML"))
summary(fit.nlme <-
nlme(y ~ a + x, fixed= a~1, random=x~1|id,
data=data, start=list(fixed=c(a=2),
random=list(id=initx)),method="ML"))
When I try the same thing with set.seed(18), I get 12 df for both.
I have submitted a bug report on that issue on Dec 20th and I have tried
to find the source of the problem, but no success. You can check what I
found so far at:
http://r-bugs.biostat.ku.dk/cgi-bin/R/Add-ons?id=2384
Can anyone help find the source of this problem?
Sincerely,
Jerome Asselin
R 1.6.2 on Red Hat Linux 7.2
Package: nlme 3.1-38
More information about the R-help
mailing list