The chi-square () test tells you whether the gap between observed counts and the counts a hypothesis predicts is small enough to be due to chance. You state a null hypothesis, calculate the expected counts, find , and compare it with the critical value for your degrees of freedom: if is larger, you reject the null hypothesis.
Quick check
What phenotype ratio do you expect from a cross of two heterozygotes, Aa × Aa?Show answerHide answer
3 dominant : 1 recessive.
A cross predicts 3:1. How many of 200 offspring should be recessive?Show answerHide answer
One quarter of 200, which is 50.
Know these already? Jump to the practice questions
What you'll be able to do
- State the null hypothesis for a set of count data.
- Calculate expected values from a predicted ratio.
- Calculate and the degrees of freedom.
- Decide whether to reject the null hypothesis and explain what that means.
Key terms
Null hypothesis
The hypothesis that there is no real difference between the observed and expected results, so any difference is due to chance.
- In plain English
- Nothing is going on except chance.
- Don't write
- "The null hypothesis is that the data are wrong."
Expected value
The count a hypothesis predicts for one category: the predicted proportion times the total count.
- In plain English
- What a perfect fit would look like.
- Don't write
- "The expected value is the ratio number, such as 3."
Degrees of freedom
The number of categories minus one.
- In plain English
- Once all but one count is known, the last is fixed by the total.
- Don't write
- "The number of individuals minus one."
Critical value
The value from the table, for your degrees of freedom and probability level, that your must exceed for you to reject the null hypothesis.
- In plain English
- The cut-off line.
- Don't write
- "Below the critical value, the hypothesis is proved."
What does the chi-square test decide?
Real counts rarely match a ratio exactly, because which gametes meet is random. The test asks whether the difference is small enough to be chance:
- State the null hypothesis: there is no significant difference between observed and expected counts.
- Measure the size of the difference as : the bigger the gaps between observed and expected, the bigger .
- Ask how likely a that large would be if the null hypothesis were true. The usual level is p = 0.05: if chance alone would give a value this large less than 5 per cent of the time, the difference is called significant.
A significant result means something besides chance is probably affecting the counts, such as linked genes.
Check yourself
Show answerHide answer
There is no significant difference between the observed counts and the counts expected from a 9:3:3:1 ratio; any difference is due to chance.
How do you calculate ?
On the AP® Biology formula sheet:
where o is the observed count and e the expected count for each category. Work in a table:
- Expected count = predicted fraction × total. For a 3:1 ratio with 400 offspring: and .
- For each category, find , square it, and divide by e.
- Add the results.
| Category | o | e | |
|---|---|---|---|
| Dominant | 312 | 300 | 0.48 |
| Recessive | 88 | 100 | 1.44 |
| Total | 400 | 400 |
Squaring stops positive and negative gaps cancelling; dividing by e scales each gap to its category's size.
Check yourself
Show answerHide answer
.
How do you decide whether to reject the null hypothesis?
- Degrees of freedom = number of categories − 1.
- Read the critical value for that df at p = 0.05 from the table (on the AP® Biology formula sheet).
- If is greater than the critical value, reject the null hypothesis: the difference is significant. If not, fail to reject it: the difference can be explained by chance.
| Degrees of freedom | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Critical value, p = 0.05 | 3.84 | 5.99 | 7.81 | 9.49 | 11.07 |
| Critical value, p = 0.01 | 6.63 | 9.21 | 11.34 | 13.28 | 15.09 |
For the table in the previous section: 2 categories, so df = 1; , so you fail to reject the null hypothesis, and the data are consistent with a 3:1 ratio.
Examiner's eye
Marks go to the full statement: the null hypothesis, df, the critical value, the comparison, the decision, and what it means biologically.
Check yourself
Show answerHide answer
Yes. df = 3, the critical value is 7.81, and 8.2 is greater, so the difference is significant.
Worked example 1: Mendel's dihybrid data
Question: In his 1866 paper, Gregor Mendel reported that self-pollinated pea plants heterozygous for seed shape and seed color (RrYy) produced 315 round yellow, 108 round green, 101 wrinkled yellow and 32 wrinkled green seeds. Test whether these counts fit a 9:3:3:1 ratio at p = 0.05. Calculate to two decimal places.
What tells you the method
Counts in categories and a predicted ratio: a chi-square test.
Step 1: State the null hypothesis.
There is no significant difference between the observed counts and a 9:3:3:1 ratio.
WhyThe test starts from "any difference is chance".
Step 2: Find the expected counts.
Total ; expected of 556 .
WhyExpected count = predicted fraction × total.
Step 3: Calculate .
Seeds o e Round yellow 315 312.75 0.016 Round green 108 104.25 0.135 Wrinkled yellow 101 104.25 0.101 Wrinkled green 32 34.75 0.218 .
WhyEach category's squared gap is divided by its own expected count, then all four are added.
Step 4: Compare and decide.
df , critical value 7.81. , so fail to reject the null hypothesis.
WhyA this small would arise by chance far more often than 5 per cent of the time.
Check it
The expected counts add to 556, and every gap is under 4 seeds, so a small makes sense.
Answer
; fail to reject the null hypothesis, so the data are consistent with 9:3:3:1 and with independent assortment of the two genes.
Worked example 2: A choice-chamber investigation
Question: In a class investigation, 30 pill bugs were placed in a choice chamber with a moist side and a dry side. After 10 minutes, 22 were on the moist side and 8 on the dry side. The null hypothesis is that pill bugs show no preference. Calculate to two decimal places, then decide at p = 0.05. Answer reject or fail to reject.
What tells you the method
Counts in two categories and a "no preference" prediction.
Step 1: Find the expected counts.
No preference means half on each side: and 15.
WhyThe null hypothesis predicts a 1:1 split of the 30 animals.
Step 2: Calculate .
.
WhyEach side contributes its squared gap over its expected count.
Step 3: Compare and decide.
df , critical value 3.84. , so reject the null hypothesis.
WhyA split this uneven would happen by chance less than 5 per cent of the time if there were no preference.
Check it
22 + 8 = 30, and the two gaps are equal in size (7), as they must be with two categories.
Answer
; reject the null hypothesis. The difference is significant, which supports a preference for the moist side.
Your turn
Question: A cross predicts a 3:1 ratio. Of 400 offspring, 290 show the dominant phenotype and 110 the recessive. Calculate to two decimal places, then decide at p = 0.05. Answer reject or fail to reject.
Step 1: Expected counts.
and .
Step 2: Your go: calculate , then compare it with the critical value for df = 1.
Show the full solutionHide the solution
Step 2. . With df = 1, the critical value is 3.84, and .
Answer: ; fail to reject the null hypothesis, so the data are consistent with 3:1.
Traps
Trap
Failing to reject the null hypothesis proves the hypothesis is true.
It seems right because the data "passed" the test. But the test only shows that the difference could be due to chance: the data are consistent with the prediction, and another hypothesis might fit them too.
A cross gives below the critical value for a 3:1 ratio. Has the test proved the trait is controlled by one gene with two alleles?
No. It shows only that the data are consistent with 3:1. Say "fail to reject the null hypothesis", not "proved".
Trap
You can put percentages or ratio numbers into the formula in place of counts.
It seems right because the prediction is written as a ratio. But depends on sample size, so o and e must both be actual counts of individuals.
Predicted ratio 3:1, 80 offspring. Should e for the dominant class be 3, 75 or 60?
60, because . The value 3 is a ratio number and 75 is a percentage; neither is a count.
What's examined
On the AP® Biology exam (Unit 5: Heredity, and wherever count data appear), expect to state a null hypothesis, calculate expected values, and df, compare with the critical value, and explain the result. A calculator is allowed.
Practice questions
- Recall A student crosses two heterozygous plants and predicts a 3:1 ratio. Which is the null hypothesis?
- A) The offspring will show exactly a 3:1 ratio.
- B) There is no significant difference between the observed counts and a 3:1 ratio; any difference is due to chance.
- C) The observed counts differ significantly from a 3:1 ratio.
- D) The recessive allele is less common than the dominant allele.
Show answer
Answer: B. The null hypothesis says the prediction holds and any difference is chance.
Why the others are wrong:
- A: Real counts are not expected to match a ratio exactly.
- C is the alternative hypothesis.
- D is about allele frequency, not the fit of the counts.
- Recall A chi-square test compares counts with a 9:3:3:1 ratio. How many degrees of freedom does it have?
Show answer
Answer: 3 degrees of freedom.
Marking points:
- Four phenotype categories, so df = 4 − 1 = 3.
- Apply A cross is predicted to give genotypes in a 1:2:1 ratio. Of 240 offspring, calculate the expected number of heterozygotes.
Show answer
Answer: 120 heterozygotes.
Marking points:
- Heterozygotes are 2 of the 4 parts: .
- Apply A cross is predicted to give a 3:1 ratio. Of 160 offspring, 128 are dominant and 32 recessive.
(a) Calculate to two decimal places.
(b) Decide at p = 0.05. Answer reject or fail to reject.
Show answer
Answer: (a) ; (b) fail to reject the null hypothesis.
Marking points:
- Expected: 120 dominant and 40 recessive.
- .
- df = 1, critical value 3.84; , so the difference can be explained by chance.
- Exam-style A dihybrid cross predicted to give 9:3:3:1 gives . Which conclusion is correct at p = 0.05?
- A) Fail to reject the null hypothesis, because 9.2 is less than the critical value for df = 4.
- B) Fail to reject the null hypothesis, because a large means a good fit.
- C) Reject the null hypothesis, because 9.2 is greater than 3.84.
- D) Reject the null hypothesis, because 9.2 is greater than 7.81.
Show answer
Answer: D. Four categories give df = 3, whose critical value is 7.81, and 9.2 exceeds it, so something besides chance, such as linkage, may be affecting the counts.
Why the others are wrong:
- A uses df = 4 (the number of categories) instead of 3.
- B reverses the meaning: a large means a poor fit.
- C reaches the right decision with the critical value for df = 1.
- Exam-style A student's is 1.9 with df = 1. Which statement is the best conclusion at p = 0.05?
- A) The difference can be explained by chance, so the data are consistent with the predicted ratio.
- B) The predicted ratio has been proved correct.
- C) The difference is significant, so the predicted ratio is wrong.
- D) The test cannot be used because is not a whole number.
Show answer
Answer: A. , so fail to reject the null hypothesis.
Why the others are wrong:
- B: A chi-square test never proves a hypothesis.
- C: The difference is not significant, because 1.9 is below 3.84.
- D: is rarely a whole number.
- Exam-style In a hypothetical test cross, AaBb × aabb is predicted to give four phenotypes in a 1:1:1:1 ratio. The 400 offspring are:
| Phenotype | Number of offspring |
|---|---|
| Dominant for both traits | 160 |
| Recessive for both traits | 150 |
| Dominant for A only | 45 |
| Dominant for B only | 45 |
(a) Calculate to one decimal place.
(b) Decide at p = 0.05. Answer reject or fail to reject.
Show answer
Answer: (a) ; (b) reject the null hypothesis.
Marking points:
- Expected: 100 in each class.
- .
- df = 3, critical value 7.81; .
- Two classes are far more common than the other two, which suggests the genes are linked rather than assorting independently.
Key points
Recall, then reveal
Say the main points from memory first, then check them.
Show key pointsHide key points
- The null hypothesis says observed and expected counts differ only by chance.
- Expected counts are the predicted fraction of the total, never the ratio numbers or percentages.
- ; df is the number of categories minus one.
- If exceeds the critical value (3.84 for df = 1 at p = 0.05), reject the null hypothesis; otherwise fail to reject it.
- Failing to reject means "consistent with the prediction", never "proved".