Goodness of Fit for Logistic and Poisson
Does the model fit the data well? Do we need more/less variables in the model?
Goodness of fit
\(F\)-test to compare our model against an intercept-only model
a more general F-test to compare nested models
Most metrics used to evaluate LR measure how far \(y\) is from \(\hat{y}\) Can we do the same for other logistic and Poisson models?
Residuals
Deviance
Chi-square test
An estimated logistic model can be used to predict an outcome
An estimated Poisson model can be used to predict an outcome
Scroll down to see full content
The raw residuals are, as usual, the differences between the observed and the fitted values.
\[\begin{aligned} r_i &= \text{obs}_i - \text{fit}_i \\ &= y_i - \hat{p}_i \end{aligned}\]However, there are 2 problems with these residuals:
\[Var(Y_i) = p_i(1-p_i)\]
technically, we should write the conditional variance and probability
Thus, residuals of different observations are not comparable and should be adjusted!!
Scroll down to see full content
Many variations of the raw residuals have been proposed for Logistic regression (and GLMs in general) that take the variance of the observations into account.
\[r_i = \frac{y_i - \hat{p}_i}{\sqrt{\hat{p}_i(1-\hat{p}_i)}}\]
deviance residuals
standardized residuals: for both Pearson and deviance residual
We won’t get to the details of these but it is important to know which ones you are calculating.
The Poisson regression has the same problems as the Logistic Regression:
responses are discrete (at least more than 2 values now)
the variance is not constant
\[\text{resid}_{\text{raw}}= y_i - \hat{\lambda}_i, \quad\quad \text{resid}_{\text{pearson}}= \frac{y_i - \hat{\lambda}_i}{\sqrt{\hat{\lambda}_i}}\]
Scroll down to see full content
Beyond MLR, a quantity called the deviance is used to measure the difference between the log-likelihoods the estimated model and that of a perfect model, known as the saturated model, which fits the data perfectly.
Image from Notes for Predictive Modeling
The deviance generalizes the Residual Sum of Squares (RSS) of the linear model.
If the errors of a LR are normal, the deviance is proportional to the RSS.
The lower the deviance the better the fit!
Image from Notes for Predictive Modeling
The deviance can also be used to compare nested models (similar to the \(F\)-test in LR).
The test that compares deviances has a \(\chi^2\) distribution.
Don’t worry, R computes this test for you using anova()!!
© 2025 Gabriela Cohen Freue – Material Licensed under CC By-SA 4.0