Chi-Square Goodness-of-Fit Test for a Single Categorical Variable

The chi-square goodness-of-fit (GOF) test checks whether the observed counts in the categories of one categorical variable, measured on one simple random sample, match a set of hypothesized proportions. State H0 as the claimed category proportions and Ha as at least one population proportion differing; these may be written in words or mathematical notation.


  • H0H_0: the population proportions in each category equal the stated values.
  • HaH_a: at least one population proportion differs from the stated value.
Observed vs. expected number of customers choosing each of five chip flavors (n = 200), tested against the hypothesis of equal preference (20% each).

Observed vs. expected number of customers choosing each of five chip flavors (n = 200), tested against the hypothesis of equal preference (20% each).

Chip flavor preference study (n = 200)

Chip flavor preference study (n = 200)

Key equations

For each category compute the expected count using Ei=npiE_i = n p_i, where nn is the total sample size and pip_i is the hypothesized proportion. The test statistic is


χ2=∑i=1k(Oi−Ei)2Ei\chi^2 = \sum_{i=1}^{k} \frac{(O_i - E_i)^2}{E_i}


with degrees of freedom df=k−1df = k-1, where kk is the number of categories (assuming no parameters were estimated from the data). Compare χ2\chi^2 to a critical value from the chi-square table, or compute a p-value; reject H0H_0 if χ2\chi^2 is large enough.

Worked example

Suppose a six-sided die is rolled n=60n=60 times to test fairness, so pi=1/6p_i = 1/6 and Ei=10E_i = 10 for every face. The observed counts are 8, 9, 15, 7, 11, 10. Then


χ2=(8−10)210+(9−10)210+(15−10)210+(7−10)210+(11−10)210+(10−10)210=4.00\chi^2 = \frac{(8-10)^2}{10}+\frac{(9-10)^2}{10}+\frac{(15-10)^2}{10}+\frac{(7-10)^2}{10}+\frac{(11-10)^2}{10}+\frac{(10-10)^2}{10} = 4.00


With df=5df = 5, the critical value at α=0.05\alpha = 0.05 is 11.07. Since 4.00<11.074.00 < 11.07, we fail to reject H0; at α = 0.05, the data do not provide sufficient evidence that the die is unfair.



A researcher wants to test, using a chi-square goodness-of-fit test, whether a six-sided die is fair. Which pair of hypotheses is correctly stated for this test?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A quality-control manager wants to test whether monthly product returns are equally distributed among 6 product categories using a chi-square goodness-of-fit test. No parameters are estimated from the sample data. What is the correct number of degrees of freedom for this test?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A university claims that among its undergraduates, 25% are in Science, 20% in Arts, 15% in Engineering, 15% in Commerce, and 25% in other programs. In a random sample of 240 students, calculate the expected number of students who should be in Commerce if the university's claim is true.

Give your answer in students.

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors