Chi-square test
For count data: do the observed counts fit the expected ratios, and are two traits related?
Question: Do the observed counts fit the ratios the theory expects?
Example: Mendel’s pea experiment: counts of round-yellow, round-green, wrinkled-yellow and wrinkled-green seeds. Inheritance theory predicts a 9:3:3:1 ratio. Do the data fit?
| Class | Observed (O) | Expected ratio | Expected (E) | Delete |
|---|---|---|---|---|
| 312.75 | ||||
| 104.25 | ||||
| 104.25 | ||||
| 34.75 |
The red area is the rejection region (α = 0.05). The green line is the value calculated from your data.
H₀ not rejected: the difference is not significant
The gap between observed and expected counts can be explained by chance; the data fit the ratios.
p-value = 0.9254
How was it calculated?
= 0.47
Expected frequencies: the total count (556) is shared out according to the ratios.
In each class, square the gap between observed and expected, divide by expected and add up.
Degrees of freedom = number of classes − 1 = 3. The chi-square test is always right-tailed: only large deviations indicate a poor fit.
Compare the calculated value with the table (critical) value.
The calculated value is in the acceptance region: H₀ cannot be rejected. The p-value (0.9254) is not smaller than α = 0.05.