Tutorials › Introduction to Statistics › Reading Chi-Square Software Output

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

Reading Chi-Square Software Output

Learn to connect the numbers in a chi-square output table to the observed data, the test assumptions, and a careful conclusion.

Intermediate 10 min read

What You'll Learn

  • Identify the test statistic, degrees of freedom, and p-value in common output.
  • Check reported expected counts against the observed table and the test conditions.
  • Distinguish Pearson, continuity-corrected, and other test rows when software reports more than one.
  • Interpret cell residuals and contributions as diagnostics of how cells relate to the overall statistic.
  • Read phi or Cramer's V as measures of association strength, not as tests of significance.
  • Check whether a reported conclusion follows from the statistic, p-value, and chosen significance level.

Why Read the Output Rather Than Just Copy Its Conclusion?

A two-way chi-square procedure may produce a compact table with several numbers and several test rows. Those values are useful only when you know which test was run, what its reference distribution assumes, and how the results connect to the original counts. A small transcription or interpretation error can change the conclusion: the p-value belongs to a particular statistic and degrees of freedom, while residuals and effect sizes answer different questions.

This tutorial focuses on reading and checking the output for a test of independence or homogeneity. The same Pearson chi-square calculation is used for both settings; the study design determines whether the question concerns an association between variables or a comparison of category distributions across groups.

What the Main Output Fields Mean

Definition: For a two-way table with \(r\) rows and \(c\) columns, let \(O_{ij}\) be the observed count in row \(i\), column \(j\), and let \(E_{ij}\) be its expected count under the null hypothesis. The Pearson chi-square statistic is $$ \chi^2=\sum_{i=1}^{r}\sum_{j=1}^{c}\frac{(O_{ij}-E_{ij})^2}{E_{ij}}. $$ Under the null hypothesis and the conditions for the chi-square approximation, this statistic is compared with a chi-square distribution with \(df=(r-1)(c-1)\) degrees of freedom. The p-value is the right-tail probability \(P(\chi^2_{df}\geq \chi^2_{\text{observed}})\).

For a test of independence, the null hypothesis states that the two categorical variables are independent in the population; the alternative is that they are associated. For a test of homogeneity, the null states that the category distributions are the same across the populations or groups being compared; the alternative is that at least one distribution differs. Expected counts are calculated from the margins:

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

The output may show these expected counts in a separate table or beneath the observed counts. They are not additional observations. They describe the counts expected under the null model, given the row and column totals.

The degrees of freedom come from the table dimensions, not from the sample size. Once the row and column totals are fixed, the expected table is determined by those margins. Of the \(rc\) observed cells, only \((r-1)(c-1)\) cell counts can vary freely: the remaining cells are constrained by the margins. This gives the degrees-of-freedom formula. For example, a \(3\times2\) table has \( (3-1)(2-1)=2 \) degrees of freedom.

Before interpreting a p-value, check the design and the approximation conditions. Observations should be independent in the sense required by the sampling or assignment plan, and each observation should contribute to one cell of the table. The expected counts should be adequate for the chi-square approximation; a common guideline is that none is below 1 and at least 80% are at least 5. A software table cannot establish these conditions by itself. If expected counts are too sparse, the output may need an alternative method, as discussed in the earlier material on sparse expected counts.

Worked Examples: Reading Common Output

Worked Example: Matching a 2×2 Output Row to Its Table

Suppose a hypothetical survey records whether 60 independently sampled adults use a particular service and whether they belong to Group A or Group B. The observed counts are:

GroupUses serviceDoes not use serviceTotal
A201030
B121830
Total322860

Under the null hypothesis of independence, the expected count for Group A and service use is \(30(32)/60=16\). The four expected counts are 16, 14, 16, and 14. All exceed 5, and the hypothetical sampling plan treats the 60 adults as independent observations, so the usual approximation conditions are reasonable.

The Pearson statistic is $$ \chi^2=\frac{(20-16)^2}{16}+\frac{(10-14)^2}{14} +\frac{(12-16)^2}{16}+\frac{(18-14)^2}{14} =1+1.1429+1+1.1429=4.286. $$

Here \(df=(2-1)(2-1)=1\). The right-tail p-value is approximately 0.0384. Thus, at significance level \(\alpha=0.05\), the Pearson test gives evidence of an association between group and service use in the population represented by the sampling plan. It does not quantify how large the association is.

A software package might also show a continuity-corrected row for this \(2\times2\) table. Its statistic is about 3.281, with \(df=1\) and p-value about 0.070. That row is not the Pearson statistic just calculated: it uses a correction to the cell deviations. When output contains several rows, identify the requested or appropriate procedure and keep each statistic paired with its own p-value. Do not report a p-value from one row beside the statistic from another.

Worked Example: Checking Expected Counts and the Pearson Statistic

A hypothetical study compares response categories in three independent groups, with 30 people in each group. The observed counts are:

GroupResponse 1Response 2Total
1181230
2121830
3102030
Total405090

The expected count for Response 1 in each group is \(30(40)/90=13.333\), and the expected count for Response 2 is \(30(50)/90=16.667\). All six expected counts exceed 5. Given the stated independent-group design, the ordinary chi-square approximation is appropriate.

The cell contributions \((O-E)^2/E\) sum within each group as follows: $$ \begin{aligned} \text{Group 1: }& \frac{(18-13.333)^2}{13.333} +\frac{(12-16.667)^2}{16.667} \approx 1.633+1.307=2.940,\\ \text{Group 2: }& \frac{(12-13.333)^2}{13.333} +\frac{(18-16.667)^2}{16.667} \approx 0.133+0.107=0.240,\\ \text{Group 3: }& \frac{(10-13.333)^2}{13.333} +\frac{(20-16.667)^2}{16.667} \approx 0.833+0.667=1.500. \end{aligned} $$ Therefore, \(\chi^2\approx2.940+0.240+1.500=4.680\). The degrees of freedom are \((3-1)(2-1)=2\), giving a right-tail p-value of approximately \(P(\chi^2_2\geq4.680)=e^{-4.680/2}\approx0.0963\).

