Hardy-Weinberg Extended Calculator
Calculate allele frequencies, test for HWE departure, and detect selection or drift.
The Five Assumptions
Hardy–Weinberg describes what allele and genotype frequencies do when nothing is happening evolutionarily. Departure from it therefore signals that something is.
| Assumption | Violated by |
|---|---|
| No selection | Fitness differences between genotypes |
| No mutation | New alleles arising |
| No migration | Gene flow from other populations |
| Infinite population | Genetic drift in small populations |
| Random mating | Assortative mating, inbreeding, population structure |
Note that df = 1 for a two-allele locus, not 2. Three genotype classes give two degrees of freedom, but one is consumed estimating the allele frequency from the data itself. The critical value at p = 0.05 is therefore 3.84.
Reading a Departure
| Pattern | Suggests |
|---|---|
| Heterozygote deficit | Inbreeding, population structure (Wahlund effect), null alleles |
| Heterozygote excess | Balancing selection, outbreeding, small sample |
| Departure at one locus only | Genotyping error or selection at that locus |
| Departure across many loci | Population structure or admixture |
That last distinction is how HWE testing is used in practice. A single locus out of equilibrium in a genotyping panel usually means a technical problem — a null allele or a miscalled genotype — which is why HWE is a standard quality control filter in genome-wide studies. Departure across many loci simultaneously points to genuine population structure instead.
The Wahlund effect is worth knowing: pooling two populations with different allele frequencies produces a heterozygote deficit even when each subpopulation is individually in perfect equilibrium.
Worked Examples
Common Mistakes
One degree of freedom is consumed estimating the allele frequency from the data. Use df = 1, with a critical value of 3.84.
One locus out of equilibrium in a large panel usually indicates a genotyping error or null allele rather than selection.
Pooling subpopulations with different allele frequencies creates an apparent heterozygote deficit even when each is individually in equilibrium.
With expected genotype counts below about five, the chi-square approximation fails. Use an exact test instead.