Chi Square Test For Hardy Weinberg Equilibrium

4 min read

The chi square test for Hardy Weinberg equilibrium serves as a fundamental statistical bridge between observed genetic data and theoretical population expectations. On the flip side, it allows researchers, students, and evolutionary biologists to determine if a specific population is evolving at a particular locus or if it remains in a state of genetic stasis. By comparing observed genotype frequencies against those predicted by the Hardy Weinberg principle, this test reveals the invisible forces—like selection, drift, or non-random mating—shaping the genetic architecture of populations Simple, but easy to overlook..

Understanding the Hardy Weinberg Principle

Before diving into the mechanics of the test, You really need to grasp the null hypothesis it evaluates. The Hardy Weinberg principle states that in an infinitely large, randomly mating population free from mutation, migration, and natural selection, allele and genotype frequencies will remain constant from generation to generation.

The principle is mathematically expressed through two equations:

  1. Allele frequency equation: p + q = 1
    • p = frequency of the dominant allele
    • q = frequency of the recessive allele
  2. Genotype frequency equation: p² + 2pq + q² = 1
    • p² = frequency of homozygous dominant genotype
    • 2pq = frequency of heterozygous genotype
    • q² = frequency of homozygous recessive genotype

The chi square test for Hardy Weinberg equilibrium essentially asks: Do the actual genotype counts in my sample match the p², 2pq, q² expectations derived from the sample's own allele frequencies?

When to Apply This Test

This analysis is standard practice in several fields:

  • Population Genetics: To verify if a control group in a case-control study is representative of the general population. Day to day, * Evolutionary Biology: To detect signatures of natural selection (heterozygote advantage or disadvantage), inbreeding, or genetic drift in natural populations. In practice, * Genotyping Quality Control: A significant deviation in a control population often signals genotyping errors, sample contamination, or population stratification (the Wahlund effect). * Forensic Science: To validate allele frequency databases used for DNA profile probability calculations.

This changes depending on context. Keep that in mind It's one of those things that adds up. Less friction, more output..

Step-by-Step Calculation Workflow

Performing the calculation manually reinforces the logic behind the statistics. Here is the standard workflow.

1. Collect Observed Genotype Counts

Count the number of individuals for each genotype in your sample.

  • Observed (O): Count of AA, Count of Aa, Count of aa.

2. Calculate Observed Allele Frequencies (p and q)

You do not use external reference frequencies; you derive them from your data And that's really what it comes down to..

  • Total alleles = 2 × Total Individuals (N)
  • p = (2 × Count_AA + Count_Aa) / (2 × N)
  • q = (2 × Count_aa + Count_Aa) / (2 × N)
  • Check: p + q must equal 1.

3. Calculate Expected Genotype Frequencies

Plug p and q into the Hardy Weinberg equation.

  • Expected Freq(AA) = p²
  • Expected Freq(Aa) = 2pq
  • Expected Freq(aa) = q²

4. Calculate Expected Genotype Counts (E)

Multiply each expected frequency by the total sample size (N).

  • E_AA = p² × N
  • E_Aa = 2pq × N
  • E_aa = q² × N

Critical Assumption Check: For the chi square approximation to be valid, all expected counts should be 5 or greater. If any expected count is below 5, the standard chi square test is unreliable. In these cases, researchers must use an Exact Test (like the Hardy-Weinberg Exact Test using the Markov Chain algorithm) or combine categories if biologically justifiable Worth keeping that in mind. Which is the point..

5. Compute the Chi Square Statistic (χ²)

Use the formula: $ \chi^2 = \sum \frac{(O - E)^2}{E} $ Calculate this for each genotype class (AA, Aa, aa) and sum the values.

6. Determine Degrees of Freedom (df)

This is a common stumbling block. For a diallelic locus (two alleles):

  • df = Number of Genotypes - Number of Alleles
  • df = 3 - 2 = 1

Why 1? We have three genotype classes. We estimated one parameter (p, since q is 1-p) from the data to calculate the expected values. We lose one degree of freedom for estimating p and one for the constraint that the total expected must equal the total observed (N). 3 - 1 - 1 = 1 Still holds up..

7. Find the P-value

Compare your calculated χ² value against a chi square distribution table with df = 1, or use statistical software (R, Python, PLINK, online calculators) But it adds up..

  • P > 0.05: Fail to reject the null hypothesis. The population is in Hardy Weinberg Equilibrium. Observed deviations are likely due to random sampling error.
  • P ≤ 0.05: Reject the null hypothesis. The population deviates from Hardy Weinberg Equilibrium. Evolutionary forces or technical artifacts are likely at play.

A Worked Numerical Example

Imagine a study genotyping 500 individuals for a SNP with alleles A and a. Observed Counts:

  • AA: 180
  • Aa: 240
  • aa: 80
  • Total (N): 500

Step 1: Allele Frequencies

  • Total A alleles = (2 × 180) + 240 = 600
  • Total a alleles = (2 × 80) + 240 = 400
  • Total alleles = 1000
  • p (freq A) = 600 / 1000 = 0.6
  • q (freq a) = 400 / 1000 = 0.4

Step 2: Expected Frequencies & Counts

  • Exp Freq AA = p² = 0.36 → Exp Count = 0.36 × 500 = 180
  • Exp Freq Aa = 2pq = 2(0.6)(0.4) = 0.48 → Exp Count = 0.48 × 500 = 240
  • Exp Freq aa = q² = 0.16 → Exp Count = 0.16 × 500 = 80

Step 3: Chi Square Calculation

  • AA: (180 - 180)² / 180 = 0
  • Aa: (240 - 240)² / 240 = 0
  • aa: (80 - 80)² / 80 = 0
  • χ² = 0

Step 4: Interpretation With χ² = 0 and df = 1, the P-value is 1.0. This population is perfectly in Hardy Weinberg Equilibrium.

Let’s tweak the data slightly to see a deviation. Observed: AA: 200, Aa

What's Just Landed

Just Went Live

Similar Ground

More Reads You'll Like

Thank you for reading about Chi Square Test For Hardy Weinberg Equilibrium. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home