[R] GLM output for deviance and loglikelihood
peter dalgaard
pdalgd at gmail.com
Fri Apr 22 00:12:40 CEST 2011
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))
Call:
glm(formula = outcome ~ g, family = binomial, data = d, weights = n)
Deviance Residuals:
1 2 3 4
-1.482 1.274 -2.255 2.116
Coefficients:
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: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list