Allele and genotype frequencies derived from a single value
Input parameters
Input variable
Choose which frequency you know. The system derives the remaining four.
p
Frequency of the dominant allele (A) in the gene pool.
0.7
Fraction (0–1)
01
Enter the observed counts for each genotype (integers). The test compares observed against expected distributions under HWE, with p̂ estimated from the sample (1 degree of freedom).
At a biallelic locus, p (dominant allele frequency) and q (recessive allele frequency) are complementary and sum to unity.
Genotype distribution
p2+2pq+q2=1
Under equilibrium conditions, genotype frequencies correspond to the binomial expansion (p+q)2: homozygous dominant p2, heterozygous 2pq, and homozygous recessive q2.
χ² test (1 d.f.)
χ2=i∑Ei(Oi−Ei)2
Compares observed distribution against expectations under HWE. With one degree of freedom (3−1−1=1), a p-value<0.05 suggests significant departure from equilibrium.
Sample estimation
p^=2N2nAA+nAa
For the χ² test, the observed allele frequencies (p^ and q^) are estimated by counting alleles in the sample. Expected genotype counts are then projected as EAA=p^2N.
What is Hardy-Weinberg Equilibrium?
The Hardy-Weinberg principle is a key theoretical model in population genetics. It states that, under certain ideal conditions, allele and genotype frequencies in a large population will remain constant from generation to generation. In other words, the population will not evolve. This principle serves as a null model: when the genotypic frequencies of a real population deviate from these predictions, it is statistical evidence that some evolutionary force (such as natural selection or genetic drift) is acting upon it.
1. HWE Model assumptions
① Infinitely large population (no genetic drift).
② Random mating (panmixia).
③ No natural selection.
④ No mutation.
⑤ No migration (gene flow).
2. Mathematical derivation
If gametes combine at random, an egg carries A with probability p and a with probability q. Independently, the sperm follows the same distribution. Multiplying yields AA=p2,Aa=2pq,aa=q2. Their sum is (p+q)2=1, proving that equilibrium is reached after a single generation of random mating.
3. Ambiguity of the 2pq input
When the user enters the heterozygote frequency H=2pq, the equation p2−p+H/2=0 is solved — a quadratic with discriminant Δ=1−2H. If H<0.5, two real roots exist, symmetric about 0.5: it is impossible to distinguish which allele is the majority without additional information. This calculator displays both solutions.
4. χ² Test and Degrees of Freedom
To statistically evaluate if a population is in equilibrium, the observed genotype counts (Oi) are contrasted against the expected ones (Ei). This test has 1 degree of freedom (d.f.). Although there are 3 genotypic classes, 1 d.f. is lost by fixing the population size (N), and another 1 d.f. is lost because we estimate the parameter p directly from the sample data (3−1−1=1).
5. Limitations and real-world cases
In nature, all five assumptions are rarely met simultaneously. Genetic drift affects small populations, selection changes allele frequencies across generations, and inbreeding or assortative mating shift genotype frequencies away from HWE predictions. The χ² test allows statistical detection of these departures.