Contents
26 — Allele frequencies and Hardy–Weinberg Part 5 — Population genetics

26 — Allele frequencies and Hardy–Weinberg

Before this: Ch 09 · Ch 10 · Ch 12 · Time: ~35 min

Statistics needed: S2 Distributions · S4 Hypothesis testing

Everything so far has tracked through individuals and families. From here the unit of analysis is the population, and the state variable is a vector of frequencies. That single change of level is what makes evolution computable.

What you'll be able to do

The core idea

Take a population, forget who is married to whom, and pour every gamete anyone will ever make into one enormous bucket. Stir. Draw pairs at random. That bucket — the gamete pool — is the entire model, and its only parameter is the frequency of each .

If are built by drawing two alleles independently from that pool, genotype frequencies are just the square of the allele-frequency vector. There is nothing more to it. The content of Hardy–Weinberg is not the algebra; it is the claim that the pooling is legitimate — that knowing which allele a zygote got from its mother tells you nothing about which it got from its father.

Hardy–Weinberg is a null model, not a description of nature. Every real population violates several of its assumptions permanently, and most still fit it closely. Its value is exactly the value of any null: it converts a messy observation into a residual. You never learn anything from a population being in . You learn from the size, the sign, and the cause of the departure.


1. Allele frequencies and genotype frequencies: only one direction is free

One autosomal locus, two A and a. counts nAA, nAa, naa in N individuals; genotype frequencies PAA, PAa, Paa. Each individual carries two allele copies, so 2N copies exist. Counting the A copies:

p  =  (2·n_AA + n_Aa) / 2N  =  P_AA + ½·P_Aa
q  =  (2·n_aa + n_Aa) / 2N  =  P_aa + ½·P_Aa        p + q = 1

This direction is arithmetic. It is an identity — a change of coordinates from a 3-dimensional simplex (2 free parameters) to a 1-dimensional one (1 free parameter). It holds under selection, inbreeding, migration, population structure, any mating system whatsoever. If someone hands you genotype counts you can always compute allele frequencies, no assumptions attached.

The reverse direction is lossy and therefore requires a model. You are recovering two numbers from one. The missing degree of freedom has to come from somewhere, and Hardy–Weinberg is the assumption that supplies it. Every time you see a computed from a disease incidence, or an expected heterozygosity computed from allele frequencies, that missing degree of freedom has been silently filled in.

2. Deriving it

From random union of gametes

Assume gametes unite at random with respect to at this locus. A zygote's maternal is a draw from the pool with P(A) = p; its paternal allele is an independent draw from the same pool.

                 paternal gamete
                  A  (p)       a  (q)
              ┌────────────┬────────────┐
maternal A (p)│  AA   p²   │  Aa   pq   │
gamete        ├────────────┼────────────┤
         a (q)│  Aa   qp   │  aa   q²   │
              └────────────┴────────────┘

     AA : Aa : aa   =   p²  :  2pq  :  q²
     sum = p² + 2pq + q² = (p + q)² = 1

The factor of 2 on the heterozygote is the only place people slip: Aa is two distinct outcomes, maternal-A/paternal-a and its mirror, and the cannot tell them apart.

From the mating table, without the gamete-pool abstraction

The gamete-pool argument can feel like it assumes what it proves. So do it the long way. Let the parental generation have arbitrary genotype frequencies PAA, PAa, Paa — nothing near Hardy–Weinberg. Under random mating, mating types occur at the product of their genotype frequencies. Collect every path to an AA offspring:

MatingFrequencyFraction of offspring AAContribution
AA × AAPAA²1PAA²
AA × Aa (both parental orders)2PAAPAa½PAAPAa
Aa × AaPAa²¼¼PAa²

Sum: PAA² + PAAPAa + ¼PAa² = (PAA + ½PAa)² = p².

No gamete pool required, and no assumption about the parental generation's genotype frequencies. Random mating plus fair Mendelian is the whole input.

