Topic 8.2 Notes – Setting Up a Chi-Square Goodness of Fit Test
What a Chi-Square Goodness-of-Fit Test Is
A chi-square goodness-of-fit (GOF) test compares your observed counts from a sample to the expected counts you would get if a claimed distribution were true.
You use it when:
- There is one categorical variable
- There are two or more categories
- You’re testing a claimed distribution of proportions
Example situations:
- A cereal company claims flavors are distributed 20%, 30%, 25%, 25%.
- A die is claimed to be fair (each face 1/6).
- A school claims grade levels are evenly distributed.
If there are only two categories and you're testing a single proportion, that’s a 1-proportion z test, not chi-square.
If you're comparing two categorical variables, that’s a chi-square test of independence, which is a different setup.
Parameters
The parameters are the true population proportions:
These must add to 1. Each represents the true proportion in a specific category.
Expected Counts and the Chi-Square Statistic
The whole test is built around comparing what you saw to what you would expect under .
Expected Counts
For each category:
If a sample of 200 customers is tested against a claim that 40% prefer vanilla, the expected number preferring vanilla is:
Expected counts are based entirely on:
- Sample size
- Claimed proportions from
They are not based on what you actually observed.
The Chi-Square Statistic
The test statistic measures how far observed counts are from expected counts:
- Big differences between observed and expected → large
- Small differences → small
- Always 0 or positive (because of squaring)
Large values fall in the right tail of the distribution and give small p-values.
Chi-Square Distributions
The chi-square statistic follows a chi-square distribution, which has some unique features:
- Continuous
- Only positive values
- Skewed right
- Shape depends on degrees of freedom
For a GOF test:
Here’s how the distribution changes as degrees of freedom increase:
Chi-square distributions for df = 1, 4, and 10
With , the distribution is very right-skewed and concentrated near 0. As increases to 4 and then 10, the curve becomes less skewed and more spread out, though it is always right-skewed and stays above 0.
Hypotheses for a GOF Test
Null Hypothesis
Lists the claimed proportion for each category.
Example (favorite season survey):
Each must be clearly defined in context. On a free-response question, you would say what each proportion represents.
Alternative Hypothesis
At least one of the population proportions differs from the stated value.
Important:
- Do not say “all are different.”
- Do not compare categories to each other.
- You are testing the overall distribution, not pairwise differences.
Conditions for Inference
All three must be satisfied.
1. Random
Data come from:
- A random sample, or
- A randomized experiment
Quote the wording if possible.
2. Independence
If sampling without replacement:
The population must be at least 10 times the sample size.
3. Large Counts
All expected counts must be:
You check this using expected counts, not observed counts. This ensures the chi-square distribution is a good model.
Identifying the Correct Test
When you read a problem, ask:
- Is there one categorical variable?
- Are we testing whether the distribution matches a claim?
If yes → chi-square GOF.
Students often misidentify the test when there are only two categories. If it says “Is the proportion different from 0.60?” and there are only two outcomes, that’s a 1-proportion z test.
Key Takeaways
Chi-Square Goodness-of-Fit Test
A test for whether one categorical variable matches a claimed distribution of proportions.
Chi-Square Statistic
The sum of squared observed-minus-expected differences divided by expected counts across all categories.
Degrees of Freedom for Goodness of Fit
The number of categories minus 1, which determines the specific chi-square distribution used.
Null and Alternative Hypotheses for Goodness of Fit
Null: all category proportions equal stated values; alternative: at least one true proportion differs.
Distribution of Proportions for One Categorical Variable
The set of population proportions across all categories of a single categorical variable.
Independence Condition for Goodness of Fit
Use a random sample or randomized experiment, and if sampling without replacement, require n over N at most 0.10.
Large Counts Condition for Goodness of Fit
All expected counts should be at least 5 for the chi-square approximation to be reliable.
Parameter in a Goodness-of-Fit Test
The true population proportion for each category of the categorical variable being studied.
Expected Count
The predicted category count under the null hypothesis, found by multiplying n by p.
Chi-Square Distribution
A right-skewed distribution of positive values that becomes less skewed as degrees of freedom increase.
Observed Count
The actual number of observations recorded in a category from the sample.
Notes
Chi-Square Goodness-of-Fit Test
A test for whether one categorical variable matches a claimed distribution of proportions.
Chi-Square Statistic
The sum of squared observed-minus-expected differences divided by expected counts across all categories.
Degrees of Freedom for Goodness of Fit
The number of categories minus 1, which determines the specific chi-square distribution used.
Null and Alternative Hypotheses for Goodness of Fit
Null: all category proportions equal stated values; alternative: at least one true proportion differs.
Distribution of Proportions for One Categorical Variable
The set of population proportions across all categories of a single categorical variable.
Independence Condition for Goodness of Fit
Use a random sample or randomized experiment, and if sampling without replacement, require n over N at most 0.10.
Large Counts Condition for Goodness of Fit
All expected counts should be at least 5 for the chi-square approximation to be reliable.
Parameter in a Goodness-of-Fit Test
The true population proportion for each category of the categorical variable being studied.
Expected Count
The predicted category count under the null hypothesis, found by multiplying n by p.
Chi-Square Distribution
A right-skewed distribution of positive values that becomes less skewed as degrees of freedom increase.
Observed Count
The actual number of observations recorded in a category from the sample.