[R] glmmPQL and predict

Mike Harwood harwood262 at gmail.com
Mon Jan 9 20:57:02 CET 2012


Is the labeling/naming of levels in the documentation for the
predict.glmmPQL function "backwards"?  The documentation states "Level
values increase from outermost to innermost grouping, with level zero
corresponding to the population predictions".  Taking the sample in
the documentation:

fit <- glmmPQL(y ~ trt + I(week > 2), random = ~1 |  ID,
               family = binomial, data = bacteria)

> head(predict(fit, bacteria, level = 0, type="response"))
[1] 0.9680779 0.9680779 0.8587270 0.8587270 0.9344832 0.9344832
> head(predict(fit, bacteria, level = 1, type="response"))
      X01       X01       X01       X01       X02       X02
0.9828449 0.9828449 0.9198935 0.9198935 0.9050782 0.9050782
> head(predict(fit, bacteria, type="response")) ## population prediction
      X01       X01       X01       X01       X02       X02
0.9828449 0.9828449 0.9198935 0.9198935 0.9050782 0.9050782

The returned values for level=1 and level=<unspecified> match, which
is not what I expected based upon the documentation. Exponentiating
the intercept coefficients from the fitted regression, the level=0
values match when the random effect intercept is included

> 1/(1+exp(-3.412014)) ## only the fixed effect
[1] 0.9680779
> 1/(1+exp(-1*(3.412014+0.63614382))) ## fixed and random effect intercepts
[1] 0.9828449

Thanks!

Mike



More information about the R-help mailing list