HS

Biology

Hardy-Weinberg Sampling Calculator

Calculate q, expected pp, pq, and qq shares and counts, observed sample p, and a binomial sampling standard-error reference.

Allele q frequency-
Expected pp share-
Expected pq share-
Expected qq share-
Sample size bounded by population-
Expected pp in effective sample-
Expected pq in effective sample-
Expected qq in effective sample-
Observed sample p frequency-
Finite-population correction-
Finite-population adjusted p standard error-

Decision view

Expected and observed genotype sample

Expected and observed genotype sampleExpected pp, pq, and qq counts are shown beside the separately entered observations.
Exact scenario comparisonSample size changes while all other entered assumptions remain constant.
Sample sizeAllele q frequencyExpected pp shareExpected pq shareExpected qq shareSample size bounded by populationExpected pp in effective sampleExpected pq in effective sampleExpected qq in effective sampleObserved sample p frequencyFinite-population correctionFinite-population adjusted p standard error

How to use Hardy-Weinberg Sampling Calculator

  1. Enter reference p and sample size.
  2. Enter the three observed genotype counts.
  3. Check expected shares sum to one.
  4. Compare expected and observed endpoints.

Calculator guide

Understanding Hardy-Weinberg Sampling Calculator

Hardy-Weinberg proportions provide an expected genotype composition from allele frequencies. A sample can differ from that expectation, so expected and observed counts must remain separate.

Reference p sets expected composition.
Expansion p² + 2pq + q² = 1.
Observation Counts reconstruct sample p.
Comparison Expected and observed stay distinct.

Calculation method

How the calculation works

Calculate expected genotype shares and counts from p and q, derive the observed sample allele frequency, and apply a finite-population correction to the binomial sampling-error reference. Use q = 1 − p, expand (p + q)² for genotype shares, multiply by sample size for expected counts, then count two p alleles in pp and one in pq for observed p.

Detailed calculation process

Compare expected genotype counts with the observed sample

The default uses p = 0.62, a 400-individual sample, and observed counts of 150 pp, 190 pq, and 60 qq.

General formula: q = 1-pP(pp) = p^2P(pq) = 2pqP(qq) = q^2E_g = nP(g)p_obs = [2n_pp+n_pq]/[2(n_pp+n_pq+n_qq)]SE(p) = sqrt[pq/(2n)] The binomial expansion gives genotype probabilities that sum to one. Expected counts use the entered reference p, while observed p is reconstructed from allele copies in the entered sample.

What each symbol means

p, q Reference frequencies of the two alleles (proportions).
P(pp), P(pq), P(qq) Expected genotype shares.
n Reference sample size used for expected counts (individuals).
E_g Expected count for genotype g (individuals).
n_pp, n_pq, n_qq Entered observed genotype counts (individuals).
p_obs Observed p allele frequency.
SE(p) Approximate sampling standard error of p.

Worked substitution with the default inputs

1. Complete the allele pair q = 1-0.62 = 0.38p+q = 1 The model assumes exactly two allele categories.
2. Calculate expected shares p^2 = 0.38442pq = 2(0.62)(0.38) = 0.4712q^2 = 0.1444 The shares reconcile: 0.3844 + 0.4712 + 0.1444 = 1.
3. Convert shares to counts E_pp = 400(0.3844) = 153.76E_pq = 400(0.4712) = 188.48E_qq = 400(0.1444) = 57.76 Expected counts need not be whole numbers.
4. Reconstruct observed p p_obs = [2(150)+190]/[2(150+190+60)]p_obs = 490/800 = 0.6125 Four hundred diploid individuals contribute eight hundred allele copies.
5. Calculate the sampling reference SE(p) = sqrt[(0.62)(0.38)/(2(400))] = 0.017161p_obs-p = -0.0075 The observed-reference gap is smaller than one displayed standard-error reference.

The default expected counts are 153.76 pp, 188.48 pq, and 57.76 qq; observed p is 0.6125 versus the entered 0.62.

Purpose-built visual

Compare genotype counts with a grouped dumbbell

Each genotype has one expected and one observed endpoint on the same count scale, while the allele-frequency reference stays in a separate summary.

Rows pp, pq, and qq.
Expected dots Hardy-Weinberg counts.
Observed dots Entered counts.
Gap Direct count difference.

Worked situations

Practical examples

  • Expected heterozygotes are 188.48.
  • Observed p is 0.6125.
  • Expected and observed counts use different information.

Better inputs

Useful tips

  • Validate genotype coding.
  • Use a formal goodness-of-fit test when inference is required.
  • Interpret population structure before attributing a deviation.

Before relying on the result

Limitations and common mistakes

  • Hardy-Weinberg assumptions may fail under selection, migration, mutation, nonrandom mating, drift, or structure.
  • The standard error is only an approximate reference.
  • This page does not perform a chi-square significance test.

Reference

Key terms

Allele frequency
Share of gene copies carrying an allele.
Genotype frequency
Share of individuals with a genotype.
Heterozygote
Individual carrying one p and one q allele.
Expected count
Sample size multiplied by expected share.

Important note

Calculated from the entered values using the displayed biological or statistical model. Study design, sampling, measurement quality, and biological variation affect interpretation.

Frequently asked questions

Why can expected counts be decimals?

They are probability-based averages, not literal partial individuals.

Must observed counts equal the sample-size field?

They should describe the intended sample; the observed-frequency denominator uses their actual sum.

Is a visible gap statistically significant?

Not necessarily; use an appropriate inferential test.

Why is heterozygote share 2pq?

pq and qp are the two allele-order combinations.