此示例来自Faraway' Extending the Linear Model with R。
data(esoph)
modl <- glm(cbind(ncases,ncontrols) ~ agegp + alcgp + tobgp, family=binomial, data=esoph)
summary(modl)
Call:
glm(formula = cbind(ncases, ncontrols) ~ agegp + alcgp + tobgp,
family = binomial, data = esoph)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.6891 -0.5618 -0.2168 0.2314 2.0642
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.77997 0.19796 -8.992 < 2e-16 ***
agegp.L 3.00534 0.65215 4.608 4.06e-06 ***
agegp.Q -1.33787 0.59111 -2.263 0.02362 *
agegp.C 0.15307 0.44854 0.341 0.73291
agegp^4 0.06410 0.30881 0.208 0.83556
agegp^5 -0.19363 0.19537 -0.991 0.32164
alcgp.L 1.49185 0.19935 7.484 7.23e-14 ***
alcgp.Q -0.22663 0.17952 -1.262 0.20680
alcgp.C 0.25463 0.15906 1.601 0.10942
tobgp.L 0.59448 0.19422 3.061 0.00221 **
tobgp.Q 0.06537 0.18811 0.347 0.72823
tobgp.C 0.15679 0.18658 0.840 0.40071
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 227.241 on 87 degrees of freedom
Residual deviance: 53.973 on 76 degrees of freedom
AIC: 225.45
Number of Fisher Scoring iterations: 6
> modl$dev
[1] 227.2406
> modl$null
[1] 227.2406
> modl$df.residual
[1] 76
> modl$df.null
[1] 87
?glm
说
&#34; deviance:最大为常数,减去最大对数似然的两倍。在合理的情况下,选择常数使得饱和模型的偏差为零。&#34;
我认为model$dev
与Residual deviance
的值相同。 53.973,在这种情况下。我不明白为什么这个例子的modl$dev
= modl$null
。有人能告诉我我做错了吗?