Hardy–Weinberg and the Wahlund effect

Why pooling populations creates a heterozygote deficit

What an excess of Hardy–Weinberg QC failures led me to learn about population structure, with an interactive explainer.
population-genetics
bioinformatics
statistics
Published

September 19, 2026

In bioinformatics, we use tests of Hardy–Weinberg equilibrium (HWE) as one check on the quality of genotype data: the record of which genetic variants each person carries.

At most positions on our non-sex chromosomes, we carry two copies of DNA, one inherited from each parent. Those copies can contain different versions of a sequence, called alleles. Someone with two copies of the same allele is homozygous at that position; someone with two different alleles is heterozygous.

Hardy–Weinberg gives us a baseline for how often those combinations should occur. Imagine a bag containing balls of two colors. Draw one, replace it, and draw again. If the colors are equally common, half the pairs should contain different colors. Likewise, when two alleles are equally common in a randomly mating population, we expect half its individuals to be heterozygous at that position.

An HWE test asks whether the observed genotype counts fit that expectation, allowing for sampling variation. A mismatch can flag errors in how genotypes were measured or assigned. But departures can also reflect inbreeding, non-random mating, natural selection, or population structure. How samples were selected, relatedness among participants, and chance can also affect the test. A small p-value tells us something needs investigating; it doesn’t identify the cause. Wigginton, Cutler, and Abecasis (2005)

I recently encountered this while examining variants that failed HWE p-value thresholds in samples classified as AMR, an ancestry grouping commonly used for admixed American populations. This group had a much higher count of failing variants, and more than 90% of those failures showed a heterozygote deficit: fewer people carrying two different alleles than HWE predicted.

Looking into that pattern led me to the Wahlund effect, described by Sten Wahlund in 1928. Populations with different allele frequencies can each follow HWE, yet show a heterozygote deficit when analyzed together. Wahlund’s original paper

That made population structure a possible explanation to investigate in my dataset. I built the interactive explainer below to understand how pooling populations creates this gap.

From allele frequencies to genotype proportions

Call the two alleles A and a. We can write the bag calculation using \(p\) for the fraction of A balls and \(q=1-p\) for the fraction of a balls:

Genotype Draws Expected proportion
AA A, then A \(p^2\)
Aa A then a, or a then A \(2pq\)
aa a, then a \(q^2\)

These cover all possible pairs, so \(p^2+2pq+q^2=1\). The heterozygote proportion is \(H(p)=2p(1-p)\), reaching a maximum of 50% when the two alleles are equally frequent.

The Wahlund effect enters when our sample comes from separate populations with different allele frequencies. In the bag analogy, the two bags stay separate and cannot mix. We draw both balls in each pair from the same bag, but calculate our expectation as though all the balls were in one combined bag.

What changes when we pool populations?

Consider two equally sized populations. Allele A has frequency 0.9 in population 1 and 0.1 in population 2. Each population follows HWE.

Population A frequency AA Aa aa
Population 1 0.9 0.81 0.18 0.01
Population 2 0.1 0.01 0.18 0.81
Mixture 0.5 0.41 0.18 0.41
HWE at the pooled frequency 0.5 0.25 0.50 0.25

The mixture has 18% heterozygotes because both populations have 18% heterozygotes. But its pooled allele frequency is 0.5, and HWE at that frequency predicts 50% heterozygotes. The difference is 32 percentage points.

The pooled expectation assumes random mating across the entire population, so it predicts more heterozygotes than the mixture of populations mating separately.

Change the populations yourself

Adjust the allele frequencies and population sizes to explore the effect. Counts are expectations, so they can be fractional.

Try the 0.6 / 0.4 example. The pooled allele frequency is still 0.5, but the mixture now has 48% heterozygotes. The deficit falls to two percentage points. With Same frequencies, it disappears altogether. With Unequal groups, the mixture moves toward the population contributing more samples.

The de Finetti view shows the same calculation in genotype space. Each point in the triangle gives three genotype frequencies summing to one. Populations in HWE lie on the curve; their mixture lies on the straight segment connecting them. At a given pooled allele frequency, the vertical gap is the heterozygote deficit.

Why the gap is always a deficit

Let \(w_i\) be population \(i\)’s fraction of the samples, with \(\sum_i w_i=1\), and let \(p_i\) refer to the same allele in every population. The pooled allele frequency is

