Written and maintained by CASRAI Editorial Board
Last updated
A standardized residual is a residual divided by an estimate of its own standard deviation, so that it can be read on a common scale and compared against the same cutoffs whatever the original units. The phrase covers two different calculations: one for cells of a contingency table (the post-hoc follow-up to a chi-square test) and one for observations in a regression model. This page separates them, works one table through by hand, and shows how to get each in Excel, R and Python.
What are standardized residuals?
A residual is the observed value minus the value the model expects. Residuals in raw units are hard to judge, because a gap of 5 means something different when the expected count is 10 than when it is 1,000. Dividing by a standard error puts every residual on a scale where roughly ±2 is unusual and roughly ±3 is very unusual. NIST defines the underlying quantity as the observed response minus the fitted value, and notes that residuals which behave randomly suggest the model fits the data well.
Which divisor you use depends on the model:
- Contingency table (chi-square): the Pearson residual divides by √expected; the standardized (adjusted) residual divides by the cell’s own standard deviation and so is approximately standard normal when the null hypothesis holds.
- Regression: the standardized (internally studentized) residual divides each residual by the overall error estimate times √(1 − hii); the externally studentized residual uses a leave-one-out error estimate.
Standardized residual formula
Chi-square cells: Pearson and adjusted
For the cell in row i and column j of a table with grand total n:
Expected count: Eij = (Ri × Cj) / n
Pearson residual: (Oij − Eij) / √Eij
Standardized (adjusted) residual: (Oij − Eij) / √[Eij × (1 − Ri/n) × (1 − Cj/n)]
Here O is the observed count, E the expected count under independence, Ri the row total, Cj the column total and n the grand total. R’s chisq.test documentation describes the Pearson residuals as (observed − expected)/√expected and the standardized residuals as (observed − expected)/√V, where V is the residual cell variance; the adjusted formula above is that cell-variance form for a table with fixed margins.
Regression: standardized and studentized
For observation i with ordinary residual ei, residual standard error s, and leverage hii:
Standardized (internally studentized): ri = ei / (s × √(1 − hii))
Externally studentized: ti = ei / (s(i) × √(1 − hii)), where s(i) is the error estimate with observation i left out.
R’s influence.measures documentation states that rstandard and rstudent give the standardized and Studentized residuals, re-normalizing the residuals to unit variance using an overall and a leave-one-out measure of the error variance respectively.
Worked example: a 2 × 3 table, step by step
Illustrative data, invented for this example. Suppose 110 participants are randomly assigned to one of two programs and their outcome is recorded as improved, no change or worse.
| Program | Improved | No change | Worse | Row total |
|---|---|---|---|---|
| A | 30 | 15 | 5 | 50 |
| B | 20 | 25 | 15 | 60 |
| Column total | 50 | 40 | 20 | 110 |
Step 1, expected counts. E(A, improved) = 50 × 50 / 110 = 22.727. E(A, no change) = 50 × 40 / 110 = 18.182. E(A, worse) = 50 × 20 / 110 = 9.091. For program B: 60 × 50 / 110 = 27.273, 60 × 40 / 110 = 21.818, 60 × 20 / 110 = 10.909.
Step 2, Pearson residual for A, improved. (30 − 22.727) / √22.727 = 7.273 / 4.767 = 1.526.
Step 3, adjusted residual for A, improved. The correction factor is (1 − 50/110) × (1 − 50/110) = 0.5455 × 0.5455 = 0.2975. The denominator is √(22.727 × 0.2975) = √6.762 = 2.600, so the adjusted residual is 7.273 / 2.600 = 2.797.
The same steps for every cell give:
| Cell | Observed | Expected | Pearson residual | Standardized residual |
|---|---|---|---|---|
| A, improved | 30 | 22.727 | 1.526 | 2.797 |
| A, no change | 15 | 18.182 | −0.746 | −1.267 |
| A, worse | 5 | 9.091 | −1.357 | −2.031 |
| B, improved | 20 | 27.273 | −1.393 | −2.797 |
| B, no change | 25 | 21.818 | 0.681 | 1.267 |
| B, worse | 15 | 10.909 | 1.239 | 2.031 |
Check. The squared Pearson residuals sum to the chi-square statistic: 2.327 + 0.557 + 1.841 + 1.939 + 0.464 + 1.534 = 8.662, matching χ² = 8.66 with (2 − 1)(3 − 1) = 2 degrees of freedom and p = .013.
Why the two columns differ. Because the row and column totals are fixed by the data, the Pearson residuals are not on a unit-variance scale: here they run smaller than the standardized ones (1.526 versus 2.797). Using ±2 on Pearson residuals would miss the A-improved and B-improved cells, which the standardized residuals flag. In a 2 × 2 table the two rows of standardized residuals always have identical magnitude and opposite sign, and that magnitude equals √χ²; the 2 × 3 table above shows the same mirrored pattern between rows A and B.
How to interpret standardized residuals
Under the null hypothesis of independence, standardized residuals are approximately standard normal, which is why the conventional cutoffs are the familiar z values. Treat them as conventions rather than strict tests, and see the multiple-cell caution below.
| Absolute value | Reading |
|---|---|
| Below about 2 | Cell is consistent with independence; the observed count is close to what the margins predict |
| About 2 to 3 | Cell contributes noticeably to the overall association; the sign says whether the count is higher (+) or lower (−) than expected |
| Above about 3 | Strong departure from expected; in a table with many cells this is the safer threshold |
In the worked example, program A has more improvement than expected (+2.80) and program B has less (−2.80); both “worse” cells sit just past 2, in the direction of A having fewer and B having more. For regression, the same ±2 and ±3 cutoffs are used to flag observations for a closer look; the residual plot guide shows what a flagged point looks like in context, and Cook’s distance adds leverage to the picture.
Standardized vs studentized vs Pearson residuals
| Name | Used for | Divisor |
|---|---|---|
| Pearson residual | Contingency-table cells | √expected count |
| Standardized (adjusted) residual | Contingency-table cells | Cell standard deviation given the margins |
| Standardized residual (internally studentized) | Regression observations | s × √(1 − hii), s from all observations |
| Studentized residual (externally studentized) | Regression observations | s(i) × √(1 − hii), observation i left out |
Software uses these names inconsistently, so check the documentation of the command you ran. NIST describes studentized residuals as converted to a scale approximately representing the standard deviation of an individual residual from the center of the residual distribution, giving values that follow a Student’s t distribution.
Assumptions and common mistakes
- Expected counts too small. The normal approximation behind the ±2 rule relies on adequate expected counts; with very small expected counts, do not interpret the residuals as z scores. The chi-square guide covers the usual expected-count rule.
- Running residuals without a significant overall test. Inspect cell residuals after the omnibus chi-square test indicates an association, not instead of it.
- Many cells, one cutoff. A table with dozens of cells will produce a few residuals beyond ±2 by chance alone, so use a stricter cutoff such as ±3, or a correction (see Bonferroni correction and multiple comparisons).
- Confusing Pearson with standardized residuals. Pearson residuals are not unit variance, so applying ±2 to them gives a different, usually more conservative, answer.
- Reading a residual as an effect size. Residuals depend on sample size. For strength of association use an effect size such as Cramér’s V.
How to report standardized residuals (APA)
Report the omnibus test first, then name the cells that departed from independence and give their residuals. An example based on the worked table:
A chi-square test of independence showed an association between program and outcome, χ²(2, N = 110) = 8.66, p = .013. Follow-up standardized residuals indicated that participants in Program A improved more often than expected (z = 2.80) and those in Program B less often (z = −2.80); other cells were within or near ±2.
Format p values following the rules in How to Report P Values, and say in the methods which residual you used (adjusted or Pearson) and the cutoff you applied.
How to calculate standardized residuals in Excel, R or Python
Excel
Put the counts in B2:D3, row totals in E2:E3, column totals in B4:D4 and the grand total in E4. In B7 enter the adjusted residual and fill across and down:
=(B2-$E2*B$4/$E$4)/SQRT($E2*B$4/$E$4*(1-$E2/$E$4)*(1-B$4/$E$4))
R
tab <- matrix(c(30,15,5, 20,25,15), nrow = 2, byrow = TRUE)
res <- chisq.test(tab)
res$residuals # Pearson residuals
res$stdres # standardized (adjusted) residuals
fit <- lm(y ~ x, data = df)
rstandard(fit) # standardized (internally studentized)
rstudent(fit) # externally studentized
Python
import numpy as np
O = np.array([[30, 15, 5], [20, 25, 15]], dtype=float)
n = O.sum()
R = O.sum(axis=1, keepdims=True)
C = O.sum(axis=0, keepdims=True)
E = R @ C / n
pearson = (O - E) / np.sqrt(E)
adjusted = (O - E) / np.sqrt(E * (1 - R / n) * (1 - C / n))
print(adjusted.round(3))
# regression: statsmodels
# infl = sm.OLS(y, X).fit().get_influence()
# infl.resid_studentized_internal # standardized
# infl.resid_studentized_external # externally studentized
The Python and Excel results for the example table reproduce the adjusted column in the worked example (2.797, −1.267, −2.031 in the first row).
Frequently asked questions
What is a standardized residual?
A residual divided by an estimate of its standard deviation, so values can be compared with z cutoffs such as ±2 and ±3 regardless of the original units.
What is a good standardized residual value?
There is no single good value. Values within about ±2 indicate a cell or observation that fits the model; beyond about ±3 it is a strong departure worth examining.
What does a standardized residual greater than 2 mean?
In a contingency table it means the cell count is higher than independence predicts (a negative value means lower). In regression it flags an observation the model fits poorly.
What is the difference between standardized and studentized residuals?
Standardized residuals use one error estimate from all observations; externally studentized residuals re-estimate the error with the observation removed, which makes outliers easier to detect.
What is the difference between Pearson and standardized residuals in chi-square?
Pearson residuals divide by √expected and their squares sum to the chi-square statistic; standardized residuals also account for the row and column totals and are approximately standard normal.
Sources
- R Core Team.
chisq.test, R documentation (stats package): https://stat.ethz.ch/R-manual/R-devel/library/stats/html/chisq.test.html (checked 2026-10-29). - R Core Team.
influence.measures, R documentation (stats package): https://stat.ethz.ch/R-manual/R-devel/library/stats/html/influence.measures.html (checked 2026-10-29). - NIST/SEMATECH e-Handbook of Statistical Methods, section 4.4.4 on residuals: https://itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm (checked 2026-10-29).
- NIST/SEMATECH e-Handbook of Statistical Methods, section 5.2.4 on studentized residuals: https://itl.nist.gov/div898/handbook/pri/section2/pri24.htm (checked 2026-10-29).








