Fiveable

๐Ÿ“ŠAP Statistics Unit 8 Review

QR code for AP Statistics practice questions

8.3 Carrying Out a Chi Square Goodness of Fit Test

8.3 Carrying Out a Chi Square Goodness of Fit Test

Written by the Fiveable Content Team โ€ข Last updated June 2026
Verified for the 2027 exam
Verified for the 2027 examโ€ขWritten by the Fiveable Content Team โ€ข Last updated June 2026
๐Ÿ“ŠAP Statistics
Unit & Topic Study Guides

Previous Exam Prep

AP Cram Sessions 2021

Pep mascot

To carry out a chi-square goodness-of-fit test, calculate the test statistic with ฯ‡2=โˆ‘(Oโˆ’E)2E\chi^2 = \sum \frac{(O - E)^2}{E}, find degrees of freedom as the number of categories minus 1, get a p-value from the chi-square distribution, and compare that p-value to your significance level. A small p-value gives evidence that at least one stated proportion is not correct.

Why This Matters for the AP Statistics Exam

This topic is part of Unit 8, which is worth about 2 to 5 percent of the exam. Carrying out a goodness-of-fit test pulls together skills you have used all year: stating hypotheses, checking conditions, computing a test statistic, finding a p-value, and writing a conclusion linked to that p-value. You may need to show the full procedure with clear work, or read calculator and software output and interpret it correctly. Being precise with the formula, degrees of freedom, and conclusion language is important for clear exam work.

Key Takeaways

  • The test statistic is ฯ‡2=โˆ‘(Oโˆ’E)2E\chi^2 = \sum \frac{(O - E)^2}{E}, summed across every category.
  • Degrees of freedom equal the number of categories minus 1.
  • A ฯ‡2\chi^2 value near 0 supports the null hypothesis; a large value pushes you toward the alternative.
  • Find the p-value from the chi-square distribution using a table or technology, then compare it to your significance level ฮฑ\alpha.
  • A small p-value means you reject the null and conclude at least one stated proportion is not as specified.
  • Always write conclusions in context, and never "accept" the null hypothesis.

The Goodness-of-Fit Procedure

A chi-square goodness-of-fit test checks whether observed counts in one categorical variable match a set of proportions stated in the null hypothesis. By this point you have already set up hypotheses and checked conditions (see 8.2 Setting Up a Chi-Square Goodness of Fit Test). Now you finish the test with two main pieces: the test statistic and the p-value.

The full flow looks like this:

  1. Hypotheses: The null hypothesis specifies a proportion for each category. The alternative is that at least one of those proportions is not as specified.
  2. Significance level: Choose ฮฑ\alpha before looking at results. Common values are 0.10, 0.05, and 0.01.
  3. Test statistic: Calculate ฯ‡2\chi^2 using the formula below.
  4. Degrees of freedom: Number of categories minus 1.
  5. P-value: Find the probability of a ฯ‡2\chi^2 as large or larger than yours from the chi-square distribution.
  6. Decision: Compare the p-value to ฮฑ\alpha.
  7. Conclusion: State your decision in context.

Test Statistic

The chi-square statistic is:

ฯ‡2=โˆ‘(Observedโˆ’Expected)2Expected\chi^2 = \sum \frac{(\text{Observed} - \text{Expected})^2}{\text{Expected}}

For each category, subtract the expected count from the observed count, square that difference, and divide by the expected count. Add up the results across all categories to get your ฯ‡2\chi^2 value.

The logic is similar to z-scores and t-scores from earlier units. A ฯ‡2\chi^2 value close to 0 supports the null hypothesis, because the observed and expected counts are close. As the gap between observed and expected grows, ฯ‡2\chi^2 gets larger, which gives you stronger evidence that the stated proportions are off. That pushes you to reject the null in favor of the alternative.

Worked Example

Return to a happiness survey with this null hypothesis for how people rate their happiness:

  • 10% unhappy (1)
  • 15% somewhat unhappy (2)
  • 28% sometimes happy and sometimes sad (3)
  • 30% happy (4)
  • 17% always happy (5)

Take a random sample of 1000 people where 120 respond 1, 180 respond 2, 220 respond 3, 480 respond 4, and 0 respond 5.

To find ฯ‡2\chi^2:

  1. List the observed counts: 120, 180, 220, 480, 0.
  2. Subtract the expected counts: 100, 150, 280, 300, 170.
  3. Square each difference.
  4. Divide each squared difference by its expected count.
  5. Sum all five results.

A graphing calculator (TI-84 or similar) can run this for you, which is worth using to save time and avoid arithmetic mistakes.

Degrees of Freedom

Degrees of freedom equal the number of categories minus 1. The happiness scale has 5 categories, so you have 5โˆ’1=45 - 1 = 4 degrees of freedom. Degrees of freedom control the shape of the chi-square distribution you use to find the p-value.

P-Value

The p-value is the probability, assuming the null hypothesis and probability model are true, of getting a ฯ‡2\chi^2 statistic as extreme as or more extreme than the one you observed. In other words, it tells you how surprising your data would be if the stated proportions were correct.

Find the p-value using a chi-square table or technology, matching your test statistic with your degrees of freedom. The chi-square test is one-sided in the sense that only large ฯ‡2\chi^2 values count as extreme, so the p-value is the area to the right of your statistic.

A common shortcut: if your p is low, you reject the null hypothesis.

Worked Example

For the happiness data, the calculator output gives a p-value that is essentially 0. That very small p-value means data this far from the stated proportions would almost never happen by chance if the null hypothesis were true.

Conclusion

