I have been trying to sharpen my GLMM knowledge by working through some problems in Foundations of Linear and Generalized Linear Models. I am stuck on problem 9.36 which gives some homicide data then states "fit a Poisson GLMM. Interpret estimates. Show that the deviance decreases by 116.6 compared with the Poisson GLM, and intercept"
This is what I did
library(lme4) homi <- read.table("http://www.stat.ufl.edu/~aa/glm/data/Homicides.dat", header = TRUE) fit1 <- glm(count~race, family=poisson(link = log),data=homi) fit2 <- glmer(count~1+(1|race), family=poisson(link = log),data=homi) summary(fit1) summary(fit2)
Call: glm(formula = count ~ race, family = poisson(link = log), data = homi) Deviance Residuals: Min 1Q Median 3Q Max -1.0218 -0.4295 -0.4295 -0.4295 6.1874 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -2.38321 0.09713 -24.54 <2e-16 *** race 1.73314 0.14657 11.82 <2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for poisson family taken to be 1) Null deviance: 962.80 on 1307 degrees of freedom Residual deviance: 844.71 on 1306 degrees of freedom AIC: 1122 Number of Fisher Scoring iterations: 6
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [glmerMod] Family: poisson ( log ) Formula: count ~ 1 + (1 | race) Data: homi AIC BIC logLik deviance df.resid 1132.5 1142.8 -564.2 1128.5 1306 Scaled residuals: Min 1Q Median 3Q Max -0.7174 -0.3054 -0.3054 -0.3054 19.3426 Random effects: Groups Name Variance Std.Dev. race (Intercept) 0.739 0.8596 Number of obs: 1308, groups: race, 2 Fixed effects: Estimate Std. Error z value Pr(>|z|) (Intercept) -1.5235 0.6122 -2.489 0.0128 *
It seems like the deviance for the GLMM is
1128.5 while the deviance for the GLM is
844.71. This is shows the GLM is fitting better than the GLMM which I think is the exact opposite solution from what question implied. I am not sure if I am looking at the correct output or if I setup the problem wrong.