3. One generation, then a fixed point

This is the structural fact, and it is what makes the model useful rather than merely true.

Step 1 — attainment. The derivation above started from arbitrary parental frequencies and produced p², 2pq, q² in the offspring. So Hardy–Weinberg proportions are reached after one generation of random mating, regardless of history. A population founded by 100 AA individuals and 100 aa individuals — zero heterozygotes, maximally out of equilibrium — is in Hardy–Weinberg proportions in its children.

Step 2 — persistence. Random mating does not change frequencies. Starting from Hardy–Weinberg proportions, the next generation's is

p' = P_AA + ½P_Aa = p² + ½(2pq) = p² + pq = p(p + q) = p

p is unchanged, so the genotype proportions computed from it are unchanged. Hardy–Weinberg is a fixed point, and it is reached in one step from anywhere in the interior of the simplex.

That combination is unusual and worth pausing on. There is no relaxation time, no burn-in, no "the population has been evolving long enough". The system is memoryless: genotype frequencies carry no information about the population's past beyond the single number p.

One caveat that foreshadows the X. "One generation" assumes the two sexes start with the same allele frequency. If they do not — say p = 0.8 in males and 0.2 in females — the first generation's offspring are pmpf = 0.16 AA, 0.68 Aa, 0.16 aa: a large heterozygote excess, not Hardy–Weinberg. But both sexes of that generation now share p = ½(0.8 + 0.2) = 0.5, so the second generation is 0.25 : 0.50 : 0.25. Unequal sex frequencies cost exactly one extra generation on an autosome. On the X they cost infinitely many (§7).

4. The five assumptions, and what each one buys

Textbooks list them as a chant. What matters is which step of the derivation each licenses, and how big the damage is when it fails.

AssumptionThe step it licensesFailure modeMagnitude
Random mating w.r.t. this locusIndependence of the two gamete drawsInbreeding or assortative mating → heterozygote deficit; disassortative → excessThe only assumption whose failure is routinely large enough to see
No selection frequencies at census = at zygote formation; gametes sampled irrespective of genotypeDifferential viability or fertility distorts proportions and moves pTiny for rare . A fully lethal at q = 0.01 induces exactly F = −q = −0.0100
No Gamete-pool frequency = parental frequencyp toward Δp ~ 10⁻⁸ per generation. Irrelevant on any study timescale
No migrationThe gamete pool is this population's ownImmigrant alleles shift p; sampling across subpopulations gives the (§8)Small if you sample one population; large if you accidentally sample two
Infinite populationThe realised offspring equal their expectations rather than being a multinomial drawGenetic drift: p performs a random walk (Ch 27)Does not create systematic departure within a generation — expected proportions are still p², 2pq, q² given p

Three usually-unstated assumptions do the rest of the work: discrete non-overlapping generations, one autosomal locus in a , and equal allele frequencies in the two sexes.

Two precision points that separate a correct account from the usual one:

"No selection" means no selection between zygote formation and the moment you census. Selection acting on post-reproductive adults is invisible to a Hardy–Weinberg test, and selection on gametes is not — it changes the pool itself.

Finite population size does not bias the proportions. Conditional on p, expectations are still p², 2pq, q². (Strictly, in a finite two-sex population where self-fertilisation is impossible, there is a heterozygote excess of order 1/N — negligible above a few dozen individuals, and in the opposite direction to what people expect.)

5. Testing: χ², the exact test, and the power you do not have

Three classes, one parameter (p) estimated from the same genotypes, so df = 3 − 1 − 1 = 1. Using df = 2 makes the test conservative and is the single most common error (Ch 12 §4).

Statistics: the χ² distribution, and why estimating a parameter from the very counts you are testing costs a degree of freedom, are covered in S2 §4 and S4 §2.

There is a closed form that makes the whole test transparent. Write the disequilibrium D = PAA − p̂². Because p̂ was computed from these very counts, the other two cells are forced: PAa = 2p̂q̂ − 2D and Paa = q̂² + D. Substituting into χ² = Σ(O−E)²/E and collecting:

χ² = N·D² [ 1/p̂²  +  2/(p̂q̂)  +  1/q̂² ]
   = N·D² (q̂² + 2p̂q̂ + p̂²) / (p̂²q̂²)
   = N·D² / (p̂²q̂²)
   = N·F̂²          where  F̂ = D/(p̂q̂)

So the Hardy–Weinberg test is a one-parameter test that F = 0, with test statistic N F̂² on 1 df. F̂ is the standardised heterozygote deficit — the same F that §8 introduces as the inbreeding coefficient. The effective sample size is N individuals, not 2N .

The power consequence is brutal. Non-centrality λ = N F²; 80% power at α = 0.05 with 1 df needs λ ≈ 7.85, so N ≈ 7.85/F².

Statistics: power, and the non-centrality parameter that turns an effect size into it, are covered in S4 §4 — which works this same λ = N F² case.

True departureInduced FN for 80% power
Offspring of full-sib matings+0.25126
Two populations pooled, p = 0.2 and 0.8+0.3661
5% of heterozygotes miscalled as homozygotes+0.049~3,200
Viability selection s = 0.2 against aa, q = 0.5−0.056~2,500
Two populations pooled, p = 0.40 and 0.50+0.010~77,000
lethal, q = 0.01−0.0100~78,500

The last row is exact rather than rounded, and the identity is worth carrying. Remove every aa zygote and census the survivors: Ho = 2pq/(1 − q²) = 2q/(1 + q), the census-estimated is q̂ = q/(1 + q), so He = 2q/(1 + q)² and

F = 1 − H_o/H_e = 1 − (1 + q) = −q          (fully lethal recessive)

A fully lethal recessive induces a heterozygote excess equal to its own allele frequency.

Read the last row twice. An allele that kills every homozygote, at a realistic disease-allele frequency, needs eighty thousand genotyped people before it perturbs Hardy–Weinberg detectably. This is the quantitative content of "Hardy–Weinberg is remarkably robust": the model survives gross violations of its assumptions because the assumptions enter the genotype proportions only weakly.

Why the exact test, for rare variants

Statistics: why Σ(O−E)²/E follows a χ² distribution only asymptotically, and why the cell counts here are multinomial, are covered in S2 §4.

χ² is an asymptotic approximation to a multinomial, and it fails exactly where genomics lives. At MAF 0.5% in N = 1,000, the expected minor-homozygote count is Nq² = 0.025 — a cell expectation two orders of magnitude below the "at least 5" rule. Observe 991/8/1:

p̂ = 0.995      E_AA = 990.025   E_Aa = 9.95   E_aa = 0.025
χ² = 0.00096 + 0.38216 + 38.025 = 38.41        χ²₁ → p ≈ 6 × 10⁻¹⁰

The statistic is 99% one cell whose expectation is 0.025. Now ask the exact question instead: deal 1,990 major and 10 minor alleles at random into 1,000 pairs — how often does at least one minor–minor pair appear? Each minor allele finds another minor allele with probability 9/1,999, giving 5 × 0.0045 ≈ 0.023 expected minor homozygotes, and

exact p ≈ 0.022.

The χ² p-value is wrong by roughly eight orders of magnitude, in the anti-conservative direction. Applied genome-wide it would discard a large fraction of perfectly good rare variants.

The standard exact test (Wigginton–Cutler–Abecasis) conditions on N and the minor-allele count na and enumerates the null distribution of the heterozygote count directly:

P(n_Aa | N, n_a)  =   n_a! · n_A! · N! · 2^(n_Aa)
                     ─────────────────────────────
                      n_AA! · n_Aa! · n_aa! · (2N)!

Sum the probabilities of all outcomes no more likely than the observed one. Use it whenever any expected cell count is small — which for rare variants is always.

6. What this is actually used for: a genotyping-error detector

In modern genomics, Hardy–Weinberg testing is overwhelmingly a quality-control filter, and the reasoning is a straightforward application of §5.

graph TD T["Variant fails HWE<br/>in a large cohort"] S{"Sign of F̂ ?"} T --> S S -->|"F̂ > 0<br/>heterozygote deficit"| DEF["allele dropout — variant under<br/>the probe/primer site<br/>· null allele<br/>· deletion polymorphism<br/>· population structure<br/>· real inbreeding"] S -->|"F̂ < 0<br/>heterozygote excess"| EXC["two paralogues collapsed<br/>into one locus<br/>· CNV / segmental duplication<br/>· sample contamination<br/>· mismapped reads"] DEF --> B{"Biology or assay?"} EXC --> B B -->|"assay — the usual answer"| DROP["drop the variant"] B -->|"biology"| KEEP["keep; investigate"]

Why the prior favours "assay": §5 showed that genuine biological forces induce F of order 10⁻² or smaller at realistic frequencies, while a few percent of miscalled heterozygotes induces F of comparable size — and at N = 10⁵ both become significant, but only one of them is common. Assay pathologies are ubiquitous; strong selection at a common variant is not.

Practical rules, all of which fall out of the above:

7. Multiple alleles, and the X

Multiple alleles: multinomial expansion

For k at frequencies p₁ … pk, random union of gametes squares the whole vector:

(p₁ + p₂ + … + p_k)²  =  Σ p_i²        (k homozygote classes)
                       + 2 Σ_{i<j} p_i p_j   (k(k−1)/2 heterozygote classes)

k(k+1)/2 in total. Two consequences used constantly later. The expected heterozygosity

H_e = 1 − Σ p_i²

is nothing but the Hardy–Weinberg heterozygote total — which is why comparing observed to expected heterozygosity is the same operation as estimating F. And with many alleles, most individuals are heterozygotes: at 10 equally frequent alleles, He = 0.9. This is why highly polymorphic markers were the workhorse of identity testing.

X-linked loci: the frequencies differ between the sexes

Now drop the assumption that the sexes share an — on the X they cannot, because of the inheritance asymmetry. Let pf(t) and pm(t) be the frequency of A among X in females and males. Males (XY) receive their single X from their mother; females receive one X from each parent:

p_m(t+1) = p_f(t)
p_f(t+1) = ½ [ p_f(t) + p_m(t) ]

Females carry two-thirds of all X chromosomes, so the population frequency is the weighted mean p̄ = ⅔pf + ⅓pm. Check that it is conserved:

p̄(t+1) = ⅔·½(p_f + p_m) + ⅓·p_f = ⅓p_f + ⅓p_m + ⅓p_f = ⅔p_f + ⅓p_m = p̄(t)   ✓

Now track the sex difference d(t) = pf − pm:

d(t+1) = p_f(t+1) − p_m(t+1) = ½(p_f + p_m) − p_f = −½ (p_f − p_m) = −½ d(t)

  ⟹   d(t) = (−½)ᵗ · d(0)

The sex difference halves and changes sign every generation. The X approaches equilibrium by damped oscillation, never in one step. Solving explicitly:

p_f(t) = p̄ + ⅓ (−½)ᵗ d₀          p_m(t) = p̄ − ⅔ (−½)ᵗ d₀

Starting from all-A females and all-a males (pf = 1, pm = 0, so p̄ = ⅔):

 t   :   0       1       2       3       4       5       6
 p_f : 1.000   0.500   0.750   0.625   0.6875  0.65625 0.671875
 p_m : 0.000   1.000   0.500   0.750   0.625   0.6875  0.65625
                    ← alternating either side of p̄ = 0.6667 →

Only once pf = pm = p do females settle into p², 2pq, q². Males, being , are always simply p and q — there are no male heterozygotes and therefore no equilibrium for males to reach.

