Tutorials › Statistical Genetics › Sampling Fluctuation Versus Systematic Hardy–Weinberg Departure

Mendelian Probability and Allele Frequencies · Tutorial 17 of 989

Sampling Fluctuation Versus Systematic Hardy–Weinberg Departure

Compare observed genotype counts with Hardy–Weinberg expectations on the scale of sampling variation, and interpret discrepancies without overclaiming their cause.

Beginner 12 min read

What You'll Learn

  • Explain why genotype counts fluctuate around Hardy–Weinberg expectations even when the model holds.
  • Calculate the sample allele frequency and fitted Hardy–Weinberg genotype counts.
  • Compare genotype-count discrepancies with their ordinary sampling scale.
  • Interpret a one-degree-of-freedom chi-square comparison when its approximation is appropriate.
  • Recognize why a discrepancy does not, by itself, identify nonrandom mating or another cause.

Why a Difference From Expectation Is Not Automatically a Departure

Hardy–Weinberg equilibrium gives expected genotype frequencies for a population under a specified model. A sample drawn from that population will rarely reproduce those frequencies exactly. Even if the model is correct, random sampling produces differences between observed and expected genotype counts. The important question is therefore not simply whether the counts differ, but whether the differences are large relative to the variation expected from sampling.

This distinction matters because the size of a discrepancy depends on sample size. A difference of 10 individuals may be substantial in a sample of 100 but slight in a sample of 10,000. Conversely, a small percentage-point difference in a very large sample can be difficult to attribute to ordinary sampling fluctuation. Neither comparison, on its own, establishes why a population might depart from the Hardy–Weinberg model.

Definition: Sampling fluctuation is the random variation in sample genotype counts around the counts expected under a population model. A systematic Hardy–Weinberg departure occurs when the population genotype probabilities differ from the Hardy–Weinberg probabilities for its allele frequencies. A sample discrepancy is evidence to assess, not proof of a systematic departure or its cause.

Fitted Hardy–Weinberg Expectations

Consider a biallelic locus with alleles \(A\) and \(a\). Let the genotype counts in a sample of \(n\) diploid individuals be \(O_{AA}\), \(O_{Aa}\), and \(O_{aa}\). The sample allele frequency of \(A\) is

$$ \hat{p}=\frac{2O_{AA}+O_{Aa}}{2n}, \qquad \hat{q}=1-\hat{p}. $$

The factor of 2 counts two copies of \(A\) in each \(AA\) individual; each \(Aa\) individual contributes one. Under Hardy–Weinberg equilibrium, allele frequencies \(p\) and \(q=1-p\) imply genotype probabilities \(p^2\), \(2pq\), and \(q^2\). Substituting the sample allele-frequency estimate gives fitted expected counts:

$$ E_{AA}=n\hat{p}^{\,2}, \qquad E_{Aa}=2n\hat{p}\hat{q}, \qquad E_{aa}=n\hat{q}^{\,2}. $$

These are expected counts under the fitted model, not a prediction that the sample must contain exactly those numbers. They may be fractional. The model treats each sampled individual’s genotype as one of three categories with the stated probabilities, so the vector of counts has a multinomial distribution if individuals are sampled independently and the population probabilities are the same for all individuals.

In practice, the allele frequency is often estimated from the same genotype counts being compared. That is why these are called fitted expectations. The fit accommodates the observed overall allele frequency; the comparison then asks whether the genotype proportions are consistent with the Hardy–Weinberg proportions at that frequency.

Worked Example: A Discrepancy in a Sample of 100

Suppose a hypothetical sample has 30 \(AA\), 40 \(Aa\), and 30 \(aa\) individuals, for \(n=100\). First estimate the \(A\)-allele frequency:

$$ \hat{p}=\frac{2(30)+40}{2(100)} =\frac{100}{200}=0.500, \qquad \hat{q}=0.500. $$

The fitted Hardy–Weinberg expectations are:

$$ E_{AA}=100(0.5)^2=25,\qquad E_{Aa}=100(2)(0.5)(0.5)=50,\qquad E_{aa}=100(0.5)^2=25. $$

The observed-minus-expected counts are \(+5,-10,+5\). As proportions, the observed values are 0.30, 0.40, and 0.30, compared with 0.25, 0.50, and 0.25 expected. Thus the differences are \(+5,-10,+5\) percentage points. These differences are not automatically evidence of nonrandom mating: even under the model, samples vary. Their interpretation depends on how large they are relative to ordinary variation at this sample size.

Putting Discrepancies on a Sampling Scale

Under multinomial sampling, the count in a particular genotype category has a binomial marginal distribution. If its probability is \(\pi\), its expected count is \(n\pi\), and its standard deviation is \(\sqrt{n\pi(1-\pi)}\). This gives a useful scale for a count difference. For genotype proportions, divide that count standard deviation by \(n\); the resulting scale shrinks roughly as \(1/\sqrt{n}\).

The genotype counts are not independent of one another: they must sum to \(n\), and their sampling errors are related. Therefore, comparing each category’s difference separately is an informal diagnostic, not a complete joint analysis. A common joint summary is the Pearson chi-square statistic:

$$ X^2=\sum_{g\in\{AA,Aa,aa\}}\frac{(O_g-E_g)^2}{E_g}. $$

For a biallelic locus with a sample-estimated allele frequency, the usual large-sample reference distribution has one degree of freedom. The three counts sum to \(n\), leaving two independent pieces of information; estimating \(p\) from the sample uses one of those pieces. Equivalently, after fitting \(\hat p\), the residuals must sum to zero and preserve the observed allele count. They consequently have only one independent direction: a heterozygote excess or deficit relative to the fitted expectations.

