Chi-Square Statistic
Tests goodness of fit between observed and expected counts.
Formula
Variables
Example
Larger = worse fit
How it works
The chi-square statistic measures how far a set of observed counts is from the counts you would expect if a model were true. Each category’s difference is squared so positive and negative deviations do not cancel, and dividing by the expected count scales the error so a mismatch of 10 is more serious when you expected 5 than when you expected 500. Summing across categories gives one overall measure of discrepancy: small values mean the data are close to the model, while large values suggest the model fits poorly.
When to use it
Use this when you have categorical count data and want to check whether the distribution matches a claimed pattern, such as a fair die, a Mendelian ratio, or a survey expectation. It is also used as the test statistic in chi-square goodness-of-fit tests and in other chi-square procedures that compare observed and expected frequencies.
Worked example, step by step
Suppose a genetics experiment predicts a 1:2:1 ratio for three phenotypes in 80 offspring. Expected counts: 20, 40, 20 Observed counts: 14, 46, 20 Compute each term: (14 - 20)^2 / 20 = 36/20 = 1.8 (46 - 40)^2 / 40 = 36/40 = 0.9 (20 - 20)^2 / 20 = 0/20 = 0 Add them up: χ² = 1.8 + 0.9 + 0 = 2.7 Final answer: χ² = 2.7
Common mistakes to avoid
- using percentages instead of counts
- forgetting to square the deviations before dividing
- adding expected values to the statistic instead of summing the category-by-category chi-square terms
Did You Know?
The chi-square test, devised by Karl Pearson in 1900, checks whether observed counts match what theory predicts.
Share this formula
More in Statistics & Probability
View allArithmetic Mean
BasicThe average of a data set.
Median
BasicThe middle value separating the higher and lower halves.
Variance
IntermediateAverage squared deviation from the mean.
Standard Deviation
IntermediateSquare root of the variance; typical spread.
Z-Score
IntermediateNumber of standard deviations a value is from the mean.
Bayes' Theorem
IntermediateUpdates a probability given new evidence.