Male excess, derived

At equilibrium, the frequency of an is q in males and q² in females. The ratio is 1/q, and it blows up as the allele gets rarer:

ConditionqAffected malesAffected femalesMale : female
Red–green colour vision deficiency~0.088%0.64%~13 : 1
Haemophilia A~2 × 10⁻⁴1 in 5,000~1 in 2.5 × 10⁷~5,000 : 1

The haemophilia figure is per male birth — US surveillance gives 1 in 5,617 male births and registry meta-analysis ~1 in 4,100, so 1 in 5,000 is the honest round number. The familiar "1 in 10,000" is per birth counting both sexes, and forgetting to halve it is the classic way this row gets botched: for an X-linked recessive the male frequency is q, so the both-sexes figure understates q twofold and the female incidence fourfold.

The predicted 0.64% for females is close to the ~0.5% observed in Northern-European-ancestry populations — good agreement, given that "red–green deficiency" pools variants at two adjacent opsin genes. Note what this explains and what it does not: the male excess is a Hardy–Weinberg consequence, not a fact about severity or dominance. Any X-linked recessive shows it, and the rarer the allele the more extreme the ratio (Ch 13).

8. Departures with names: inbreeding and Wahlund

Both of the systematic departures you will actually meet have the same algebraic form, which is the reason F is worth defining once.

Inbreeding. Let F be the probability that an individual's two are identical by descent. With probability F the second allele is a copy of the first; with probability 1 − F it is an independent draw:

P(AA) = p² + Fpq        P(Aa) = 2pq(1 − F)        P(aa) = q² + Fpq

Sum = 1, and the is untouched: (p² + Fpq) + ½·2pq(1−F) = p² + pq = p. Inbreeding repackages alleles into ; it does not change allele frequencies. Rearranging the middle term gives the estimator used everywhere:

F = 1 − H_o/H_e

F may be negative — heterozygote excess — which is why §6 reads its sign diagnostically. Ch 28 develops F properly.

. Take two subpopulations, each internally in perfect Hardy–Weinberg, with frequencies p₁ and p₂, and pool them in equal numbers. The pooled homozygote frequency is an average of squares, and an average of squares exceeds the square of the average by the variance:

P(AA) = ½(p₁² + p₂²) = E[p²] = p̄² + σ²_p
P(aa) = q̄² + σ²_p
P(Aa) = 1 − P(AA) − P(aa) = 2p̄q̄ − 2σ²_p

A heterozygote deficit of exactly 2σ²p, with no inbreeding, no selection, and no non-random mating anywhere in the system. Comparing to the inbreeding form gives

F_ST = σ²_p / (p̄ q̄)

With p₁ = 0.2 and p₂ = 0.8: p̄ = 0.5, σ²p = 0.09, pooled heterozygosity = 0.5 − 0.18 = 0.32 against an expected 0.50, and FST = 0.09/0.25 = 0.36.

Mixing populations looks exactly like inbreeding. This is not an analogy — it is the same equation, because both mechanisms make the two alleles in an individual more correlated than two random draws from the pooled bucket. It is the single most common reason a real dataset fails Hardy–Weinberg, and the reason population structure must be handled before any association test (Ch 51).


Common misconceptions

