Re: [R] GLM output for deviance and loglikelihood

From: peter dalgaard <>
Date: Fri, 22 Apr 2011 00:12:40 +0200

On Apr 21, 2011, at 11:30 , Jeffrey Pollock wrote:

> So am I right in saying that Binary data isnt the only case where this is true? It would make sense to me that for a multinomial model you could have a unique factor for each data point and thus be able to create a likelihood of 1.

Yes. (I did say "pretty much"...). There are also some synthetic cases like when you enter a 2x2 table as 4 separate records:

> d <- data.frame(n=c(1,2,3,4),outcome=c(0,1,0,1),g=c(1,1,2,2))
> summary(glm(outcome~g,weights=n,binomial,data=d))

glm(formula = outcome ~ g, family = binomial, data = d, weights = n)

Deviance Residuals:

     1 2 3 4
-1.482 1.274 -2.255 2.116


            Estimate Std. Error z value Pr(>|z|)
(Intercept)   1.0986     2.5658   0.428    0.669
g            -0.4055     1.4434  -0.281    0.779

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 13.460 on 3 degrees of freedom Residual deviance: 13.380 on 2 degrees of freedom AIC: 17.380 Number of Fisher Scoring iterations: 3

(The results are fine as long as you don't actually use the "residual deviance" for anything!)

Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email:  Priv:

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 21 Apr 2011 - 22:15:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 22 Apr 2011 - 02:30:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive