From set-up to conclusion
In Topic 3.14 you chose the right chi-square test, wrote the hypotheses and checked the conditions. This topic finishes the test. You calculate the expected counts, the chi-square statistic and the p-value, then make a decision and write a conclusion.
Use the same four-part structure as every other significance test in the course:
- Hypotheses. State H₀ and Hₐ in context and give α.
- Homogeneity (two or more populations or treatments, one categorical variable): H₀: there is no difference in the distribution of the variable across the populations; Hₐ: there is a difference.
- Independence (one population, two categorical variables): H₀: there is no association between the two variables in the population; Hₐ: there is an association.
- Method and conditions. Name the test. Check randomization (independent random samples or a randomized experiment for homogeneity; one random sample for independence), the 10% condition when sampling without replacement (not needed for a randomized experiment) and the expected counts condition: every expected count is greater than 5.
- Calculations. Expected counts, χ², degrees of freedom and the p-value.
- Conclusion. Compare the p-value with α, state the decision and conclude in context.
The calculations are the same for both tests. Only the hypotheses, the randomization condition and the wording of the conclusion change.
Expected counts
A chi-square test compares what you observed with what you would expect if H₀ were true.
If H₀ is true, the distribution of the column variable is the same in every row. So each row should split in the same proportions as the whole table. That gives the formula:
expected count = (row total × column total) ÷ table total
Here is why it works. Suppose 160 of all 400 people in a study travel by bus, which is 40%. If the travel mode does not depend on the row, then about 40% of the 120 people in the first row should travel by bus: 0.40 × 120 = 48. That is exactly (120 × 160) ÷ 400 = 48.
Three useful facts:
- Expected counts need not be whole numbers. Keep them unrounded (or to at least 2 decimal places).
- The expected counts in each row and each column add up to the same totals as the observed counts. Use this as a check.
- You need the expected counts twice: to check the expected counts condition, and to calculate χ².
The chi-square statistic
The test statistic measures how far the observed counts are from the expected counts, relative to the expected counts:
χ² = Σ (observed count − expected count)² ÷ expected count
The sum is taken over every cell of the two-way table, not over the rows or the totals. Each term in the sum is called a component (or contribution) of χ².
- Squaring stops positive and negative differences from cancelling out, so χ² can never be negative.
- Dividing by the expected count puts the differences on a fair scale. A difference of 6 matters more when you expected 24 than when you expected 240.
- χ² = 0 only if every observed count equals its expected count. The larger χ² is, the further the data are from what H₀ predicts, and the stronger the evidence against H₀.
Degrees of freedom and the null distribution
When H₀ is true and the conditions are met, χ² follows (approximately) a chi-square distribution with
degrees of freedom (df) = (number of rows − 1)(number of columns − 1)
Count only the rows and columns of categories, not the total row or total column. A 3 × 3 table has df = 2 × 2 = 4; a 3 × 2 table has df = 2 × 1 = 2.
Why this number? Once the row and column totals are fixed, you can fill in (r − 1)(c − 1) cells freely. Every other cell is then forced by the totals.
Recall from Topic 3.14 that chi-square distributions take only positive values and are skewed to the right, and that the skew becomes less strong as df increases.
Finding the p-value
The p-value is the probability, assuming H₀ is true, of getting a χ² value as large as or larger than the one observed:
p-value = P(χ² ≥ observed χ²), using the chi-square distribution with the correct df.
It is always the right tail. A two-way table has no “direction” to test: any kind of difference from the expected counts makes χ² bigger.
- Technology gives the p-value directly (a chi-square cdf from your χ² value up to a very large number, or the χ²-Test function, which works from the observed counts).
- A chi-square table gives a range. Find the row for your df and see which two critical values your χ² falls between. For df = 4, the critical values are 9.488 (tail area 0.05) and 11.143 (tail area 0.025). A χ² of 10.07 lies between them, so 0.025 < p-value < 0.05.
Show your work either way: the expected counts (or at least one sample calculation), the χ² formula with values, df and the p-value. “Calculator gives p = 0.0393” on its own does not show a method.
Interpreting the p-value
An interpretation of the p-value must include the condition “assuming H₀ is true”, written in context. A good template:
Assuming [H₀ in context], there is a [p-value] probability of getting a χ² statistic of [observed value] or larger by chance in random sampling (or random assignment).
The p-value is not the probability that H₀ is true, and it is not the probability that the result “happened by chance”.
Decision and conclusion
The formal decision compares the p-value with the significance level α, which you set before looking at the data:
- p-value ≤ α: reject H₀. There is convincing statistical evidence for Hₐ.
- p-value > α: fail to reject H₀. There is not convincing statistical evidence for Hₐ.
Write the conclusion in context, in terms of Hₐ, with non-definitive language (“there is convincing evidence that…”, never “this proves…”). Name the population(s):
| Test | Conclusion when you reject H₀ |
|---|---|
| Homogeneity | There is convincing statistical evidence that the distribution of [variable] differs across [the populations or treatments]. |
| Independence | There is convincing statistical evidence of an association between [variable 1] and [variable 2] in [the population]. |
When you fail to reject, put “not” in front of “convincing”. Then use the result to answer the investigative question the study started with.
Worked example 1: a test for homogeneity that rejects H₀
Context (fictional). The transport department of the city of Corrandale wants to know: Do commuters in the city’s three districts differ in how they travel to work? It takes independent random samples of commuters from each district: 120 from North, 150 from Central and 130 from Southbank. Each district has more than 20,000 commuters. Each person gives their main way of travelling to work.
| Observed | Bus | Bicycle | Car | Total |
|---|---|---|---|---|
| North | 54 | 30 | 36 | 120 |
| Central | 62 | 28 | 60 | 150 |
| Southbank | 44 | 22 | 64 | 130 |
| Total | 160 | 80 | 160 | 400 |
Use α = 0.05.
1. Hypotheses.
- H₀: there is no difference in the distribution of main travel mode for commuters in North, Central and Southbank.
- Hₐ: there is a difference in the distribution of main travel mode for commuters in North, Central and Southbank.
- α = 0.05
2. Method and conditions. Chi-square test for homogeneity (three populations, one categorical variable).
- Randomization: independent random samples from the three districts.
- 10% condition: the largest sample is 150, and every district has more than 10 × 150 = 1,500 commuters.
- Expected counts: see the table below. The smallest is 24, so every expected count is greater than 5.
3. Calculations. Expected counts, using (row total × column total) ÷ 400:
| Expected | Bus | Bicycle | Car | Total |
|---|---|---|---|---|
| North | 120 × 160 ÷ 400 = 48 | 120 × 80 ÷ 400 = 24 | 48 | 120 |
| Central | 60 | 30 | 60 | 150 |
| Southbank | 52 | 26 | 52 | 130 |
| Total | 160 | 80 | 160 | 400 |
Check: each row and column of expected counts adds to the observed total.
Components, (O − E)² ÷ E:
| Component | Bus | Bicycle | Car |
|---|---|---|---|
| North | (54 − 48)² ÷ 48 = 0.7500 | (30 − 24)² ÷ 24 = 1.5000 | (36 − 48)² ÷ 48 = 3.0000 |
| Central | (62 − 60)² ÷ 60 = 0.0667 | (28 − 30)² ÷ 30 = 0.1333 | (60 − 60)² ÷ 60 = 0 |
| Southbank | (44 − 52)² ÷ 52 = 1.2308 | (22 − 26)² ÷ 26 = 0.6154 | (64 − 52)² ÷ 52 = 2.7692 |
- χ² = 0.7500 + 1.5000 + 3.0000 + 0.0667 + 0.1333 + 0 + 1.2308 + 0.6154 + 2.7692 ≈ 10.07
- df = (3 − 1)(3 − 1) = 4
- p-value = P(χ² ≥ 10.07) with df = 4 ≈ 0.0393 (technology). A table gives 0.025 < p-value < 0.05.
4. Conclusion. Because the p-value of 0.0393 is less than α = 0.05, we reject H₀. There is convincing statistical evidence that the distribution of main travel mode differs for commuters in North, Central and Southbank.
Interpretation of the p-value. Assuming the distribution of main travel mode is the same for commuters in all three districts, there is about a 0.0393 probability of getting a χ² statistic of 10.07 or larger by chance in random sampling.
Answer to the investigative question. Yes: the samples give convincing evidence that commuters in the three districts differ in how they travel to work.
Check. The decision depends on α. At α = 0.01 the same p-value (0.0393 > 0.01) would lead you to fail to reject H₀. This is why α must be chosen before you see the data.
Going further (background, beyond the required content). To see where the difference is, look at the largest components. The two biggest are North–Car (3.00: 36 observed, 48 expected) and Southbank–Car (2.77: 64 observed, 52 expected). In the samples, 30% of North commuters drove, compared with about 49% in Southbank. This describes the samples; it is not a second test.
Worked example 2: a test for independence that fails to reject H₀
Context (fictional). Ashby Lane Library has about 9,000 members. The librarian asks: Among the library’s members, is age group associated with whether they prefer print books or e-books? She selects a random sample of 240 members and records both variables for each.
| Observed | E-book | Total | |
|---|---|---|---|
| Under 30 | 50 | 34 | 84 |
| 30 to 59 | 56 | 40 | 96 |
| 60 and over | 44 | 16 | 60 |
| Total | 150 | 90 | 240 |
Use α = 0.05.
1. Hypotheses.
- H₀: there is no association between age group and preferred format among Ashby Lane Library members.
- Hₐ: there is an association between age group and preferred format among Ashby Lane Library members.
- α = 0.05
2. Method and conditions. Chi-square test for independence (one population, two categorical variables).
- Randomization: one random sample of members, classified by two variables.
- 10% condition: 240 is less than 10% of about 9,000 members (900).
- Expected counts: all are greater than 5 (the smallest is 22.5).
3. Calculations.
| Expected | E-book | |
|---|---|---|
| Under 30 | 84 × 150 ÷ 240 = 52.5 | 84 × 90 ÷ 240 = 31.5 |
| 30 to 59 | 60 | 36 |
| 60 and over | 37.5 | 22.5 |
Components: 0.1190, 0.1984 (under 30); 0.2667, 0.4444 (30 to 59); 1.1267, 1.8778 (60 and over).
- χ² ≈ 4.03
- df = (3 − 1)(2 − 1) = 2
- p-value = P(χ² ≥ 4.03) with df = 2 ≈ 0.1331 (technology). A table gives 0.10 < p-value < 0.15.
4. Conclusion. Because the p-value of 0.1331 is greater than α = 0.05, we fail to reject H₀. There is not convincing statistical evidence of an association between age group and preferred format among Ashby Lane Library members.
Interpretation of the p-value. Assuming there is no association between age group and preferred format among the library’s members, there is about a 0.1331 probability of getting a χ² statistic of 4.03 or larger by chance in random sampling.
Answer to the investigative question. The sample does not give convincing evidence that preferred format is associated with age group. In the sample, 73.3% of members aged 60 and over preferred print, compared with 59.5% and 58.3% in the other groups. But a difference this size happens fairly often (about 13% of the time) in random samples of 240 members even when there is no association.
Check. Failing to reject H₀ does not show that the variables are independent. A larger sample with the same percentages would give a larger χ² (see Practice Question 7).
Common misconceptions
- Using percentages or proportions in the χ² formula. χ² uses counts. If you are given percentages, convert them to counts first.
- Rounding expected counts to whole numbers. Expected counts are averages; keep their decimals.
- Including the totals as cells. Sum the components over the category cells only. The “Total” row and column are not cells of the table.
- df = rows × columns, or df = (number of cells) − 1. The degrees of freedom are (r − 1)(c − 1). A 4 × 3 table has df = 6, not 12 or 11.
- Using the left tail or doubling the p-value. The p-value for a chi-square test is always the area to the right of the observed χ².
- Checking “observed counts greater than 5”. The condition is about expected counts. An observed count of 3 is fine if its expected count is greater than 5.
- “The p-value is the probability that the variables are independent.” It is the probability of a χ² at least this large, assuming H₀ is true.
- “We accept H₀, so the variables are independent.” A large p-value is a lack of evidence, not proof of independence or of identical distributions.
- Mixing up the wording. A homogeneity conclusion talks about the distribution of one variable across several populations; an independence conclusion talks about an association between two variables in one population.
Where this leads
This completes Unit 3. The same four-part structure (hypotheses, method and conditions, calculations, conclusion) returns in Unit 4, where the data are quantitative and the parameter is a mean. Start with Topic 4.1, Sampling Distributions for Sample Means. To review the hypotheses and conditions for this test, go back to Topic 3.14. Try the practice questions now, then use the revision notes and the checklist to consolidate.
Quick questions
Do expected counts have to be whole numbers?
No. An expected count is an average over many imagined samples, so values such as 22.4 are normal. Do not round them to whole numbers before calculating χ².
Why is the p-value always a right-tail area, even though Hₐ just says 'there is a difference'?
χ² adds up squared distances, so it is never negative, and it gets larger the further the observed counts are from the expected counts in any direction. Only large values are evidence for Hₐ, so the p-value is the area at or above the observed χ².