What people thinkWhat's actually true
Hardy–Weinberg describes real populationsIt is a null model. Every real population violates several assumptions permanently and most still fit, because the proportions depend on the assumptions only weakly
A population in Hardy–Weinberg is randomly matingA fit licenses almost nothing. At N = 200 you have about 11% power against F = 0.05, and you need N ≈ 1,000 to reach even 35%. Most failures of the assumptions do not perturb the proportions detectably
Reaching equilibrium takes many generationsOne generation on an autosome, from anywhere. Two if the sexes start with different frequencies. Never exactly, on the X
A Hardy–Weinberg test has 2 df — three classes minus one1 df. The was estimated from the same (Ch 12)
Failing Hardy–Weinberg reveals selection or non-random matingIn modern genomics it almost always reveals a broken assay: , collapsed paralogues, contamination, . Biology is a distant second
The direction of the departure doesn't matterThe sign of F is the most diagnostic thing in the test. Deficit → dropout, structure, inbreeding. Excess → CNV/paralogue collapse, contamination
Selection strong enough to matter will show up as a departureA fully lethal at q = 0.01 induces F = −q = −0.01 exactly, and needs ~78,500 samples to detect. Selection and Hardy–Weinberg proportions are nearly orthogonal
causes departures from Hardy–Weinberg proportionsDrift changes p between generations. Conditional on p, the expected proportions are still p², 2pq, q²
A rare recessive disease means the allele is rare, so carriers are rareCarriers outnumber affected individuals by 2p/q ≈ 2/q. The rarer the disease, the more lopsided: at incidence 1 in 10⁶, carriers are 2,000× more common than cases
You can compute genotype frequencies from allele frequenciesOnly under an assumption. Allele-from-genotype is an identity; genotype-from-allele is a model, and Hardy–Weinberg is that model

Worked example: from disease incidence to carrier frequency

Cystic fibrosis is autosomal with an incidence of roughly 1 in 2,500 live births in Northern-European-ancestry populations. What fraction of that population are carriers?

Step 1 — identify what the incidence measures. Affected individuals are aa homozygotes. Under Hardy–Weinberg, P(aa) = q². So

q² = 1/2500 = 4.0 × 10⁻⁴

Step 2 — solve for the .

q = √(4.0 × 10⁻⁴) = 0.02 = 1/50
p = 1 − 0.02 = 0.98

Step 3 — is the heterozygote class.

2pq = 2 × 0.98 × 0.02 = 0.0392 = 1 in 25.5   ≈ 1 in 25

Matching the screening figure used in Ch 12 §6.

Step 4 — why the 2q shortcut works. People habitually write "carrier frequency ≈ 2q", here 2 × 0.02 = 0.04 = 1 in 25. Compare exactly:

2q / 2pq  =  1/p  =  1/(1 − q)

The shortcut overstates the carrier frequency by a factor 1/(1−q), i.e. by about q in relative terms. At q = 0.02 that is a 2% overstatement — invisible against the uncertainty in the incidence estimate. At q = 0.1 it is 11%, and at q = 0.3 it is 43% and no longer a shortcut but an error. Use 2q freely for rare recessives; never for common variants.

Step 5 — the ratio worth remembering.

carriers   2pq    2p     2
──────── = ─── =  ──  ≈  ─       = 2 × 0.98/0.02 = 98
affected    q²     q     q

About 98 carriers for every affected child. Equivalently, the fraction of all a sitting in heterozygotes is

pq / (pq + q²) = p / (p + q) = p = 0.98

98% of cystic fibrosis alleles are in unaffected carriers. This single number explains why selection against a recessive disease is so feeble that it barely moves q, why carrier screening rather than case-finding is the only effective public-health lever, and why recessive disease alleles persist for thousands of generations (Ch 27).

Step 6 — say what was assumed. All of it rested on P(aa) = q², which imports the whole Hardy–Weinberg null. Specifically it assumes random mating with respect to CFTR ( inflates incidence relative to q², so this over-estimates q where consanguinity is common), no population structure inside "Northern European" (any structure inflates homozygotes, again biasing q upward), complete ascertainment of affected births, and full . It also treats CFTR as biallelic when it is not — over 300 pathogenic variants are known, so q here is the summed frequency of a heterogeneous class, and "carrier" means carrier of any of them. That last simplification is exactly the multiple-allele case of §7: pooling k − 1 deleterious alleles into one "a" is legitimate for computing P(affected) precisely because (Σpi)² expands the way it does.

Connections