Chi-Square Test (Goodness of Fit)
The chi-square goodness-of-fit test checks whether observed frequencies (e.g. the phenotypes of a cross) are compatible with the frequencies expected under a hypothesis (e.g. a Mendelian segregation ratio).
Free · no credit card · in your study plan in 2 minutes
Formula
\chi^2 = \sum \frac{(B - E)^2}{E}Variables & units – Chi-Square Test (Goodness of Fit)
| Symbol | Meaning | Unit |
|---|---|---|
| χ² | Test statistic (sum of the weighted squared deviations) | – (dimensionless) |
| B | observed frequency of a class | count |
| E | expected frequency of that class (from the hypothesis) | count |
| df | degrees of freedom = number of classes − 1 | – (dimensionless) |
Derivation & background – Chi-Square Test (Goodness of Fit)
Karl Pearson introduced the test in 1900. You compare the computed χ² value with a critical value from the chi-square table for the appropriate degrees of freedom df and a significance level (usually α = 5 %). If χ² is smaller than the critical value, the null hypothesis (observed = expected) is kept; if χ² is larger, it is rejected. In genetics this checks whether a cross follows the expected ratio (3:1, 9:3:3:1). For a ratio with k classes, df = k − 1.
Exam blueprint
Validity range
Applies as a goodness-of-fit test for counted frequencies in disjoint classes with sufficiently large expected values (rule of thumb E ≥ 5).
Derivation steps
For each class you measure the deviation observed minus expected, square it and divide by the expected value.
- 1Compute the expected value E per class from the hypothesis and form (B − E)²/E.
- 2Sum over all classes to χ² and compare with the critical value for df = classes − 1.
Rearrangements
Degrees of freedom for the goodness-of-fit test
k is the number of classes; only with estimated parameters do you subtract more.
Contribution of a single class
Shows which class contributes most to the deviation.
Task variant
100 offspring, expected ratio 3:1. Observed: 80 dominant, 20 recessive. Does the 3:1 ratio fit?
E = 75 and 25. χ² = (80−75)²/75 + (20−25)²/25 = 25/75 + 25/25 = 0.333 + 1.000 = 1.333. df = 1, critical 3.84. Since 1.333 < 3.84, the 3:1 ratio is kept.
Dihybrid cross, 160 offspring, expected 9:3:3:1. Observed: 95, 30, 27, 8. Is the deviation significant?
E = 90, 30, 30, 10. χ² = 25/90 + 0/30 + 9/30 + 4/10 = 0.278 + 0 + 0.300 + 0.400 = 0.978. df = 3, critical 7.81. Since 0.978 < 7.81, the deviation is not significant.
Common mistakes
Using percentages instead of absolute counts.
χ² needs counted frequencies; expected counts come from ratio · total number.
Determining the degrees of freedom incorrectly.
For a plain goodness-of-fit test df = classes − 1, not the total number of individuals.
Interpreting a small χ² as proof of the hypothesis.
The test can only keep or reject the null hypothesis, never prove it.
Confusing the direction in the significance comparison.
Only when χ² exceeds the critical value is the hypothesis rejected.
Exam context
- Typical in advanced genetics: testing cross results against a Mendelian ratio (3:1, 9:3:3:1).
These mistakes cost points in real exams. The set drills them until they stick.
Formula cluster
Statistics in biology
Connects genetics, probability and hypothesis testing.
Worked example
Monohybrid cross, 100 offspring, expected 3:1 → E = 75 dominant, 25 recessive. Observed: B = 80 dominant, 20 recessive. χ² = (80−75)²/75 + (20−25)²/25 = 25/75 + 25/25 = 0.333 + 1.000 = 1.333. df = 2 − 1 = 1, critical value χ²(0.05; 1) = 3.84. Since 1.333 < 3.84, the deviation is not significant and the 3:1 ratio is kept.
Applications
Genetics (testing segregation ratios), ecology (distribution tests), quality control, any test of frequencies against an expected pattern
Quanta exam set
Curated exam set for "Chi-Square Test (Goodness of Fit)":
Question (front)
Which formula describes Chi-Square Test (Goodness of Fit)?
Answer in your set
Question (front)
How do you rearrange χ² = Σ (B − E)² / E for Degrees of freedom for the goodness-of-fit test?
Answer in your set
Question (front)
Which common mistake happens with Chi-Square Test (Goodness of Fit)?
Answer in your set
+ 7 more cards: units, variables, derivation, example, exam task
These 10 cards are ready. One click and they sit in your deck, FSRS schedules the reviews until exam day.
Scientific sources
Common notations & search queries
Related formulas
More Biology formulas
Frequently asked questions about Chi-Square Test (Goodness of Fit)
How do you carry out a chi-square test in genetics?+
First you state the null hypothesis, for example that a cross follows the 3:1 ratio. From it you compute for each phenotype class the expected number E as ratio times total. Then for each class you form (B − E)²/E from the observed number B and expected number E and sum all contributions to the test value χ². You compare it with the critical value from the chi-square table for the degrees of freedom df = classes − 1 and the level α = 5 %. Example: 100 offspring, expected 75:25, observed 80:20 gives χ² = 25/75 + 25/25 = 1.333. At df = 1 the critical value is 3.84. Since 1.333 is smaller, the 3:1 ratio is kept.
How do you determine the degrees of freedom in the chi-square test?+
In the goodness-of-fit test the degrees of freedom are df = number of classes minus 1. Testing a monohybrid ratio with two phenotype classes gives df = 2 − 1 = 1. For the dihybrid 9:3:3:1 ratio with four classes, df = 4 − 1 = 3. The subtraction of 1 arises because the total is fixed: if all classes but one are known, the last follows automatically. The degrees of freedom determine which row of the chi-square table applies and thus the critical value. A common mistake is to use the total number of individuals as degrees of freedom. If parameters are additionally estimated from the data, you subtract one further degree of freedom per estimated parameter, which does not occur in the pure ratio test of genetics.
What does the critical value 3.84 mean in the chi-square test?+
The value 3.84 is the critical chi-square value for one degree of freedom and a significance level of 5 %. It marks the boundary from which a deviation is considered meaningful. If the calculated χ² value is below 3.84, the deviation between observed and expected frequencies is compatible with chance, and the null hypothesis is kept. If it is above, the deviation is so large that it would be purely random with a probability under 5 %, and you reject the hypothesis. Other degrees of freedom have other values, such as 5.99 at df = 2 or 7.81 at df = 3. You always read the appropriate value from the chi-square table for your own degrees of freedom and the chosen level.
Why do you divide by the expected value in the chi-square test?+
Dividing by the expected value E weights each deviation relative to its expected size. A deviation of 10 individuals matters strongly for an expected class of 20, but hardly for an expected class of 1000. Without the division, large classes would dominate the test value simply by their size, even though their relative deviation is small. Through (B − E)²/E all classes are made comparable: each contribution measures how strongly the class deviates relative to its expectation. Squaring additionally ensures that positive and negative deviations do not cancel and that larger deviations count disproportionately more. This yields a fair overall measure of goodness of fit across all classes.
What does a significant result in the chi-square test indicate?+
A significant result, that is a χ² value above the critical value, means the observed frequencies deviate so strongly from the expected that pure chance is unlikely. In genetics this means the cross probably does not follow the assumed ratio. Possible causes are gene linkage, incomplete dominance, lethal factors or an unfavourable sample. It is important that the test only checks compatibility with a hypothesis and gives no reason; the biological interpretation must be added by you. A non-significant result does not prove the hypothesis, it only shows that the data do not contradict it. The test can therefore reject or keep a hypothesis, but never confirm it definitively.
Retain Chi-Square Test (Goodness of Fit) for exams
Create a curated FSRS exam set for χ² = Σ (B − E)² / E: formula recall, variables, derivation, rearrangement, worked example, common mistakes and exam context.
Free · curated formula set · LaTeX · FSRS spaced repetition
How do you calculate with Chi-Square Test (Goodness of Fit)?
Here is how to work through a typical Chi-Square Test (Goodness of Fit) (χ² = Σ (B − E)² / E) task step by step:
- 1
Task
100 offspring, expected ratio 3:1. Observed: 80 dominant, 20 recessive. Does the 3:1 ratio fit?
Solution path
E = 75 and 25. χ² = (80−75)²/75 + (20−25)²/25 = 25/75 + 25/25 = 0.333 + 1.000 = 1.333. df = 1, critical 3.84. Since 1.333 < 3.84, the 3:1 ratio is kept.
- 2
Task
Dihybrid cross, 160 offspring, expected 9:3:3:1. Observed: 95, 30, 27, 8. Is the deviation significant?
Solution path
E = 90, 30, 30, 10. χ² = 25/90 + 0/30 + 9/30 + 4/10 = 0.278 + 0 + 0.300 + 0.400 = 0.978. df = 3, critical 7.81. Since 0.978 < 7.81, the deviation is not significant.