Tutorials › Introduction to Statistics › Reading Residual Patterns Across a Table

Chi-Square Tests of Independence and Homogeneity · Tutorial 835 of 996

Reading Residual Patterns Across a Table

Learn how residual signs and sizes reveal which category combinations are more or less frequent than independence or homogeneity would predict.

Intermediate 9 min read

What You'll Learn

  • Interpret positive and negative cell residuals relative to expected counts.
  • Compare residual magnitudes while accounting for their scale.
  • Recognize patterns that span several cells or categories.
  • Connect cell contributions to the overall Pearson chi-square statistic.
  • Distinguish exploratory cell diagnosis from formal cell-by-cell inference.

Why Read the Cells After Testing the Table?

A chi-square test for independence or homogeneity summarizes departures across an entire two-way table. A small p-value indicates that the table as a whole differs from the pattern expected under the null hypothesis, but it does not say which combinations of categories contribute most to that difference. Cell residuals help describe the shape of the departure: which cells contain more observations than expected, which contain fewer, and how large those departures are relative to their scale.

This is a descriptive diagnostic step. Residuals can suggest a pattern worth explaining, but they do not by themselves establish that a particular cell is statistically significant. The cells share row and column totals, so their departures are related; treating each cell as an independent test would overstate the evidence.

Reading a Cell Residual

Definition: For cell \(i,j\), let \(O_{ij}\) be its observed count and \(E_{ij}\) its expected count under the null hypothesis. The Pearson residual is $$ r_{ij}=\frac{O_{ij}-E_{ij}}{\sqrt{E_{ij}}}. $$ A positive residual means the observed count is greater than expected; a negative residual means it is less than expected. Its magnitude describes the departure in units scaled by the square root of the expected count.

The expected count is based on the table margins:

$$ E_{ij}=\frac{(\text{row }i\text{ total})(\text{column }j\text{ total})}{\text{grand total}}. $$

Under the null hypothesis of independence, this is the count predicted by combining the row and column proportions. In a homogeneity study, the corresponding null prediction is that the category distribution is the same across groups. In either setting, a residual compares an observed cell with its null expectation.

A raw difference of 5 observations does not have the same scale in every cell. For example, a difference of 5 relative to an expected count of 10 is more pronounced than a difference of 5 relative to an expected count of 100. Dividing by \(\sqrt{E_{ij}}\) accounts partly for this scale difference. A larger absolute Pearson residual indicates a larger departure relative to that cell’s expected-count scale, not a larger causal effect.

Terminology varies across sources: “standardized residual” may refer to the Pearson residual, or to an adjusted version that also accounts for estimating row and column proportions. One common adjusted standardized residual is

$$ \frac{O_{ij}-E_{ij}}{\sqrt{E_{ij}(1-R_i/N)(1-C_j/N)}}, $$

where \(R_i\) and \(C_j\) are the row and column totals and \(N\) is the grand total. The denominator differs, so values from the two definitions are not interchangeable. Always check which residual a table or software output reports. The examples below use Pearson residuals.

Worked Example: Finding the Direction of a Departure

Suppose, hypothetically, that 80 randomly selected participants are classified by program group and preferred appointment time. The observed counts are shown below. Assume each participant contributes to exactly one cell, the observations are independent, and the expected counts are adequate for the Pearson chi-square approximation.

GroupMorningAfternoonEveningTotal
A20101040
B10201040
Total30302080

Under independence, the expected count for Group A and Morning is

$$ E_{11}=\frac{40(30)}{80}=15. $$

The Pearson residual in that cell is

$$ r_{11}=\frac{20-15}{\sqrt{15}}=\frac{5}{3.873}=1.291. $$

The positive sign means Group A has 5 more morning preferences than expected under independence. For Group A and Afternoon, the expected count is also \(40(30)/80=15\), so its residual is \((10-15)/\sqrt{15}=-1.291\): fewer afternoon preferences than expected. The evening count in Group A is exactly its expected count, \(40(20)/80=10\), giving residual 0. Group B has the opposite pattern in the first two columns. The signs describe the direction of the departures, not their cause.

How Cell Patterns Relate to the Overall Statistic

Each Pearson residual squared is exactly the contribution of its cell to the Pearson chi-square statistic:

$$ \frac{(O_{ij}-E_{ij})^2}{E_{ij}}=r_{ij}^2, \qquad X^2=\sum_i\sum_j r_{ij}^2. $$

This identity explains why cells with larger absolute residuals contribute more to the overall statistic. Squaring removes the sign, however. The statistic measures the total discrepancy, while the signed residuals are needed to explain whether counts are above or below expectation.

The table margins also constrain the pattern. Because expected counts and observed counts have the same row and column totals, the signed count departures balance within every row and column:

$$ \sum_j(O_{ij}-E_{ij})=0 \quad\text{for each row }i, \qquad \sum_i(O_{ij}-E_{ij})=0 \quad\text{for each column }j. $$

Thus a positive departure somewhere must be balanced by negative departures elsewhere in the same row and column. Residuals are not independent pieces of evidence. A pattern across several cells is often more informative descriptively than reading one cell in isolation.

Worked Example: A Visible Pattern With a Modest Overall Test

