Skip to content
Prev 257592 / 398506 Next

GLM output for deviance and loglikelihood

As you mentioned, the deviance does not always reduce to:

D = -2(loglikelihood(model))

It does for ungrouped data, such as for binary logistic regression. So
let's stick with the original definition.
In this case, we need the log-likelihood for the saturated model.

x = rnorm(10)

 y = rpois(10,lam=exp(1 + 2*x))

 test = glm(formula = y ~ x, family = poisson)


sm <- glm(y ~ factor(1:10),family=poisson)

mydev <- as.numeric(2*(logLik(sm)-logLik(test)))
mydev
deviance(test)


On Fri, Apr 15, 2011 at 7:00 AM, Jeffrey Pollock
<jpollock at williamhill.co.uk> wrote: