Tutorials › VEE Mathematical Statistics › Standardized Residuals in Chi-Square Contingency Tables

VEE Mathematical Statistics · Classical Tests and Goodness of Fit · Tutorial 692 of 880

Standardized Residuals in Chi-Square Contingency Tables

Use cell residuals to see which categories contribute to an association, while distinguishing useful follow-up evidence from conclusive cell-by-cell tests.

Intermediate 11 min read

What You'll Learn

  • Calculate expected counts and observed-minus-expected cell discrepancies in a contingency table
  • Distinguish Pearson residuals from adjusted standardized residuals
  • Interpret the sign and approximate size of an adjusted residual
  • Work through cell residuals after a significant chi-square test of independence
  • Recognize approximation, dependence, and multiple-comparison limits in cell-level follow-up

Why Examine Cell Residuals?

A significant chi-square test of independence gives evidence that two categorical variables are associated. It does not, by itself, identify which combinations of categories have more or fewer observations than expected under independence. Cell residuals help describe where the table’s observed counts depart from that model.

The natural first comparison is between a cell’s observed count and its expected count under independence. The size of that difference alone is not enough: a difference of five may be substantial when the expected count is small, but unremarkable when it is large. Residuals scale the difference to make the cell’s discrepancy easier to assess. They are a follow-up aid, not a replacement for the overall test or a guarantee that an individual cell is significant.

Definition: For a contingency table, let \(O_{ij}\) be the observed count in row \(i\), column \(j\); let \(n_{i+}\) and \(n_{+j}\) be its row and column totals; and let \(N\) be the grand total. Under independence, the expected count is \(E_{ij}=n_{i+}n_{+j}/N\). The cell discrepancy is \(O_{ij}-E_{ij}\). A positive discrepancy means more observations than expected; a negative discrepancy means fewer.

A residual analysis assumes counts from independent observational units classified into mutually exclusive row and column categories. The expected-count and sampling conditions for the chi-square approximation must be adequate. If observations are clustered, categories overlap, or expected counts are too small for the approximation being used, the usual residual reference values may not be reliable. The earlier material on expected counts and degrees of freedom covers the expected-count setup; here the focus is how to interpret departures cell by cell.

Two Residuals and What They Measure

The Pearson residual divides the observed-minus-expected difference by the square root of the expected count. Its square is exactly that cell’s contribution to Pearson’s chi-square statistic. Thus it links a particular cell to the overall statistic.

$$ r_{ij}=\frac{O_{ij}-E_{ij}}{\sqrt{E_{ij}}}, \qquad \chi^2=\sum_i\sum_j r_{ij}^{\,2}. $$

The Pearson residual is useful for describing the direction and size of a cell’s contribution. However, a common cell-level follow-up uses an adjusted standardized residual, which accounts for the fact that row and column proportions are estimated from the table. Write \(p_{i+}=n_{i+}/N\) and \(p_{+j}=n_{+j}/N\) for the observed row and column proportions. The adjusted residual is

$$ z_{ij}^{\mathrm{adj}} = \frac{O_{ij}-E_{ij}} {\sqrt{E_{ij}(1-p_{i+})(1-p_{+j})}}. $$

Under the null hypothesis of independence, with adequate sample size and expected counts, this adjusted residual is approximately standard normal for a single cell. A large positive value points to an observed count above its independence expectation; a large negative value points to a count below expectation. For a two-sided, unadjusted comparison at level \(0.05\), the familiar approximate reference is \(|z_{ij}^{\mathrm{adj}}|>1.96\). That threshold does not automatically account for examining many cells.

Important distinction: The adjusted residual’s denominator accounts for estimating the margins. It does not correct for making many cell comparisons. The adjusted residuals in a table are also dependent; they should not be treated as independent tests.

Why the Adjusted Denominator Appears

The adjustment reflects the variability of a cell discrepancy when the table’s margins are estimated. A short large-sample justification makes clear what it adjusts for. Under independence, suppose the row probabilities are \(\alpha_i\), the column probabilities are \(\beta_j\), and the cell probability is \(\alpha_i\beta_j\). The observed count in a cell varies, but the expected count used in the comparison also varies because it is calculated from the sample margins.

1
Start with the null model.
Under independence, the probability of cell \((i,j)\) is \(\alpha_i\beta_j\), so its expected count in \(N\) observations is approximately \(N\alpha_i\beta_j\).
2
Allow for estimated margins.
The comparison is not against a fixed count: the row and column proportions are estimated from those same observations. Accounting for this estimation reduces the large-sample variance of the discrepancy by the factors \(1-\alpha_i\) and \(1-\beta_j\).
3
Estimate the variance from the table.
Replace the unknown probabilities by their observed proportions. The resulting approximate variance is \(E_{ij}(1-p_{i+})(1-p_{+j})\), giving the adjusted residual when the discrepancy is divided by its estimated standard deviation.

This is a large-sample standardization, not a claim that every cell residual has an exact normal distribution. It explains why simply dividing by \(\sqrt{E_{ij}}\) and dividing by the adjusted standard deviation answer related but different questions. The Pearson residual measures a cell’s contribution to Pearson’s statistic; the adjusted residual is commonly used to assess the size of a cell discrepancy relative to its approximate variability after estimating the margins.