\[ \bar p=\sum_i w_i p_i. \]

If each population follows HWE, the heterozygosity in the mixture is the weighted mean of the within-population expectations. We call this \(H_S\), where \(S\) refers to subpopulations:

\[ H_S=\sum_i w_i\,2p_i(1-p_i). \]

The expectation calculated from the pooled allele frequency is \(H_T\), where \(T\) refers to the total population:

\[ H_T=2\bar p(1-\bar p). \]

Subtracting gives

\[ H_T-H_S =2\left(\sum_i w_i p_i^2-\bar p^2\right) =2\operatorname{Var}_w(p_i). \]

Variance cannot be negative. The gap grows with allele-frequency variation among populations and vanishes when all contributing populations have the same frequency. In the two-population case, it simplifies to

\[ H_T-H_S=2w(1-w)(p_1-p_2)^2. \]

Another way to understand the effect is through the geometry of the function. The parabola \(H(p)=2p(1-p)\) is concave, so calculating heterozygosity from the average allele frequency gives a value at least as large as the average of the populations’ heterozygosities, using the same population weights in both averages.

Under this model, the relative deficit \((H_T-H_S)/H_T\) is \(F_{ST}\). This is a population quantity; estimating \(F_{ST}\) from finite samples requires additional choices and corrections. When the pooled population is monomorphic, \(H_T=0\) and the ratio is undefined.

What changes when the allele is rare?

An allele being restricted to one population doesn’t tell us how large its heterozygote deficit will be.

In the Rare in one group example, \(p_1=0.01\), \(p_2=0\), and the populations are equally sized. The pooled frequency is 0.005. Expected heterozygosity is 0.00995 under pooled HWE and 0.00990 in the mixture. That is a deficit of 0.005 percentage points, or about 0.5% of the pooled expectation. The gap is too small to see on the full-scale plot, but the table shows it.

Now select Small subgroup, common allele. Allele A has frequency 0.5 in a population contributing just 1% of the samples and is absent in the rest. The pooled frequency is again 0.005, but the relative deficit is about 49.75%. The same pooled rarity can conceal very different population distributions.

Detectability is another question. With few minor allele copies, HWE p-values are discrete and power is limited. A singleton has only one possible genotype configuration conditional on its allele count; two copies can occur in two heterozygotes or one homozygote. Wigginton, Cutler, and Abecasis describe exact HWE tests and show why a chi-square approximation can be unreliable, even in samples that aren’t particularly small.

How should we investigate a heterozygote deficit?

When many variants show a heterozygote deficit, population structure is one possible explanation. Before attributing the pattern to the Wahlund effect, we should check for technical artifacts, relatedness, and inbreeding, and examine how the samples were grouped for HWE testing.

Check What it helps distinguish
Sample quality: coverage, missingness, contamination, heterozygosity, and Ti/Tv Whether failures are concentrated in samples with unusual quality metrics. Compare samples with similar ancestry and sequencing protocols.
Genotype quality at failing variants: depth, allele balance, mapping quality, and missingness Whether technical artifacts could explain the heterozygote deficit.
Sequencing batch or platform Whether the pattern follows how samples were processed.
PCA within the samples being tested together Whether the analysis combines genetically differentiated groups or ancestry gradients, and whether those patterns coincide with sequencing batch.
Genotype counts across ancestry-informed subgroups Whether differences in allele frequency explain the pooled deficit. Compare observed and expected counts, rather than relying only on subgroup p-values.
Relatedness and runs of homozygosity Whether family sampling or inbreeding contributes to the pattern.
Failure rates, sample sizes, and allele counts Whether the excess remains when comparing similar sets of variants and accounting for differences in statistical power.

These checks separate sample quality, variant quality, and population structure. The transition/transversion ratio (Ti/Tv) is a broad quality indicator, not a specific test for heterozygote deficiency; its expected value depends on the regions sequenced and the variant set (GATK guidance).

Evidence for a Wahlund effect would come from allele-frequency differences among groups explaining the pooled heterozygote deficit. Larger HWE p-values after splitting the sample are not enough on their own, because smaller samples also have less power to detect departures.

Ancestry-aware HWE tests offer another approach when population structure is continuous or dividing samples into subgroups would leave too few observations. RUTH, introduced by Kwong et al. (2021), accounts for genetic ancestry and genotype uncertainty when testing for departures from HWE.

Further reading