What it does
After a genetic cross you count the offspring in each class, for example round-yellow, round-green, wrinkled-yellow and wrinkled-green. Mendel’s laws predict a ratio, such as 9:3:3:1 for two independent genes. Real counts never match a ratio exactly, so the question is whether the difference is small enough to be chance. This page answers it with the chi-square goodness-of-fit test and, if you like, an exact test.
How to use it
-
Expected ratio: pick one of the classic ratios:
- 3:1 (one gene, dominant)
- 1:2:1 (incomplete dominance)
- 1:1 (test cross)
- 9:3:3:1 (two genes)
- 1:1:1:1 (two-gene test cross)
- 9:3:4 (recessive epistasis)
- 12:3:1 (dominant epistasis)
- 9:7 (complementary genes)
- 15:1 (duplicate genes)
Or type your own in the Ratio box. Any positive parts work, such as 2:1 for a lethal allele.
-
Class names: fill in automatically for each ratio; rename them to your phenotypes.
-
Observed counts: one count per class, in the same order as the ratio.
-
Significance level: usually 0.05. A p-value below it means the ratio does not fit.
-
Exact test: a binomial test for two classes or a multinomial test for more. It needs no large-sample approximation. It is skipped automatically when there are more than 40 million possible outcomes; at that size chi-square is reliable anyway.
What you get
- χ², the degrees of freedom (classes − 1), the p-value, the critical value and the exact-test p-value.
- A table for each class: expected count, O − E, its contribution (O − E)²/E, its share of χ² and the residual (O − E)/√E. Together these show which classes drive the result.
- A warning when an expected count is below 5, the usual limit for trusting the chi-square p-value.
- A bar chart of observed against expected counts, and downloads: CSV, plus a report as image, PDF or Word.
Worked example
The made-up dihybrid cross has 290, 102, 95 and 33 offspring (520 in all). For 9:3:3:1 the expected counts are 292.5, 97.5, 97.5 and 32.5. That gives χ² = 0.301 with 3 degrees of freedom and p = 0.960, well under the critical value of 7.81, so the counts fit 9:3:3:1. The exact multinomial test agrees (p = 0.955). The biggest contributor is A_bb (4.5 more than expected), with 69 % of χ².
Now type 15:1 with counts 70 and 10. Then χ² = 5.33 and p = 0.0209, which rejects the ratio at 0.05. But the exact binomial test gives p = 0.033: still significant, but less extreme, because 5 expected recessives is a small count.
Tips
- Use counts, never percentages: the test depends on how many individuals you counted.
- If a class has an expected count below 5, trust the exact test, or merge it with a similar class and use a ratio with fewer classes.
- A p-value far above 0.05 does not prove the ratio. It only means these counts cannot tell it apart from the truth; another ratio may fit too.
FAQ
Why classes − 1 degrees of freedom? Once the total is fixed, the last class follows from the others. The ratio itself is given in advance, not estimated from the data.
What about genotype counts in a natural population? For Hardy-Weinberg proportions, where the allele frequency is estimated from the same data, use a Hardy-Weinberg test (1 degree of freedom for two alleles).
Is anything uploaded? No. Everything runs in your browser.
Where the numbers come from
- Pearson's chi-square goodness-of-fit test (K. Pearson 1900) and the exact multinomial test (the probability of every outcome no more likely than the one observed). Classic ratios from Mendelian genetics and gene interaction (epistasis), general textbook facts. Formulas only; no tables are copied.
- Checked in the tests against SciPy: scipy.stats.chisquare for the statistic and p-value in nine crosses, scipy.stats.binomtest for two classes, and an independent Python enumeration of every multinomial outcome for three or four classes (agreement to 1e-8).
- The example counts are made up.
Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.
Last updated 2026-11-09.