In GLM analysis, is the null deviance of a model the same thing as the deviance of a null model?
1 Answer
Your claim "In R, why is the null deviance of a model mod <- glm(y ~ x1 + x2 + x3)
, is not the same as the deviance of a null model mod2 <- glm(y ~ 1)
" seems not true. See the example below:
counts <- c(18, 17, 15, 20, 10, 20, 25, 13, 12)
outcome <- gl(3, 1, 9)
treatment <- gl(3, 3)
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())
glm.Null <- glm(counts ~ 1, family = poisson())
# Return the null deviance of glm.D93
glm.D93$null.deviance # This is 10.58145
# Return the deviance of glm.Null
glm.Null$deviance # This equals to 10.58145 too
As you may already know, the deviance of a GLM model $M$ is defined as (up to a scaling constant) the difference in twice the log-likelihood between $M$ and the saturated model $S$ (cf. Categorical Data Analysis (2nd edition), pp. 139 - 140; Modern Applied Statistics with S (4th edition), pp. 186 - 187). The null deviance is the deviance when $M$ is taken to be the null model (i.e., the model with intercept only), which doesn't depend on the model specification. Therefore, by definition, the "null deviance of a (specific) model" and the "deviance of a null model" should be identical. If you found any counterexample, please elaborate by pasting out your code and outputs.
mod <- glm(y ~ x1 + x2 + x3)
, is not the same as the deviance of a null modelmod2 <- glm(y ~ 1)
? $\endgroup$