← All resources

WORKED EXAMPLE · CATEGORICAL ASSOCIATION

Chi-Square Worked Example: Program Group and Response Category

Build a 2×3 count table from participant-level categories, calculate expected counts and degrees of freedom, interpret the overall chi-square result, and reproduce it in BioTabular.

Published by BioTabularLast reviewed: November 4, 2026

This example uses synthetic data from 60 independent participants. Each participant belongs to either a Standard or Coached program and is classified once at follow-up as Improved, Unchanged, or Worsened relative to a prespecified baseline criterion. The question is whether program group and response category are associated in the population represented by these participants. This is an observational teaching scenario; it supplies no randomized assignment or adjustment for baseline differences.

Define the units, categories, and question

Observational unit
One independently sampled participant, appearing in one table cell.
Row variable
Program group: Standard or Coached.
Column variable
Follow-up response: Improved, Unchanged, or Worsened.
Null hypothesis
The response-category distribution is independent of program group.
Starting method
Pearson chi-square test of independence for the 2×3 table.

The response labels are mutually exclusive and exhaustive for the defined follow-up window. Although response is derived by comparison with each participant’s baseline status, the analysis file contains one final category per person. It is therefore a table of independent participant rows, not a paired before-and-after contingency analysis. If participants were matched, repeatedly observed, or clustered by site, this ordinary test would not account for that dependence.

Inspect the complete synthetic data

The downloadable CSV has one row per participant. The table below displays those same 60 rows, so the category counts can be checked directly. IDs are labels, not values used in the chi-square calculation.

ParticipantProgram groupResponse category
S01StandardImproved
S02StandardImproved
S03StandardImproved
S04StandardImproved
S05StandardImproved
S06StandardImproved
S07StandardUnchanged
S08StandardUnchanged
S09StandardUnchanged
S10StandardUnchanged
S11StandardUnchanged
S12StandardUnchanged
S13StandardUnchanged
S14StandardUnchanged
S15StandardUnchanged
S16StandardUnchanged
S17StandardUnchanged
S18StandardUnchanged
S19StandardWorsened
S20StandardWorsened
S21StandardWorsened
S22StandardWorsened
S23StandardWorsened
S24StandardWorsened
S25StandardWorsened
S26StandardWorsened
S27StandardWorsened
S28StandardWorsened
S29StandardWorsened
S30StandardWorsened
C01CoachedImproved
C02CoachedImproved
C03CoachedImproved
C04CoachedImproved
C05CoachedImproved
C06CoachedImproved
C07CoachedImproved
C08CoachedImproved
C09CoachedImproved
C10CoachedImproved
C11CoachedImproved
C12CoachedImproved
C13CoachedImproved
C14CoachedImproved
C15CoachedImproved
C16CoachedImproved
C17CoachedImproved
C18CoachedImproved
C19CoachedUnchanged
C20CoachedUnchanged
C21CoachedUnchanged
C22CoachedUnchanged
C23CoachedUnchanged
C24CoachedUnchanged
C25CoachedUnchanged
C26CoachedUnchanged
C27CoachedWorsened
C28CoachedWorsened
C29CoachedWorsened
C30CoachedWorsened

Build the observed count table

Program groupImprovedUnchangedWorsenedTotal
Standard6121230
Coached188430
Total24201660

Among Standard participants, 6/30 (20%) improved, 12/30 (40%) were unchanged, and 12/30 (40%) worsened. Among Coached participants, those within-group percentages are 18/30 (60%), 8/30 (26.7%), and 4/30 (13.3%). Percentages help describe the pattern, while the test uses the underlying counts.

Grouped bar chart of observed response counts: Standard has 6 improved, 12 unchanged, 12 worsened; Coached has 18 improved, 8 unchanged, 4 worsened.
Observed counts by response category, with 30 participants in each group. The figure makes the larger Improved count in Coached and larger Worsened count in Standard visible; the overall test summarizes the whole table.

Calculate expected counts under independence

If group and response were independent, the expected count for a cell would be its row total multiplied by its column total, divided by the overall total. For Standard–Improved, that is (30 × 24) ÷ 60 = 12. The other expected counts are calculated in the same way:

Program groupImprovedUnchangedWorsened
Standard12108
Coached12108

