Mathovore, everything you need to succeed in math: Common Core lessons, worksheets, tests and quizzes
Skip to content

Chi-Square Test

Chi-Square Test – definition and example, AP Statistics math glossary – Mathovore

Key takeaway: A chi-square test checks whether category counts in a sample match what a null hypothesis predicts, flagging a mismatch when the gaps are bigger than random sampling would usually create.

Grade 12 – AP StatisticsAP Statistics Unit 3Statistics and Data

Definition of Chi-Square Test

Definition

A chi-square test works with counts of categorical data. The goodness-of-fit version asks whether one variable follows a claimed distribution. The independence and homogeneity versions use a two-way table to ask whether two variables are related, or whether groups share one distribution.

For each category, find the expected count under the null hypothesis, then measure how far the observed count is from it. Big gaps make a big statistic, and a big statistic means a small p-value. The data must be random, and every expected count should reach 5.

Formula and notation

The statistic adds one term per category (or table cell):

\[ \chi^2=\sum\frac{(\text{observed}-\text{expected})^2}{\text{expected}}. \]

For goodness of fit, the degrees of freedom are the number of categories minus 1. The test is always right-tailed.

04812observed 3.33critical 7.8155%df = 3
The observed statistic 3.33 falls well short of the critical value 7.815, so it is not unusual under the null hypothesis.

Key facts

  • Use counts, never percentages, when running a chi-square test.
  • The statistic is never negative, and its curve is skewed right.
  • Larger degrees of freedom push the typical value of the statistic higher.
  • A significant result says the pattern differs from the claim, not which category differs most.

Chi-Square Test example

Problem

A bag claims to hold equal numbers of four candy colors. In a bag of 60 pieces there are 21 red, 14 blue, 13 green and 12 yellow. Test the claim at the 5% level.

  1. Expected count per color under equal shares: \(\frac{60}{4}=15\). All expected counts exceed 5.

  2. Differences squared: \((21-15)^2=36\), \((14-15)^2=1\), \((13-15)^2=4\), \((12-15)^2=9\).

  3. Statistic: \(\chi^2=\frac{36+1+4+9}{15}=\frac{50}{15}\approx 3.33\), with \(df=3\).

  4. The critical value at the 5% level is 7.815, and the p-value is about 0.34.

Since \(3.33\lt 7.815\), fail to reject the null hypothesis: the counts are consistent with equal color shares.

Common mistake

Watch out

A student uses proportions, such as \(\frac{(0.35-0.25)^2}{0.25}\), for each color and gets a statistic of 0.2 instead of the correct value.

Why it is wrong

The formula is built for counts, because the size of the sample is part of the evidence. Percentages hide the sample size and shrink the statistic by a factor of n. Convert back to observed and expected counts before running any chi-square test.

Related terms and lessons

Browse the glossary: A–Z list · AP Statistics vocabulary · Statistics and Data

Rate this page