# [R] Degrees of freedom in glmmPQL

From: Mark Steer <Mark.Steer_at_bristol.ac.uk>
Date: Wed 21 Sep 2005 - 01:47:40 EST

I apologise in advance if this is a daft question, but I've been battling GLMMs for a while in R 2.1.1 and keep getting bizarre degrees of freedom appearing.

For instance, using the example data attached and a simplified model from the one I need, I have: binary choice data, fixed factors = PositionIndex and Treatment and random factor = Name nested within treatment. I use the model:

glmmPQL(FreeChoice ~ PositionIndex + Treatment, random = ~1 + Treatment|Name, family = binomial, data = Exemplar)

The output I receive gives the expected df for the treatment variables (df = 47), but the PositionIndex df come out at 3953 when I think 7 should be closer to the mark. Have I got my model wrong? The full output is shown below, I'd be very grateful for any advice.

Many thanks, Mark

PS - is there a way to specify a single p-value for a factor e.g. PositionIndex as well as the two-way contrasts?

Linear mixed-effects model fit by maximum likelihood  Data: students

AIC BIC logLik
17254.33 17361.37 -8610.163

Random effects:
Formula: ~1 + Treatment | Name
Structure: General positive-definite, Log-Cholesky parametrization

StdDev Corr
(Intercept) 0.08118364 (Intr) Trtmnt

```Treatmentvl 0.89891387 -0.059
Treatmentvs 0.54219504 -0.438  0.006
Residual    0.98920592

```

Variance function:
Structure: fixed weights
Formula: ~invwt
Fixed effects: FreeChoice ~ PositionIndex + Treatment

```                    Value Std.Error   DF   t-value p-value

(Intercept)     0.2329314 0.1231124 3953  1.892022  0.0586

PositionIndexb -0.0758549 0.1385700 3953 -0.547412  0.5841
PositionIndexc -0.2560203 0.1372310 3953 -1.865616  0.0622
PositionIndexd -0.2770403 0.1646272 3953 -1.682835  0.0925
PositionIndexe -0.1087767 0.1573432 3953 -0.691334  0.4894
PositionIndexf -0.2561706 0.1368936 3953 -1.871312  0.0614
PositionIndexg -0.5037723 0.1390067 3953 -3.624086  0.0003
PositionIndexh -0.7039981 0.1595509 3953 -4.412373  0.0000
Treatmentvl     0.0800244 0.2552349   47  0.313533  0.7553
```
Treatmentvs -0.2539611 0.1443501 47 -1.759341 0.0850  Correlation:

(Intr) PstnIndxb PstnIndxc PstnIndxd PostnIndx PstnIndxf PstnIndxg PstnIndxh Trtmntvl
PositionIndexb -0.765

PositionIndexc -0.768 0.673

PositionIndexd -0.642 0.562 0.567

PositionIndexe -0.667 0.589 0.591 0.494

PositionIndexf -0.773 0.676 0.682 0.569 0.595

PositionIndexg -0.767 0.667 0.672 0.561 0.587 0.675

PositionIndexh -0.655 0.578 0.585 0.486 0.509 0.586 0.578

```Treatmentvl    -0.105  0.012     0.008     0.010     0.001     0.009
0.010     0.001
Treatmentvs    -0.189  0.018     0.013     0.009     0.013     0.020
0.029     0.006     0.082

Standardized Within-Group Residuals:
Min         Q1        Med         Q3        Max
```
-2.3171394 -0.9911849 -0.3750489 1.0130225 3.2386547

Number of Observations: 4010
Number of Groups: 50

Mark Steer
School of Biological Sciences
University of Bristol