Worked Examples

Worked Example: Finding the Main Discrepancies in a Two-by-Two Table

A hypothetical service center classifies 100 service requests by request type (routine or urgent) and resolution (same day or later). The observed counts are 32 routine same-day, 18 routine later, 18 urgent same-day, and 32 urgent later. The row totals are 50 and 50; the column totals are 50 and 50. Calculate the expected counts, the Pearson and adjusted residuals, and the overall Pearson statistic. Use \(\alpha=0.05\) for the overall test.

Method and expected counts. Under independence, \(E_{ij}=n_{i+}n_{+j}/N\). Each expected count is \(50(50)/100=25\). The four discrepancies, in table order, are \(+7,-7,-7,+7\).

Pearson residuals and overall statistic. Each Pearson residual has magnitude \(7/\sqrt{25}=7/5=1.4\), with the sign of its discrepancy. Therefore each cell contributes \(1.4^2=1.96\), and

$$ \chi^2=4(1.96)=7.84. $$

There is one degree of freedom, \((2-1)(2-1)=1\). The \(0.05\) critical value is approximately \(3.841\), and \(7.84>3.841\), so the overall test rejects independence at this level.

Adjusted residuals. Every row and column proportion is \(0.5\), so the adjusted denominator for each cell is \(\sqrt{25(1-0.5)(1-0.5)}=\sqrt{6.25}=2.5\). The adjusted residuals, in table order, are \(7/2.5=+2.8\), \(-7/2.5=-2.8\), \(-7/2.5=-2.8\), and \(7/2.5=+2.8\). The pattern says that routine requests have more same-day resolutions and fewer later resolutions than expected under independence, with the reverse pattern for urgent requests.

Check and common mistake avoided. The four Pearson contributions add to \(7.84\), as they must. Do not interpret the four residuals as four independent discoveries: they reflect the same table association and are constrained by the margins. The cell values describe the pattern; they do not replace the overall test.

Worked Example: Comparing Residuals Across Rows of Different Sizes

A hypothetical clinic records appointment type (standard, extended, or follow-up) and whether a patient attends (attends or misses). The observed table is:

Appointment typeAttendsMissesRow total
Standard281240
Extended273360
Follow-up203050
Column total7575150

Calculate the expected counts and overall statistic, then interpret the adjusted residuals. Use \(\alpha=0.05\).

Expected counts. The column proportions are both \(75/150=0.5\). Consequently, each row’s expected counts are half its row total: \((20,20)\), \((30,30)\), and \((25,25)\). The observed-minus-expected discrepancies are \((+8,-8)\), \((-3,+3)\), and \((-5,+5)\).

Overall statistic. The standard row contributes \(8^2/20+(-8)^2/20=3.2+3.2=6.4\). The extended row contributes \(3^2/30+3^2/30=0.3+0.3=0.6\). The follow-up row contributes \(5^2/25+5^2/25=1+1=2\). Thus \(\chi^2=6.4+0.6+2=9.0\), with \((3-1)(2-1)=2\) degrees of freedom. Since \(9.0\) exceeds the \(0.05\) critical value \(5.991\), the overall test is significant.

Adjusted residuals. For the standard row, \(p_{i+}=40/150=4/15\). Each denominator is \(\sqrt{20(1-4/15)(1-0.5)}=\sqrt{22/3}\approx2.708\). The adjusted residuals are \(+8/2.708\approx+2.954\) and \(-8/2.708\approx-2.954\).

For the extended row, \(p_{i+}=60/150=0.4\), and each denominator is \(\sqrt{30(0.6)(0.5)}=\sqrt{9}=3\). The residuals are \(-3/3=-1.000\) and \(+3/3=+1.000\). For the follow-up row, \(p_{i+}=50/150=1/3\), and each denominator is \(\sqrt{25(2/3)(0.5)}=\sqrt{25/3}\approx2.887\). The residuals are \(-5/2.887\approx-1.732\) and \(+5/2.887\approx+1.732\).

Interpretation, check, and common mistake avoided. The largest adjusted residuals are in the standard-appointment row: more attendees and fewer missed appointments than expected under independence. The squared discrepancies divided by expected counts sum to \(9.0\), confirming the overall statistic. Comparing raw differences alone would obscure that rows have different sizes; comparing adjusted residuals is more informative, though any cell-level claims still need to account for multiple comparisons.

Worked Example: Reading a Three-by-Three Residual Pattern

A hypothetical benefits administrator classifies 200 inquiries by channel (online, phone, or in person) and outcome (resolved, referred, or pending). The observed table is:

ChannelResolvedReferredPendingRow total
Online224430
Phone24232370
In person343333100
Column total806060200

Find the expected counts, overall Pearson statistic, and adjusted residuals. Use \(\alpha=0.05\) for the overall test.

Expected counts. The column proportions are \(80/200=0.4\), \(60/200=0.3\), and \(60/200=0.3\). Multiplying each row total by those proportions gives expected rows \((12,9,9)\), \((28,21,21)\), and \((40,30,30)\).

