Mathwords logoMathwords

Chi-Square Statistic — Definition, Formula & Examples

The chi-square statistic (also called the chi-square value) is a single number that measures how far a set of observed counts is from the counts you would expect if the null hypothesis were true. A value near 0 means the data fit the expectation well. A large value means the data fit poorly.

For kk categories with observed counts OiO_i and expected counts EiE_i computed under H0H_0, the chi-square statistic is χ2=∑i=1k(Oi−Ei)2Ei\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}. When H0H_0 is true and all expected counts are at least 5, χ2\chi^2 approximately follows a chi-square distribution. That distribution has k−1k-1 degrees of freedom in a goodness-of-fit test and (r−1)(c−1)(r-1)(c-1) degrees of freedom in a test of independence or homogeneity on an r×cr \times c table.

Key Formula

χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}
Where:
  • χ2\chi^2 = The chi-square statistic. It is always 0 or positive.
  • OO = Observed count in a category, taken from the data
  • EE = Expected count in that category, assuming the null hypothesis is true
  • ∑\sum = Add the term for every category or cell

Worked Example

Problem: A spinner has 3 equal sections: A, B, and C. You spin it 90 times and get A 40 times, B 25 times, and C 25 times. Compute the chi-square statistic to test whether the spinner is fair.
Step 1: Find the expected counts. If the spinner is fair, each section gets one third of the 90 spins.
E=903=30 for each sectionE = \frac{90}{3} = 30 \text{ for each section}
Step 2: Compute each category's contribution. Sections B and C have the same observed count, so they contribute the same amount.
A: (40−30)230=10030=103,B, C: (25−30)230=2530=56\text{A: } \frac{(40-30)^2}{30} = \frac{100}{30} = \frac{10}{3}, \qquad \text{B, C: } \frac{(25-30)^2}{30} = \frac{25}{30} = \frac{5}{6}
Step 3: Add the contributions to get the statistic.
χ2=103+56+56=206+106=5\chi^2 = \frac{10}{3} + \frac{5}{6} + \frac{5}{6} = \frac{20}{6} + \frac{10}{6} = 5
Step 4: Interpret the result. There are 3 categories, so there are 2 degrees of freedom. At the 0.05 significance level the critical value for 2 degrees of freedom is 5.991. Because 5 is less than 5.991, the result is not significant at that level. The p-value is about 0.082.
df=3−1=2,P(χ22≥5)≈0.082df = 3 - 1 = 2, \qquad P(\chi^2_2 \ge 5) \approx 0.082
Answer: The chi-square statistic is χ2=5\chi^2 = 5 with 2 degrees of freedom, and the p-value is about 0.082. At the 0.05 level you fail to reject the null hypothesis. The data do not give convincing evidence that the spinner is unfair.

Why It Matters

In AP Statistics, the chi-square statistic is the test statistic for all three chi-square tests: goodness of fit, homogeneity, and independence. Researchers use it to decide whether two categorical variables are related. Two common examples are a survey on voting preference by age group and a genetics cross checked against a predicted 3:1 ratio.

Common Mistakes

Mistake: Plugging percentages or proportions into the formula instead of counts. Another version of this error is dividing by the observed count instead of the expected count.
Correction: The formula only works with raw counts, and each term is divided by the expected count EE. If you start from percentages, convert them to counts first by multiplying each one by the sample size.

Related Terms