Pearson residuals in logistic regression: comparison between logit and glm
Marta Ponzano and
Rino Bellocco
Additional contact information
Marta Ponzano: Department of Life Sciences, Health and Health Professions, Link Campus University
Rino Bellocco: Department of Statistics and Quantitative Methods, University of Milano?Bicocca, Milan, Italy; 3Department of Medical Epidemiology and Biostatistics, Karolinska Institutet, Solna, Sweden.
Northern European Stata Conference 2026 from Stata Users Group
Abstract:
Logistic regression can be used to model the relationship between a set of covariates and a binary outcome. The predicted probabilities from the estimated model are inherently identical for observations sharing the same covariate pattern. In Stata, logistic regression can be performed using the logit command and the glm command. Both procedures calculate Pearson residuals, but the underlying computation differs substantially. In logit, Pearson residuals are calculated at the level of covariate patterns, and the Pearson chi-square goodness-of-fit test statistic is obtained by summing their squared values across covariate patterns. In contrast, in glm, Pearson residuals are computed at the individual level, and the Pearson deviance is defined as the sum of their squares over all observations. Unlike logit residuals, glm residuals can potentially vary among observations sharing the same covariate pattern, depending on the observed outcomes. Unlike logit residuals, glm residuals can potentially vary among observations sharing the same covariate pattern, depending on the observed outcomes. In general, except in the case of unique covariate patterns, Pearson residuals from logit and glm are not therefore the same. To illustrate these key differences, we present an example under three distinct scenarios: a single continuous covariate, a single categorical covariate, and a set of covariates of different types. Given the importance of post-modeling estimation, it is crucial to be aware of how Pearson residuals are calculated and to recognize that the Pearson goodness-of-fit test relies on residuals computed at the covariate pattern level. We hope this contribution supports the correct interpretation and practical use of Pearson residuals in Stata.
Date: 2026-10-01
References: Add references at CitEc
Citations:
There are no downloads for this item, see the EconPapers FAQ for hints about obtaining it.
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:boc:neur26:06
Access Statistics for this paper
More papers in Northern European Stata Conference 2026 from Stata Users Group Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().