glmmPQL.Rd
Fit a GLMM model with multivariate normal random effects, using Penalized Quasi-Likelihood.
glmmPQL(fixed, random, family, data, correlation, weights,
control, niter = 10, verbose = TRUE, ...)
a two-sided linear formula giving fixed-effects part of the model.
a formula or list of formulae describing the random effects.
a GLM family.
an optional data frame, list or environment used as the first place to find
variables in the formulae, weights
and if present in
...
, subset
.
an optional correlation structure.
optional case weights as in glm
.
an optional argument to be passed to lme
.
maximum number of iterations.
logical: print out record of iterations?
Further arguments for lme
.
A object of class c("glmmPQL", "lme")
: see lmeObject
.
glmmPQL
works by repeated calls to lme
, so
namespace nlme will be loaded at first use. (Before 2015 it
used to attach nlme
but nowadays only loads the namespace.)
Unlike lme
, offset
terms are allowed in
fixed
– this is done by pre- and post-processing the calls to
lme
.
Note that the returned object inherits from class "lme"
and
that most generics will use the method for that class. As from
version 3.1-158, the fitted values have any offset included, as do
the results of calling predict
.
Schall, R. (1991) Estimation in generalized linear models with random effects. Biometrika 78, 719–727.
Breslow, N. E. and Clayton, D. G. (1993) Approximate inference in generalized linear mixed models. Journal of the American Statistical Association 88, 9–25.
Wolfinger, R. and O'Connell, M. (1993) Generalized linear mixed models: a pseudo-likelihood approach. Journal of Statistical Computation and Simulation 48, 233–243.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
summary(glmmPQL(y ~ trt + I(week > 2), random = ~ 1 | ID,
family = binomial, data = bacteria))
#> iteration 1
#> iteration 2
#> iteration 3
#> iteration 4
#> iteration 5
#> iteration 6
#> Linear mixed-effects model fit by maximum likelihood
#> Data: bacteria
#> AIC BIC logLik
#> NA NA NA
#>
#> Random effects:
#> Formula: ~1 | ID
#> (Intercept) Residual
#> StdDev: 1.410637 0.7800511
#>
#> Variance function:
#> Structure: fixed weights
#> Formula: ~invwt
#> Fixed effects: y ~ trt + I(week > 2)
#> Value Std.Error DF t-value p-value
#> (Intercept) 3.412014 0.5185033 169 6.580506 0.0000
#> trtdrug -1.247355 0.6440635 47 -1.936696 0.0588
#> trtdrug+ -0.754327 0.6453978 47 -1.168779 0.2484
#> I(week > 2)TRUE -1.607257 0.3583379 169 -4.485311 0.0000
#> Correlation:
#> (Intr) trtdrg trtdr+
#> trtdrug -0.598
#> trtdrug+ -0.571 0.460
#> I(week > 2)TRUE -0.537 0.047 -0.001
#>
#> Standardized Within-Group Residuals:
#> Min Q1 Med Q3 Max
#> -5.1985361 0.1572336 0.3513075 0.4949482 1.7448845
#>
#> Number of Observations: 220
#> Number of Groups: 50
## an example of an offset: the coefficient of 'week' changes by one.
summary(glmmPQL(y ~ trt + week, random = ~ 1 | ID,
family = binomial, data = bacteria))
#> iteration 1
#> iteration 2
#> iteration 3
#> iteration 4
#> iteration 5
#> iteration 6
#> Linear mixed-effects model fit by maximum likelihood
#> Data: bacteria
#> AIC BIC logLik
#> NA NA NA
#>
#> Random effects:
#> Formula: ~1 | ID
#> (Intercept) Residual
#> StdDev: 1.325243 0.7903088
#>
#> Variance function:
#> Structure: fixed weights
#> Formula: ~invwt
#> Fixed effects: y ~ trt + week
#> Value Std.Error DF t-value p-value
#> (Intercept) 3.0302276 0.4791396 169 6.324310 0.0000
#> trtdrug -1.2176812 0.6160113 47 -1.976719 0.0540
#> trtdrug+ -0.7886376 0.6193895 47 -1.273250 0.2092
#> week -0.1446463 0.0392343 169 -3.686730 0.0003
#> Correlation:
#> (Intr) trtdrg trtdr+
#> trtdrug -0.622
#> trtdrug+ -0.609 0.464
#> week -0.481 0.050 0.030
#>
#> Standardized Within-Group Residuals:
#> Min Q1 Med Q3 Max
#> -4.2868074 0.2039043 0.3140333 0.5440835 1.9754065
#>
#> Number of Observations: 220
#> Number of Groups: 50
summary(glmmPQL(y ~ trt + week + offset(week), random = ~ 1 | ID,
family = binomial, data = bacteria))
#> iteration 1
#> iteration 2
#> iteration 3
#> iteration 4
#> iteration 5
#> iteration 6
#> Linear mixed-effects model fit by maximum likelihood
#> Data: bacteria
#> AIC BIC logLik
#> NA NA NA
#>
#> Random effects:
#> Formula: ~1 | ID
#> (Intercept) Residual
#> StdDev: 1.325243 0.7903088
#>
#> Variance function:
#> Structure: fixed weights
#> Formula: ~invwt
#> Fixed effects: y ~ trt + week + offset(week)
#> Value Std.Error DF t-value p-value
#> (Intercept) 3.0302276 0.4791396 169 6.324310 0.0000
#> trtdrug -1.2176812 0.6160113 47 -1.976719 0.0540
#> trtdrug+ -0.7886376 0.6193895 47 -1.273250 0.2092
#> week -1.1446463 0.0392343 169 -29.174622 0.0000
#> Correlation:
#> (Intr) trtdrg trtdr+
#> trtdrug -0.622
#> trtdrug+ -0.609 0.464
#> week -0.481 0.050 0.030
#>
#> Standardized Within-Group Residuals:
#> Min Q1 Med Q3 Max
#> -4.2868074 0.2039043 0.3140333 0.5440835 1.9754065
#>
#> Number of Observations: 220
#> Number of Groups: 50