Overall statistic. The online row contributes \(10^2/12+(-5)^2/9+(-5)^2/9=8.3333+2.7778+2.7778=13.8889\). The phone row contributes \((-4)^2/28+2^2/21+2^2/21=0.5714+0.1905+0.1905=0.9524\). The in-person row contributes \((-6)^2/40+3^2/30+3^2/30=0.9000+0.3000+0.3000=1.5000\). Therefore \(\chi^2\approx13.8889+0.9524+1.5000=16.3413\), with \((3-1)(3-1)=4\) degrees of freedom. This exceeds the \(0.05\) critical value \(9.488\), so the overall test is significant.

Adjusted residuals. The row proportions are \(0.15,0.35,0.50\), and the column proportions are \(0.4,0.3,0.3\). Applying the adjusted-residual formula gives the following values, rounded to three decimals:

ChannelResolvedReferredPending
Online\(10/\sqrt{12(0.85)(0.6)}=+4.042\)\(-5/\sqrt{9(0.85)(0.7)}=-2.161\)\(-5/\sqrt{9(0.85)(0.7)}=-2.161\)
Phone\(-4/\sqrt{28(0.65)(0.6)}=-1.211\)\(2/\sqrt{21(0.65)(0.7)}=+0.647\)\(2/\sqrt{21(0.65)(0.7)}=+0.647\)
In person\(-6/\sqrt{40(0.5)(0.6)}=-1.732\)\(3/\sqrt{30(0.5)(0.7)}=+0.926\)\(3/\sqrt{30(0.5)(0.7)}=+0.926\)

The largest discrepancy is for online inquiries resolved: substantially more were observed than expected under independence. Online inquiries referred or pending were fewer than expected. The table supports this descriptive pattern, but the unadjusted one-cell normal threshold is not an all-cells significance guarantee.

Check and common mistake avoided. Recomputing the Pearson contributions gives \(13.8889+0.9524+1.5000=16.3413\), consistent with the stated statistic. In particular, do not report a residual as though its denominator were always \(\sqrt{E_{ij}}\): that produces the Pearson residual, not the adjusted residual used here.

Limits of Cell-by-Cell Interpretation

A significant overall test answers a table-level question: the observed pattern is inconsistent with independence at the chosen test level, subject to the model and approximation assumptions. It does not establish that every large-looking cell residual is individually significant, nor does it identify a causal explanation for the association. Residuals describe departures from the fitted independence model; context is needed to explain them.

If many cells are inspected, the chance of at least one apparently unusual residual rises. For a family of \(m\) cell comparisons, one possible conservative approach is a Bonferroni adjustment: compare each two-sided cell result at level \(\alpha/m\), or use the corresponding normal critical value. Other multiple-comparison procedures may also be appropriate. The key is to decide how cell-level claims will be handled rather than interpreting every unadjusted \(|z_{ij}^{\mathrm{adj}}|>1.96\) as a separate discovery.

Exam trap: Do not confuse a significant overall chi-square test with proof that a particular cell differs significantly. Also do not confuse a Pearson residual with an adjusted residual: their denominators differ. State which residual you calculated, report its sign, and qualify cell-level interpretation when many cells are examined.

Check Your Understanding

For each problem, use the adjusted residual formula where requested and distinguish an overall association from a cell-level conclusion.

  1. A table cell has \(O_{ij}=42\), \(E_{ij}=36\), row proportion \(p_{i+}=0.2\), and column proportion \(p_{+j}=0.4\). Find its Pearson residual and adjusted residual, rounding the latter to three decimals. (Answer: Pearson residual \(=1.000\); adjusted residual \(\approx1.443\).)
  2. A two-by-two table has row totals 40 and 60, column totals 50 and 50, and observed rows \((28,12)\) and \((22,38)\). Find the expected counts, Pearson statistic, degrees of freedom, and adjusted residual for the first-row, first-column cell. (Answer: expected counts \(20,20,30,30\); \(\chi^2\approx10.667\), 1 degree of freedom; adjusted residual \(\approx+3.266\).)
  3. A two-by-three table has row totals 50 and 50, column totals 40, 30, and 30, and observed rows \((30,10,10)\) and \((10,20,20)\). Find the Pearson statistic and the adjusted residuals for the first row. (Answer: \(\chi^2\approx16.667\), 2 degrees of freedom; first-row adjusted residuals \(\approx+4.082,-2.182,-2.182\).)
  4. A researcher plans nine cell-level comparisons and wants a conservative Bonferroni familywise level of \(0.05\). What is the two-sided per-cell significance level, and what approximate standard-normal critical value should be used? (Answer: per-cell level \(0.05/9\approx0.00556\); critical value approximately \(2.77\).)
  5. An overall independence test is significant, and one cell has an adjusted residual of \(+2.1\). State what the sign means and why this alone does not establish a cell-level finding if many cells were examined. (Answer: the cell count is above its independence expectation; \(+2.1\) is only a nominal, approximate cell result and does not account for the multiple comparisons.)
Clinical Biostats