Heterozygosity Calculator

Observed vs. Expected: A Core Population Genetics Comparison

Heterozygosity — the proportion of individuals carrying two different alleles at a locus — can be measured two ways: counted directly from a sample (observed), or predicted from the allele frequency under Hardy-Weinberg assumptions (expected). Comparing the two is one of the most common diagnostic checks in population genetics, since a meaningful gap between them signals something biologically interesting is happening at that locus.

The Formula

Observed Heterozygosity (Ho) = Heterozygous Individuals ÷ Total Individuals
Expected Heterozygosity (He) = 2pq

He follows directly from the Hardy-Weinberg genotype proportions (p² + 2pq + q² = 1): the middle term, 2pq, is the expected proportion of heterozygotes if the population were mating randomly with no other evolutionary forces at play.

Worked Example

A sample of 100 individuals with 40 heterozygotes, and an A allele frequency of p = 0.6:

Observed vs. expected heterozygosity, 100 individuals, 40 heterozygous, p = 0.6
MeasureValue
Observed Heterozygosity (Ho)0.4000
Expected Heterozygosity (He)0.4800

Interpreting the Gap Between Ho and He

  • Ho notably lower than He — suggests inbreeding, population subdivision, or non-random mating, all of which reduce the actual rate of heterozygous offspring below the random-mating expectation.
  • Ho close to He — consistent with a randomly mating population near Hardy-Weinberg equilibrium at that locus.
  • Ho notably higher than He — can indicate heterozygote advantage (overdominance) or outbreeding between genetically distinct subpopulations.

Where This Calculation Matters

  • Conservation genetics — low observed heterozygosity relative to expectation is a standard early warning sign of a shrinking, inbreeding population.
  • Marker validation in genotyping studies — a large Ho/He gap at a specific marker can flag technical genotyping errors rather than real biology.
  • Evolutionary biology research — heterozygosity comparisons across loci help detect regions of the genome under selection.

How to Use This Calculator

  1. Enter the number of heterozygous individuals in the sample.
  2. Enter the total number of individuals sampled.
  3. Enter the allele frequency p (between 0 and 1).
  4. Select Calculate to get both observed and expected heterozygosity.

Related Calculations

Test the same population directly against equilibrium expectations with the Hardy-Weinberg Calculator, or derive p from raw genotype counts with the Allele Frequency Calculator.