Return to the hypothetical table above. Its expected counts are 15, 15, and 10 in each row, so all expected counts are at least 5. The Pearson residuals are \(1.291,-1.291,0\) for Group A and \(-1.291,1.291,0\) for Group B. The repeated signs show a reciprocal pattern: morning is above expectation for A and below for B, while afternoon shows the reverse.

The overall statistic is found by summing the six squared residuals, or equivalently the cell contributions:

$$ X^2= \frac{25}{15}+\frac{25}{15}+0+ \frac{25}{15}+\frac{25}{15}+0 =4\left(\frac{25}{15}\right)=6.667. $$

There are \((2-1)(3-1)=2\) degrees of freedom. The upper-tail p-value is approximately \(P(\chi^2_2\ge 6.667)=0.0357\). At significance level \(0.05\), this is evidence against independence for the table as a whole. The pattern helps describe that evidence, but it does not make each of the four nonzero cells a separately established finding. Cell-by-cell inference requires appropriate attention to the fact that many cells may be examined.

Comparing Residual Patterns Carefully

Residual magnitude is useful for spotting which cells contribute most, but context matters. First, identify the residual definition and compare like with like. Second, consider the whole table: an isolated positive value may be paired with negative departures that balance its margins. Third, consider whether the apparent pattern is coherent across categories. A run of positive residuals in one row, or an orderly shift from positive to negative across ordered categories, may communicate the table’s structure better than a list of the largest values.

Large absolute residuals are sometimes treated as a quick flag for closer inspection, but a cutoff such as 2 is only a rough descriptive convention when many cells are inspected. It is not automatically a valid cell-level significance test. Under the null, standardized residuals may have an approximately normal distribution in suitable large-sample settings, but their dependence and the number of examined cells still matter. Do not turn an exploratory threshold into a formal conclusion.

Worked Example: A Strong, Ordered Pattern Across Categories

Imagine a hypothetical survey of 180 people, classified by one of three training levels and one of three satisfaction categories. The table has 60 people in each row and 60 in each column. Each expected count is therefore \(60(60)/180=20\). Suppose the observed counts are:

Training levelLow satisfactionModerate satisfactionHigh satisfactionTotal
Basic30201060
Intermediate20202060
Advanced10203060
Total606060180

For Basic training and Low satisfaction,

$$ r=\frac{30-20}{\sqrt{20}}=\frac{10}{4.472}=2.236. $$

For Basic and High satisfaction, the residual is \((10-20)/\sqrt{20}=-2.236\). The Intermediate row has three zero residuals. In the Advanced row the signs reverse: Low has \(-2.236\), Moderate has 0, and High has \(2.236\). Descriptively, the table shows opposite end-to-end patterns in the Basic and Advanced rows, with the Intermediate row matching expectation.

There are four nonzero cells, each contributing \(10^2/20=5\); the other five cells contribute zero. Hence

$$ X^2=4(5)=20.00, \qquad df=(3-1)(3-1)=4. $$

The upper-tail p-value is approximately 0.000499. Since all expected counts equal 20, the usual expected-count condition is met; with independent observations and one classification per person, the overall Pearson test provides strong evidence against independence. The residual pattern describes where the discrepancy lies, but this survey alone does not show that training level caused satisfaction to differ.

Why the Distinction Matters

An overall test and a residual display answer related but different questions. The test evaluates the global null hypothesis for the table. Residuals help explain the observed departure and can guide follow-up questions. A large overall statistic may arise from several moderate departures or a few concentrated ones. Conversely, a table can contain visually noticeable positive and negative residuals without enough total evidence to reject the global null.

Keep three statements distinct: “this cell is above its expected count” is a direct descriptive statement; “the table provides evidence against independence” is an overall inferential conclusion based on the test; and “this particular cell differs significantly” is a cell-level inferential claim that requires a suitable procedure accounting for multiple comparisons. The last claim does not follow automatically from the first two.

Common Mistake

Wrong reasoning: “This cell has a positive residual, so the categories are significantly associated in this cell.” A positive residual only states that the observed count exceeds its null expectation. It does not, on its own, quantify a cell-specific p-value or account for examining many cells.

Correction: State the descriptive direction and magnitude first, then report the overall test separately. For example: “The observed count in this cell was above its expected count; the omnibus chi-square test provides evidence of an association across the table.” Reserve cell-specific significance claims for an appropriate follow-up analysis.

Key takeaway: Read the sign to learn whether a cell is above or below expectation, and read the magnitude to gauge its scaled departure and contribution. Interpret those values as a pattern across the table, not as a collection of independent tests.

Check Your Understanding

Use the definitions and examples above to answer these questions.

  1. A cell has \(O_{ij}=18\) and \(E_{ij}=12\). What is the sign of its Pearson residual, and what does that sign mean?
  2. Why can a difference of 5 observations be more notable in a cell with expected count 10 than in one with expected count 100?
  3. Explain why the Pearson chi-square statistic does not retain the direction of cell departures.
  4. A table has several large residuals, but its overall test is not significant at the chosen level. Why should those residuals not be reported as individually significant findings?
  5. What is the difference between saying a cell is above expectation and concluding that the table provides evidence against independence?