At the 5% significance level, this is insufficient evidence that the response distributions differ across the three groups. The conclusion depends on the chosen significance level; for example, 0.0963 is below 0.10 but above 0.05. The statistic and p-value should be checked together, rather than relying on an output label such as “Pearson Chi-Square” alone.

Residuals and Cell-Level Diagnostics

A significant overall test says that the table departs from the null model more than would usually be expected under that model. It does not, by itself, identify which cells contribute most to the departure. Software may report residual diagnostics to help locate patterns. A Pearson residual is the signed, scaled difference between an observed and expected count:

$$ R_{ij}=\frac{O_{ij}-E_{ij}}{\sqrt{E_{ij}}}. $$

Positive residuals indicate more observations in a cell than expected under the null; negative residuals indicate fewer. Squaring a Pearson residual gives that cell’s contribution to the overall statistic: \(R_{ij}^2=(O_{ij}-E_{ij})^2/E_{ij}\). Some output instead reports adjusted standardized residuals, whose scaling also accounts for the row and column proportions. The term “standardized residual” is not used identically by every program, so check the software’s definition before applying a rule of thumb or comparing values.

Worked Example: Interpreting Residual and Effect-Size Diagnostics

Consider a hypothetical \(2\times3\) table with 100 independent observations. Its row totals are 50 and 50, and its column totals are 36, 34, and 30. The observed counts are 24, 16, 10 in the first row and 12, 18, 20 in the second. Expected counts are 18, 17, 15 in each row, so all expected counts are at least 15.

The Pearson statistic is $$ \chi^2= \frac{(24-18)^2}{18}+\frac{(16-17)^2}{17}+\frac{(10-15)^2}{15} +\frac{(12-18)^2}{18}+\frac{(18-17)^2}{17}+\frac{(20-15)^2}{15} \approx 2+0.0588+1.6667+2+0.0588+1.6667=7.451. $$ The degrees of freedom are \((2-1)(3-1)=2\), and the p-value is about \(e^{-7.451/2}=0.0241\).

For the first-row, first-column cell, the Pearson residual is \[ R=\frac{24-18}{\sqrt{18}}=1.414. \] Its contribution to the statistic is \(1.414^2\approx2.000\). The positive sign indicates that this cell has more observations than expected under independence. The first-row, third-column residual is \((10-15)/\sqrt{15}\approx-1.291\), indicating fewer observations than expected. These are descriptive diagnostics of the table’s pattern; a residual alone should not be treated as a separate significance test.

For a table larger than \(2\times2\), Cramer's V summarizes association strength: $$ V=\sqrt{\frac{\chi^2}{n\min(r-1,c-1)}} =\sqrt{\frac{7.451}{100\min(1,2)}} =\sqrt{0.07451}\approx0.2730. $$ Thus, the output’s effect-size value is about 0.273. It is a dimensionless summary of association strength, not a percentage, a p-value, or evidence that one variable causes the other. Its substantive meaning should be assessed in context rather than assigned a universal label.

A Practical Reading Sequence

A reliable reading of a software table follows a short sequence. First identify the test row and verify that the table and design match the intended question. Then check the expected counts and degrees of freedom. Only after those checks should you interpret the statistic and p-value. Finally, use residuals or an effect-size measure to describe features the overall test alone does not convey.

1
Identify the procedure.
Check whether the output labels the row as Pearson chi-square, continuity-corrected chi-square, a likelihood-ratio test, or another method. Do not treat these rows as interchangeable.
2
Check counts and conditions.
Compare observed and expected counts, verify table dimensions and degrees of freedom, and consider whether the sampling or assignment design supports independent observations.
3
Interpret the test result.
Pair the statistic with its own degrees of freedom and p-value. Compare the p-value with the prespecified \(\alpha\); do not interpret it as the probability that the null hypothesis is true.
4
Describe the pattern and magnitude.
Use residuals to see which cells are above or below their null expectations, and use phi or Cramer's V when appropriate to summarize association strength.

Common Mistakes and Why Output Reading Matters

A frequent error is to copy a statistic from one row and a p-value from another. This creates a result that no software procedure produced. Another is to call a large cell residual “significant” without accounting for the fact that many cells may be inspected; cell-level follow-up requires appropriate care. Residual diagnostics describe departures from expected counts, while the overall test addresses the table as a whole.

It is also easy to confuse statistical evidence with practical importance. A small p-value is not a measure of association strength, and a moderate effect size does not by itself establish statistical significance. Report the test result and an appropriate effect-size measure separately, with a description of the observed pattern in context. An association in a two-way table does not, on its own, establish a causal effect.

Key takeaway: Read a chi-square output as a connected set of results: expected counts check the null model’s reference conditions, the statistic and degrees of freedom determine the p-value, residuals help locate cell-level departures, and an effect size describes association strength. Verify that every reported number belongs to the same procedure.

Check Your Understanding

Use the definitions and examples above to answer these questions.

  1. A \(4\times3\) table has \(n=180\). What degrees of freedom should the Pearson chi-square output report?
  2. What does a positive Pearson residual for a cell indicate about its observed count relative to its expected count?
  3. A software table reports a Pearson statistic with p-value 0.03 and a continuity-corrected statistic with p-value 0.08. Why should you not combine the first statistic with the second p-value?
  4. What does Cramer's V describe, and how is its purpose different from that of the p-value?
  5. Why should expected counts and the study design be checked even when the software prints a p-value?