The chi-square approximation is appropriate when the observations are independent, genotype categories are correctly recorded, the Hardy–Weinberg multinomial model is the null model, and expected counts are not too small. A common practical guideline is that all expected counts should be at least 5. When expected counts are small, the chi-square approximation may be unreliable; an exact method or a more suitable sampling calculation is needed. The statistic measures discrepancy relative to expected sampling variation. It does not reveal the biological cause of a discrepancy.

Justification: If \(p\) were known in advance, the three genotype counts would have two degrees of freedom after their total \(n\) is fixed. When \(p\) is estimated from these same counts, one additional constraint is imposed by fitting the allele frequency. Thus the usual goodness-of-fit comparison has \(3-1-1=1\) degree of freedom. This reasoning assumes an interior allele frequency and the large-sample chi-square approximation.

Worked Example: The Same General Question in a Larger Sample

Now consider a different hypothetical sample of \(n=10{,}000\): 2,400 \(AA\), 5,200 \(Aa\), and 2,400 \(aa\). Its estimated allele frequency is:

$$ \hat{p}=\frac{2(2400)+5200}{20{,}000} =\frac{10{,}000}{20{,}000}=0.500, \qquad \hat{q}=0.500. $$

The fitted expectations are 2,500 \(AA\), 5,000 \(Aa\), and 2,500 \(aa\). The observed-minus-expected counts are \(-100,+200,-100\). In proportions, these are \(-1,+2,-1\) percentage points. The genotype proportions differ from the fitted expectations by a different percentage-point pattern in the larger example: −1, +2, −1 percentage points rather than +5, −10, +5. The discrepancy is nevertheless larger relative to its sampling scale.

For these expected counts, the Pearson statistic is:

$$ X^2= \frac{(-100)^2}{2500} +\frac{(200)^2}{5000} +\frac{(-100)^2}{2500} =4+8+4=16. $$

With one degree of freedom, the asymptotic chi-square p-value is approximately 0.0000633. Under the stated model and its assumptions, a discrepancy at least this large would be unusual. This is stronger evidence against the fitted Hardy–Weinberg model than the count differences alone convey. It still does not establish a particular cause. For comparison, the marginal standard deviations of the three counts under probabilities 0.25, 0.50, and 0.25 are about 43.3, 50.0, and 43.3. The observed differences of 100, 200, and 100 counts are large relative to those scales.

A Small Sample: Why the Approximation Matters

Worked Example: Expected Counts Too Small for a Routine Chi-Square Approximation

A third hypothetical sample has \(n=12\), with 4 \(AA\), 4 \(Aa\), and 4 \(aa\) individuals. The estimated allele frequency is:

$$ \hat{p}=\frac{2(4)+4}{2(12)} =\frac{12}{24}=0.500, \qquad \hat{q}=0.500. $$

The fitted expectations are \(E_{AA}=3\), \(E_{Aa}=6\), and \(E_{aa}=3\). The residuals are \(+1,-2,+1\). One can calculate a Pearson statistic:

$$ X^2=\frac{1^2}{3}+\frac{(-2)^2}{6}+\frac{1^2}{3} =\frac{1}{3}+\frac{2}{3}+\frac{1}{3} =1.333. $$

However, the expected counts for both homozygotes are below 5. The routine chi-square approximation may therefore be inaccurate, so this calculation alone should not be used to report a reliable asymptotic p-value. The modest residuals are not proof of a departure, but neither does the calculated statistic settle the question. A method appropriate for small expected counts would be needed for formal inference.

What a Departure Can—and Cannot—Tell You

A small p-value from an appropriate comparison indicates that the observed genotype counts are difficult to reconcile with the specified Hardy–Weinberg sampling model. It is not the probability that the null model is true, nor is it the probability that a particular biological explanation is correct. A large p-value likewise does not prove equilibrium; it means the data do not provide strong evidence against the model under the analysis used.

A systematic departure can have multiple explanations. The sampled individuals may not represent one randomly mating population; there may be population structure, relatedness, nonrandom mating, selection, migration, or genotype-calling error. Sampling fluctuation remains possible as well. The count comparison by itself does not distinguish among these explanations, and association between a discrepancy and a proposed cause does not establish causation.

Sample size affects what differences can be detected. At small \(n\), sampling variation is relatively large and expected counts may be too small for a simple approximation. At large \(n\), the sampling scale for proportions is smaller, so a modest percentage-point difference may be statistically detectable. Statistical evidence and biological importance are separate considerations: a detectable discrepancy may be small in magnitude, while a potentially meaningful discrepancy may be estimated imprecisely in a small sample.

Common Mistake

  • Wrong reasoning: “The observed genotype counts are not exactly the Hardy–Weinberg expectations, so the population must have nonrandom mating.”
  • Correction: Exact equality is not expected in a random sample. Compare the discrepancy with its sampling scale, check whether the model and approximation are appropriate, and treat any evidence against the model as evidence of a mismatch—not as identification of its cause.
Key takeaway: Hardy–Weinberg expectations describe population probabilities, while observed counts are random sample outcomes. Interpret their differences relative to sampling variation, the sample size, and the assumptions behind the comparison.

Check Your Understanding

Answer each question using the model and distinctions developed above.

  1. Why can observed genotype counts differ from fitted Hardy–Weinberg expectations even when the population model holds?
  2. For counts \(O_{AA}=18\), \(O_{Aa}=44\), and \(O_{aa}=38\) in \(n=100\), write the formula for \(\hat p\). What does the estimate count in its numerator and denominator?
  3. Why can the same difference in genotype proportions be more notable in a larger sample?
  4. What is the usual degrees of freedom for a biallelic Hardy–Weinberg chi-square comparison when the allele frequency is estimated from the sample, and why?
  5. If a comparison provides evidence against Hardy–Weinberg equilibrium, can it establish nonrandom mating as the cause? Explain.
Clinical Biostats