Compare your p-value to ฮฑ\alpha, just like in earlier hypothesis tests:

  • If the p-value is less than ฮฑ\alpha, reject the null hypothesis. You have convincing evidence for the alternative.
  • If the p-value is greater than or equal to ฮฑ\alpha, fail to reject the null hypothesis. You do not have convincing evidence for the alternative.

Two reminders that matter for full credit:

  1. Never "accept" the null hypothesis. You either reject it or fail to reject it.
  2. Always include context.

For the happiness example, the p-value is about 0, which is less than 0.05, so you reject the null hypothesis. A clean conclusion sounds like this:

"Since our p-value (about 0) is less than 0.05, we reject the null hypothesis. We have convincing evidence that at least one of the proportions for how people rank on the happiness scale is not as stated."

How to Use This on the AP Statistics Exam

Free Response

If a problem asks you to carry out a goodness-of-fit test, show all four parts clearly: name the test, verify conditions, compute the statistic and p-value, and write a conclusion linked to the p-value. Write hypotheses in words tied to the population in the question. Even when a calculator gives you ฯ‡2\chi^2 and the p-value, show the setup so a reader can follow your reasoning.

MCQ

Multiple-choice items often test whether you can pick the right degrees of freedom (categories minus 1), match a ฯ‡2\chi^2 value to a p-value, or interpret a p-value correctly. Watch the relationship: larger gaps between observed and expected mean a larger ฯ‡2\chi^2 and a smaller p-value.

Common Trap

When the p-value is large, do not say the observed distribution "matches" or "equals" the expected distribution. The correct phrasing is that you do not have convincing evidence that the distribution differs from the stated proportions.

Common Misconceptions

  • "Accepting" the null hypothesis. A large p-value means you fail to reject the null, not that the null is proven true. You never accept it.
  • Using percentages instead of counts. The ฯ‡2\chi^2 formula uses observed and expected counts, not proportions or percentages. Convert proportions to expected counts first.
  • Wrong degrees of freedom. For goodness of fit, degrees of freedom are the number of categories minus 1, not the sample size minus 1.
  • Forgetting context. A conclusion without reference to the actual variable and population can cost you. Tie your decision back to the situation in the problem.
  • Checking the wrong condition for large counts. The large counts condition uses expected counts of at least 5, not observed counts.
  • Treating chi-square like a two-sided test. Only large ฯ‡2\chi^2 values are extreme, so the p-value is the area to the right of your statistic.

Vocabulary

The following words are mentioned explicitly in the College Board Course and Exam Description for this topic.

Term

Definition

chi-square distribution

A probability distribution used in chi-square tests, characterized by degrees of freedom and used to determine p-values for test statistics.

chi-square test

A statistical test used to determine whether observed frequencies of categorical data match expected frequencies based on a hypothesized distribution.

degrees of freedom

A parameter of the t-distribution that affects its shape; as degrees of freedom increase, the t-distribution approaches the normal distribution.

expected count

The theoretical frequency in each cell of a contingency table that would be expected if the null hypothesis of independence or homogeneity were true.

null distribution

The probability distribution of the test statistic under the assumption that the null hypothesis is true.

null hypothesis

The initial claim or assumption being tested in a hypothesis test, typically stating that there is no effect or no difference.

observed count

The actual frequency or number of observations in each cell of a contingency table from the collected data.

p-value

The probability of observing a test statistic as extreme as or more extreme than the one calculated from the sample data, assuming the null hypothesis is true.

probability model

A mathematical framework that describes the probability distribution of outcomes under specified assumptions.

reject the null hypothesis

The decision made when the p-value is less than or equal to the significance level, indicating sufficient evidence against the null hypothesis.

significance level

The threshold probability (ฮฑ) used to determine whether to reject the null hypothesis in a significance test.

significance test

A statistical procedure used to determine whether there is sufficient evidence to reject the null hypothesis based on sample data.

test statistic

A calculated value used to determine whether to reject the null hypothesis in a hypothesis test, computed from sample data.

theoretical distribution

A probability distribution based on a mathematical model, such as the normal distribution, used to approximate the distribution of a test statistic.

Frequently Asked Questions

What is the chi-square goodness-of-fit test formula?

The test statistic is chi-square = sum((Observed count - Expected count)^2 / Expected count) across all categories.

How do you find expected counts in a goodness-of-fit test?

Multiply the sample size by each proportion stated in the null hypothesis. Those products are the expected counts for each category.

What are the degrees of freedom for a chi-square goodness-of-fit test?

Degrees of freedom equal the number of categories minus 1. For example, five categories gives 4 degrees of freedom.

How do you find the p-value for a chi-square goodness-of-fit test?

Use a chi-square table, calculator, or software with the test statistic and degrees of freedom. The p-value is the area to the right of the chi-square statistic.

How do you interpret a chi-square goodness-of-fit p-value?

It is the probability, assuming the null hypothesis and model are true, of getting a chi-square statistic as large or larger than the observed value.

How do you conclude a chi-square goodness-of-fit test?

Compare the p-value to alpha. If p is less than alpha, reject the null; otherwise fail to reject. Then state the conclusion in context.

Pep mascot
Upgrade your Fiveable account to print any study guide

Download study guides as beautiful PDFs โ†’ See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Click below to go to billing portal โ†’ update your plan โ†’ choose Yearlyโ†’ and select "Fiveable Share Plan". Only pay the difference

Plan is open to all students, teachers, parents, etc
Pep mascot
Upgrade your Fiveable account to export vocabulary

Download study guides as beautiful PDFs โ†’ See example

Print or share PDFs with your students

Always prints our latest, updated content

Mark up and annotate as you study

Plan is open to all students, teachers, parents, etc
report an error
description

screenshots help us find and fix the issue faster (optional)

add screenshot