The Chi-Squared Test in Genetics
~8 min read · Tier toggle changes depth (T1 plain · T2 standard · T3 rigour)
You should be comfortable with calculating expected phenotypic ratios from monohybrid and dihybrid crosses, and you should understand the basic concept of probability in independent events.
Why this matters
Genetics is an experimental science, and we need a statistical tool to decide if our data supports a hypothesis.
In the previous lecture, we predicted that a dihybrid cross between two heterozygotes should yield offspring in a 9:3:3:1 ratio. However, real biological data is never perfect. If you cross 100 pea plants and get 55 tall purple, 20 tall white, 20 short purple and 5 short white plants (against an expected 56.25 : 18.75 : 18.75 : 6.25), is this deviation due to random chance, or does it indicate that your genetic model is wrong? We cannot simply guess. We need a rigorous, quantitative method to test our hypothesis against the observed data. This method is the chi-squared (\(\chi^2\)) test, a cornerstone of statistical analysis in biology that allows us to quantify the "goodness of fit" between our theoretical expectations and our experimental reality.
The Logic of Goodness of Fit
Imagine you are flipping a fair coin 100 times. You expect to get 50 heads and 50 tails. If you actually get 52 heads and 48 tails, you would not be surprised; this is a small deviation likely caused by random chance. However, if you got 80 heads and 20 tails, you would suspect the coin is biased. The chi-squared test formalizes this intuition. It asks: "How large is the difference between what I expected and what I observed, relative to the size of the sample?" A small difference is acceptable; a large difference is not. The test calculates a single number, the chi-squared value, which summarizes the total deviation across all categories. Crucially, this value is then compared against a critical value from a statistical table. This comparison depends on the "degrees of freedom," which is simply the number of categories in your data minus one. If your calculated chi-squared value is smaller than the critical value, the difference is considered statistically insignificant, and we accept our hypothesis. If it is larger, the difference is significant, and we reject our hypothesis. This does not prove the hypothesis is wrong, but it suggests that the observed data is unlikely to have arisen by chance alone under the assumed model. In genetics, this is how we confirm whether genes assort independently or if there is linkage, or whether a trait is dominant or recessive.
Calculating the Chi-Squared Value
To calculate the chi-squared value, we compare the observed (\(O\)) and expected (\(E\)) frequencies for each phenotypic class. The formula is \(\chi^2 = \sum \frac{(O - E)^2}{E}\). We square the difference to ensure that all contributions are positive, preventing positive and negative deviations from cancelling each other out. We then divide by the expected value to normalize the difference; a deviation of 5 is significant in a small sample but trivial in a large one. Let us consider a monohybrid cross where we expect a 3:1 ratio. If we have 100 offspring, we expect 75 dominant and 25 recessive. Suppose we observe 80 dominant and 20 recessive. For the dominant class, the difference is \(80 - 75 = 5\). Squaring this gives 25. Dividing by the expected 75 gives \(25/75 = 0.33\). For the recessive class, the difference is \(20 - 25 = -5\). Squaring this gives 25. Dividing by the expected 25 gives \(25/25 = 1.0\). The total chi-squared value is \(0.33 + 1.0 = 1.33\). This calculation is straightforward but must be done carefully for each category. The sum of these ratios gives the final test statistic. It is important to note that the expected values are calculated based on the total number of offspring and the theoretical ratio, not on the observed numbers. This ensures that the test is independent of the specific random fluctuations in the sample.
Degrees of Freedom and Probability
Once we have the \(\chi^2\) value, we must interpret it. This requires the concept of degrees of freedom (\(df\)). For a goodness-of-fit test, \(df\) is the number of phenotypic classes minus one. In a monohybrid cross with two classes (dominant and recessive), \(df = 2 - 1 = 1\). In a dihybrid cross with four classes, \(df = 4 - 1 = 3\). We then look up the critical value for our specific \(df\) at a chosen probability level, typically \(P = 0.05\). This 5% level is the standard threshold in biology. It means we are willing to accept a 5% risk of rejecting a true hypothesis (a Type I error). If our calculated \(\chi^2\) is less than the critical value for \(df=1\) at \(P=0.05\) (which is 3.84), we accept the hypothesis. If it is greater, we reject it. For the dihybrid example with \(df=3\), the critical value at \(P=0.05\) is 7.81. If our calculated value is 5.2, we accept the 9:3:3:1 ratio. If it is 9.5, we reject it. The probability value (\(P\)) represents the likelihood of observing a deviation as large as the one calculated, assuming the null hypothesis is true. A low \(P\) value indicates that the observed data is inconsistent with the expected model. It is crucial to choose the correct \(df\); using the wrong value will lead to incorrect conclusions about the significance of the deviation.
Assumptions and Limitations
The chi-squared test relies on several assumptions that must be met for the results to be valid. First, the observations must be independent; each offspring must be counted only once, and the phenotype of one plant should not influence the phenotype of another. Second, the sample size should be sufficiently large. A common rule of thumb is that the expected frequency in each class should be at least 5. If the expected number is too small, the chi-squared distribution is a poor approximation of the true distribution, and the test becomes unreliable. In such cases, Fisher's exact test might be more appropriate, though it is more complex. Third, the test assumes that the deviations are due to random chance. If there is a systematic error in the experiment, such as biased sampling or environmental effects that skew the results, the chi-squared test will detect a significant deviation, but it will not tell you the cause. It only tells you that the data does not fit the model. Therefore, a significant result requires further investigation to determine the underlying biological or experimental reason. Understanding these limitations is essential for interpreting genetic data correctly and avoiding over-interpretation of statistical significance.
The concept
The dihybrid cross
Predicting the 9:3:3:1 ratio of two traits.
A common misconception is that a non-significant result (accepting the hypothesis) proves the hypothesis is correct. In reality, it only means that the data is consistent with the hypothesis. It does not rule out other models that might also fit the data. For example, a 3:1 ratio could arise from a simple dominant/recessive model, but it could also arise from more complex interactions that happen to produce the same ratio. Statistical tests assess consistency, not truth. C
Worked example
Problem. A geneticist crosses two heterozygous plants for two traits (AaBb x AaBb) and obtains 160 offspring. The observed phenotypes are: 90 A_B_, 35 A_bb, 25 aaB_, and 10 aabb. Test whether the data fits the expected 9:3:3:1 ratio at the 5% significance level.
- Calculate the expected frequencies. Total offspring = 160. The ratio is 9:3:3:1, summing to 16 parts. Expected A_B_ = \(160 \times \frac{9}{16} = 90\). Expected A_bb = \(160 \times \frac{3}{16} = 30\). Expected aaB_ = \(160 \times \frac{3}{16} = 30\). Expected aabb = \(160 \times \frac{1}{16} = 10\).
- Calculate the squared difference for each class. For A_B_: \((90 - 90)^2 = 0\). For A_bb: \((35 - 30)^2 = 25\). For aaB_: \((25 - 30)^2 = 25\). For aabb: \((10 - 10)^2 = 0\).
- Divide each squared difference by the expected frequency. For A_B_: \(0 / 90 = 0\). For A_bb: \(25 / 30 = 0.833\). For aaB_: \(25 / 30 = 0.833\). For aabb: \(0 / 10 = 0\).
- Sum these values to get the chi-squared statistic. \(\chi^2 = 0 + 0.833 + 0.833 + 0 = 1.666\).
- Determine the degrees of freedom and compare with the critical value. There are 4 phenotypic classes, so \(df = 4 - 1 = 3\). The critical value for \(df=3\) at \(P=0.05\) is 7.815. Since \(1.666 < 7.815\), the deviation is not significant.
Units check. The chi-squared value is dimensionless, as it is a ratio of counts.
Three quick tests
- If you have 3 phenotypic classes, what are the degrees of freedom?
Answer
2 - Why do we square the difference between observed and expected values?
Answer
To ensure all contributions are positive and prevent cancellation. - If your \(\chi^2\) value is greater than the critical value, what do you conclude?
Answer
You reject the null hypothesis.
Back to BU-103 →
Every lecture and every concept in this unit, with prerequisites and threads.
Lecture notes drafted with a local model and checked line by line by the editor; every number in the worked example was recomputed.
Concepts cited: T-014 · Threads: information, evolution