[R] data order affects glmmPQL

Jack Tanner ihok at hotmail.com
Wed Jan 4 23:25:04 CET 2006

Is it to be expected that the way a data frame is sorted should affect the 
model fit by glmmPQL?



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 <- 
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"))

foo <- data.frame(id, score, test, coder) # Define data frame
print(summary(fit.model(foo, poisson)))

bar <- foo[order(id, score, test, coder),] # Reorder data frame
print(summary(fit.model(bar, poisson)))

The two summaries are clearly different. Is this to be expected? Is there a 
canonical way one should order a data frame before passing it to glmmPQL?

More information about the R-help mailing list