All six expected counts are at least 8; none is below 5. That supports use of the ordinary chi-square approximation here. These are hypothetical counts under the null model, not a second set of observed participants. Expected-count guidance is a diagnostic for the approximation, not a guarantee that the sampling or classification process is unbiased.

From cell discrepancies to the overall statistic

Each cell contributes (observed − expected)² ÷ expected. For Standard–Improved the contribution is (6 − 12)² ÷ 12 = 3. For Coached–Improved it is also 3. The Unchanged cells contribute 0.4 each, and the Worsened cells contribute 2 each. Summing the six contributions gives χ² = 3 + 0.4 + 2 + 3 + 0.4 + 2 = 10.8.

The degrees of freedom for an r×c independence table are (r − 1)(c − 1). With two groups and three response categories, (2 − 1)(3 − 1) = 2. The 2 represents independent ways the table can vary after the margins are fixed; it is not the number of outcomes, a sample size, or an effect size. BioTabular applies no continuity correction to this 2×3 table; its optional correction is specific to 2×2 tables.

Read the result

Complete participant rows
60; omitted 0
Table dimensions
2 groups × 3 response categories
Expected cells below 5
0 of 6
Pearson chi-square
χ²(2) = 10.8
Association p-value
0.004517
Descriptive effect size
Cramér’s V = 0.424

At α = .05, the table provides evidence against independence between program group and response category. The observed proportions show the direction of the pattern, but the omnibus p-value alone does not say that all three response categories differ independently. Cramér’s V is calculated here as √(10.8 ÷ [60 × min(2 − 1, 3 − 1)]) = 0.424. It summarizes association strength without a direction; BioTabular does not currently calculate this effect size in the Workspace output.

The test does not estimate an adjusted program effect, a risk ratio, or a causal contrast. If the question is a specific Improved-versus-not-Improved comparison, define that binary target in advance and estimate the relevant effect and uncertainty using a suitable method. Do not collapse categories after seeing this result solely to obtain a preferred p-value.

Reproduce the result in BioTabular

  1. Download the synthetic CSV and open the categorical-association calculator.
  2. Import the file. Mark Participant_ID as an identifier, and keep Program_Group and Response_Category categorical.
  3. Set the group order to Standard, then Coached, and the response order to Improved, Unchanged, then Worsened. Confirm the column types and category order.
  4. Select Program_Group as the first categorical variable and Response_Category as the second. Keep α = .05 and run the analysis.
  5. Confirm 60 complete cases, the observed 2×3 table, χ²(2) = 10.800, p = .005 after display rounding, and zero expected cells below 5. Use Plot Studio to view grouped counts or within-group percentages.

Interpret and report responsibly

“Among 60 independent participants (30 per program group), response-category distributions differed between Standard and Coached programs (Pearson χ²(2) = 10.80, p = .0045). Improved responses occurred in 6/30 (20%) Standard and 18/30 (60%) Coached participants; Worsened responses occurred in 12/30 (40%) and 4/30 (13.3%), respectively. All expected cell counts were at least 8. The descriptive Cramér’s V was .424.”

Report all observed counts and denominators alongside the test result. State how response categories were defined, how participants entered each program, and whether the comparison was planned. Any post-hoc cell or pairwise follow-ups need a stated method and consideration of multiple testing. The observational design leaves open baseline differences, selection, and other explanations for the association.

Common mistakes and limits

  • Testing percentages alone without the underlying participant counts.
  • Checking only observed counts while ignoring expected counts under independence.
  • Confusing the 2 degrees of freedom with the three response categories or with sample size.
  • Claiming every cell differs from its counterpart because the omnibus test is significant.
  • Using a 2×2 continuity correction for this 2×3 table.
  • Treating repeated visits, matched people, or clusters as independent observations.
  • Reading an association as evidence that the program caused a change.

The data are synthetic and balanced by design. Real response categories can be ambiguous, rare, missing, or measured at different times. A sparse larger table may need an exact or simulation-based method that BioTabular does not currently provide; a complex design may require a regression or clustered analysis. Specify categories and primary comparisons before seeing the results.

Related resources

Compare the adequate expected counts here with the Fisher’s exact sparse 2×2 worked example. Read Chi-square vs. Fisher’s Exact Test for the broader method choice, or Which Statistical Test Should I Use? for other designs.

References and further reading

BioTabular’s editorial approach and scope explain how these educational resources are prepared and what they do not replace.