[R-sig-ME] Deviance residuals don't sum up to deviance

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 22 13:58:52 CEST 2014


> Hello,
> I fitted a logistic regression model with glmer. In the resulting model,
> the reported deviance is not the same as the sum of the squares of the
> residual deviances. The deviance is 3909, the sum of square deviance
> residuals is 3747.

> These two should be equal, shouldn't they? The difference seems too large
> for a roundoff error, I think.

> My data are 150k observations and the fitted probabilities are generally
> very small (between 1e-7 and 1e-2, median 1e-4).

Can you at least show the exact R function calls that you did to
produce it?  Even better,
can you please use the 'gm1' from the first example in
help(glmer),

  (gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
                data = cbpp, family = binomial))

and now show how you compute these to sums with *reproducible* R
code.  That way we (the readers of R-SIG-ME) can be motivated
much more to help you.


> Thanks! Roelof Coster

You are welcome ;-)
Martin Maechler



More information about the R-sig-mixed-models mailing list