Population Genetics
Allele Frequencies (p, q) & Chi-Square (χ²)
Autosomal Recessive Carrier Risk (2pq)

Hardy-Weinberg Calculator (Genotypes, Allele Frequencies & Chi-Square)

Determine allele frequencies (p, q), calculate expected genotype numbers (AA, Aa, aa), and evaluate departure from Hardy-Weinberg equilibrium using Chi-square (χ²) goodness-of-fit with p-values, or estimate recessive disease carrier frequencies.

Observed Genotype Counts

Enter sample counts for the two-allele locus (A and a).
Derived Allele Frequencies
Allele p (A):
0.6500
Allele q (a):
0.3500
p + q = 1.0000 | N = 1000 individuals

HWE Equilibrium & Chi-Square Test

GenotypeObserved (O)Expected (E)(O − E)² / E
AA (p²)420422.500.015
Aa (2pq)460455.000.055
aa (q²)120122.500.051
Chi-Square Statistic (χ²):0.1208
Degrees of Freedom (df):1
P-value (P):7.2821e-1
Consistent with Hardy-Weinberg Equilibrium (P ≥ 0.05).

These counts do not show a statistically significant departure from HWE in this test. This does not confirm that every HWE assumption holds.

Hardy-Weinberg Calculator Equations & Chi-Square Goodness-of-Fit

The Hardy-Weinberg principle states that allele and genotype frequencies in a diploid, sexually reproducing population will remain constant from generation to generation in the absence of evolutionary disturbances. For a biallelic locus with alleles A and a:

Allele Frequencies:

p + q = 1, where p = f(A) and q = f(a)

Genotype Frequencies:

p² + 2pq + q² = 1

Chi-Square Goodness-of-Fit (df = 1):

χ² = ∑ [(O − E)² / E]; critical value χ²(α=0.05, df=1) = 3.841

Fundamental Assumptions of Hardy-Weinberg Equilibrium

A significant deviation (P < 0.05, χ² > 3.841) warrants checking genotyping errors, population structure, and the model assumptions below; this test alone cannot identify the cause:

1. Random Mating (Panmixia)

Assortative mating, inbreeding, or consanguinity increases homozygosity at the expense of heterozygotes.

2. Infinitely Large Population

Small population sizes cause random genetic drift and founder effects, altering allele proportions.

3. No Natural Selection

Differential reproductive fitness or viability favors specific genotypes over others.

4. No Mutation & No Gene Flow

New alleles arising from de novo mutation or migration alter gene pools.

Hardy-Weinberg Calculator Worked Example: Population Genetics Testing

Scenario: MN Blood Group Allele Frequencies (N = 1000)

A sample of 1,000 individuals is genotyped: MM = 490, MN = 420, NN = 90.

  • 1. p = f(M) = (2×490 + 420) / (2×1000) = 1400 / 2000 = 0.70
  • 2. q = f(N) = (2×90 + 420) / (2×1000) = 600 / 2000 = 0.30
  • 3. Expected: E(MM) = 0.70² × 1000 = 490; E(MN) = 2×0.70×0.30×1000 = 420; E(NN) = 0.30² × 1000 = 90
  • 4. χ² = (490−490)²/490 + (420−420)²/420 + (90−90)²/90 = 0.0000 (perfect HWE)

Frequently Asked Questions (FAQ)

What are the 5 core assumptions of Hardy-Weinberg equilibrium?

1. Random mating (panmixia); 2. Infinitely large population size; 3. No natural selection; 4. No mutation; 5. No migration or gene flow.

Why does the HWE Chi-square test have only 1 degree of freedom for 2 alleles?

Degrees of freedom = (number of genotypes) - 1 - (number of estimated parameters). With 3 genotypes and 1 independent estimated parameter p (since q = 1 - p), df = 3 - 1 - 1 = 1.

How do I calculate carrier frequency for an autosomal recessive disorder?

If disease incidence is 1 in N (q² = 1/N), calculate q = √(1/N), p = 1 - q, and carrier frequency = 2pq. For Cystic Fibrosis (1 in 2,500), q = 0.02, p = 0.98, and 2pq ≈ 1 in 25 people.

What does a significant Chi-square test (P < 0.05) indicate in genomic studies?

In GWAS quality control, severe departure from HWE often flags technical genotyping errors (e.g. allele dropout, miscalled heterozygotes) or strong population stratification rather than actual ongoing natural selection.