Do the Data Fit Mendel?

Using the χ2 test to evaluate genetic crosses

Example Student

BIOL 110 · The Community College of Baltimore County

Why do we need a statistical test?

  • Mendel’s laws predict ratios of offspring, like 3:1 or 9:3:3:1
  • Real crosses almost never match those ratios exactly
  • So how far off is too far off?

The chi-square (χ2) goodness-of-fit test tells us whether the difference between what we observed and what we expected is small enough to be explained by chance.

Background: where expected ratios come from

A monohybrid cross of two heterozygotes (Pp × Pp):

Punnett square for Pp × Pp
P p
P PP Pp
p Pp pp
  • Genotypes: 1 PP : 2 Pp : 1 pp
  • Phenotypes: 3 dominant : 1 recessive
  • A dihybrid cross (PpSs × PpSs) gives 9 : 3 : 3 : 1
  • These ratios were first reported by Mendel (1866)

Hypotheses

Every χ2 test starts with two competing statements:

  • Null hypothesis (\(H_0\)): the observed counts fit the expected Mendelian ratio; any differences are due to random chance.
  • Alternative hypothesis (\(H_1\)): the observed counts do not fit the expected ratio.

We choose a significance level before looking at the data: \(\alpha = 0.05\).

The χ2 statistic

\[ \chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i} \]

  • \(O_i\) = observed count in category \(i\)
  • \(E_i\) = expected count in category \(i\) = total \(\times\) expected proportion
  • \(k\) = number of categories

Degrees of freedom: \(df = k - 1\)

Critical values

If \(\chi^2\) is greater than the critical value, we reject \(H_0\).

data.frame(df = 1:4, critical_value = round(qchisq(0.95, df = 1:4), 2))
A data.frame: 4 × 2
df critical_value
<int> <dbl>
1 3.84
2 5.99
3 7.81
4 9.49

Example 1: monohybrid cross (3:1)

Data from the Chapter 11 worked example: 78 tall and 22 short plants.

observed <- c(Tall = 78, Short = 22)
ratio    <- c(3, 1)
expected <- sum(observed) * ratio / sum(ratio)
data.frame(observed, expected = round(expected, 1),
           contribution = round((observed - expected)^2 / expected, 3))
A data.frame: 2 × 3
observed expected contribution
<dbl> <dbl> <dbl>
Tall 78 75 0.12
Short 22 25 0.36
chisq.test(observed, p = ratio / sum(ratio))

    Chi-squared test for given probabilities

data:  observed
X-squared = 0.48, df = 1, p-value = 0.4884

Example 1: interpretation

  • \(\chi^2 = 0.48 < 3.84\) (critical value, \(df = 1\))
  • \(p = 0.49 > 0.05\)

Conclusion: we fail to reject \(H_0\). The data are consistent with a 3:1 ratio; the small differences are likely due to chance.

Example 2: dihybrid cross (9:3:3:1)

Data from the Chapter 11 worked example: 320 seeds.

observed <- c(`Round yellow` = 190, `Round green` = 65,
              `Wrinkled yellow` = 40, `Wrinkled green` = 25)
ratio    <- c(9, 3, 3, 1)
expected <- sum(observed) * ratio / sum(ratio)
contribution <- (observed - expected)^2 / expected
data.frame(observed, expected, contribution = round(contribution, 3))
A data.frame: 4 × 3
observed expected contribution
<dbl> <dbl> <dbl>
Round yellow 190 180 0.556
Round green 65 60 0.417
Wrinkled yellow 40 60 6.667
Wrinkled green 25 20 1.250

Example 2: the test

di_result <- chisq.test(observed, p = ratio / sum(ratio))
di_result

    Chi-squared test for given probabilities

data:  observed
X-squared = 8.8889, df = 3, p-value = 0.03081
  • \(\chi^2 = 8.89\) with \(df = 4 - 1 = 3\)
  • \(p = 0.03\), which is less than 0.05

Observed vs. expected

Wrinkled yellow seeds (40 observed vs. 60 expected) account for most of the χ2 value.

Where does our result fall?

\(\chi^2 = 8.89 > 7.81\), so we reject \(H_0\): the data do not fit a 9:3:3:1 ratio.

Human connection: MN blood groups

  • The M and N blood-group alleles are codominant, so all three genotypes (MM, MN, NN) can be identified from a blood test
  • Under Hardy–Weinberg equilibrium (Hardy, 1908), genotype frequencies are \(p^2 : 2pq : q^2\), where \(p\) and \(q\) are the allele frequencies
  • Data: genotypes of 1,279 people in England (Race & Sanger, 1975)

Expected MN genotypes

observed <- c(MM = 363, MN = 634, NN = 282)
n <- sum(observed)
p <- unname((2 * observed["MM"] + observed["MN"]) / (2 * n))  # frequency of M
q <- 1 - p                                                     # frequency of N
expected <- n * c(MM = p^2, MN = 2 * p * q, NN = q^2)
round(c(p = p, q = q), 4)
data.frame(observed, expected = round(expected, 1),
           contribution = round((observed - expected)^2 / expected, 3))
p
0.5317
q
0.4683
A data.frame: 3 × 3
observed expected contribution
<dbl> <dbl> <dbl>
MM 363 361.5 0.006
MN 634 636.9 0.014
NN 282 280.5 0.008

Human connection: result

# df = 3 genotypes - 1 - 1 allele frequency estimated from the data = 1
stat <- sum((observed - expected)^2 / expected)
round(c(chi_square = stat, df = 1,
        p_value = pchisq(stat, df = 1, lower.tail = FALSE)), 3)
chi_square
0.027
df
1
p_value
0.869
  • \(df = 3 - 1 - 1 = 1\), because one extra value (\(p\)) was estimated from the data
  • \(\chi^2 = 0.027 < 3.84\), \(p = 0.87\): we fail to reject \(H_0\)

The population’s MN genotypes are consistent with Hardy–Weinberg equilibrium.

Limitations

  • χ2 needs counts, not percentages or measurements
  • Each expected count should be at least 5
  • Failing to reject \(H_0\) does not prove the hypothesis is true
  • A fit can even be too good: Fisher (1936) argued that Mendel’s published data matched expectations more closely than chance would predict

Conclusion

  • Genetics predicts expected ratios; real data vary by chance
  • χ2 tells us if the variation is larger than chance would produce
  • Compare \(\chi^2\) to the critical value and state a conclusion about \(H_0\)
  • The same test works for plants and human populations

Your turn: apply the test to the corn-ear counts you collected in Lab 11.

References

Fisher, R. A. (1936). Has Mendel’s work been rediscovered? Annals of Science, 1(2), 115–137. https://doi.org/10.1080/00033793600200111

Hardy, G. H. (1908). Mendelian proportions in a mixed population. Science, 28(706), 49–50. https://doi.org/10.1126/science.28.706.49

Mateja, G. (2026). Mendelian genetics in corn and chi-square testing. In Introduction to human biology laboratory workbook (Chapter 11). The Community College of Baltimore County.

Mendel, G. (1866). Versuche über Pflanzen-Hybriden. Verhandlungen des naturforschenden Vereines in Brünn, 4, 3–47.

Pearson, K. (1900). On the criterion that a given system of deviations from the probable in the case of a correlated system of variables is such that it can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, Series 5, 50(302), 157–175. https://doi.org/10.1080/14786440009463897

Race, R. R., & Sanger, R. (1975). Blood groups in man (6th ed.). Blackwell Scientific.

R analysis: chisq.ipynb