From a Count Table to a Test Conclusion
A one-way Pearson goodness-of-fit test compares the observed counts in one categorical variable with the counts predicted by a specified probability model. Completing the test means more than calculating one statistic: you must also check whether the chi-square approximation is appropriate, identify the degrees of freedom, find the right-tail p-value, and state what the result says about the proposed distribution.
The procedure starts with a null model that assigns a probability to each possible category. The test asks whether the observed differences between counts and model predictions are large enough to provide evidence against that model. The calculations below use examples in which the null probabilities are given in advance.
The Calculations
Let \(O_i\) be the observed count in category \(i\). If the null probability for that category is \(p_i\), its expected count is \(E_i=np_i\). The expected count is the model's average predicted count over repeated samples of size \(n\); it need not be a whole number.
The Pearson chi-square statistic adds a squared, expected-count-scaled discrepancy for each category. Larger values indicate that the observed counts, taken together, are farther from the counts predicted by \(H_0\).
The expected-count formula follows directly from the model. For each observation, define an indicator that equals 1 if it falls in category \(i\), and 0 otherwise. The observed count \(O_i\) is the sum of these \(n\) indicators. Each indicator has expected value \(p_i\), so by adding expected values,
Thus the expected counts depend on the sample size and the probabilities specified by \(H_0\), not on how the observed counts happen to be distributed.
Check that the categories are complete and that the probabilities sum to 1.
For each category, multiply the total sample size by its null probability.
Confirm independent observations and adequate expected counts for the chi-square approximation.
Substitute every observed and expected count into the Pearson formula; use \(df=k-1\) for fixed probabilities.
Use the right tail of the chi-square distribution, then compare the p-value with the chosen significance level \(\alpha\).
Worked Tests
Worked Example: Three Response Categories
A hypothetical campus dining service proposes that students choose three lunch options with probabilities 0.50, 0.30, and 0.20. In a sample of 100 independent students, the observed counts are 56, 26, and 18. Test the proposed distribution at \(\alpha=0.05\).
Expected counts and conditions. Under \(H_0\), the expected counts are \(100(0.50)=50\), \(100(0.30)=30\), and \(100(0.20)=20\). They sum to 100, and each is at least 5. Assuming each sampled student contributes one response and students' responses are independent, the chi-square approximation is appropriate.
Statistic and degrees of freedom. There are \(k=3\) categories, so \(df=3-1=2\). Substituting the counts gives
P-value and conclusion. For a chi-square distribution with 2 degrees of freedom, the right-tail probability at 1.453 is approximately 0.484. Since \(0.484>0.05\), do not reject \(H_0\). These data do not provide statistically significant evidence that the distribution of lunch choices differs from the proposed probabilities. This result does not prove that the probabilities are exactly correct.
Worked Example: A Second Three-Category Model
In a hypothetical inventory check, a supplier claims that items are distributed among three grades with probabilities 0.40, 0.35, and 0.25. A random sample of 120 items contains 38, 50, and 32 items in the respective grades. Carry out the test at \(\alpha=0.05\).
Expected counts and conditions. The expected counts are \(120(0.40)=48\), \(120(0.35)=42\), and \(120(0.25)=30\). Each exceeds 5. If the sampled items are independent and each is classified into exactly one of the three grades, the conditions for the approximation are met.
Statistic and degrees of freedom. With \(k=3\), \(df=2\). The calculation is
P-value and conclusion. The right-tail probability for \(\chi^2=3.740\) with 2 degrees of freedom is approximately 0.154. Because \(0.154>0.05\), do not reject \(H_0\). The sample does not provide statistically significant evidence that the grade distribution differs from the supplier's stated probabilities.
Worked Example: Four Categories and a Small P-Value
A hypothetical equipment manufacturer specifies that a particular setting should produce four outcomes with probabilities 0.10, 0.20, 0.30, and 0.40. Among 200 independent trial runs, the observed counts are 38, 35, 65, and 62. Test the specified model at \(\alpha=0.05\).
Expected counts and conditions. The expected counts are \(200(0.10)=20\), \(200(0.20)=40\), \(200(0.30)=60\), and \(200(0.40)=80\). They sum to 200 and are all at least 5. With one independent outcome per trial and exactly one of the four categories recorded, the usual calibration is suitable.
Statistic and degrees of freedom. Here \(k=4\), so \(df=4-1=3\). Then
P-value and conclusion. With 3 degrees of freedom, the right-tail probability at 21.292 is approximately 0.00009. This is below 0.05, so reject \(H_0\). The observed outcome distribution provides strong evidence that the trial outcomes do not follow the manufacturer's specified probabilities. The test does not, by itself, identify which category or categories account for the mismatch.
Reporting the Result Carefully
A complete report connects the calculation to the question being asked. Include the test statistic, degrees of freedom, p-value, decision at the stated \(\alpha\), and a conclusion naming the distribution or category probabilities in context. For example: “A Pearson goodness-of-fit test gave \(\chi^2=3.740\), \(df=2\), and \(p=0.154\). At the 0.05 significance level, the data do not provide sufficient evidence that the grade distribution differs from the supplier's proposed probabilities.”
The p-value is calculated from the null reference distribution: it is the probability, assuming \(H_0\) and the test conditions, of obtaining a chi-square statistic at least as large as the observed statistic. It is not the probability that \(H_0\) is true. The comparison with \(\alpha\) gives the test decision; the contextual sentence states what that decision means for the scientific or practical question.
Common Mistakes
- Using observed counts to set the expected counts. Expected counts come from \(np_i\) under the null model. Replacing them with the observed counts would erase the comparison the test is designed to make.
- Forgetting the denominator in a contribution. Each squared difference is divided by its expected count, not by the observed count and not by the total sample size.
- Using the wrong degrees of freedom. For a fixed probability model with \(k\) categories, use \(k-1\), not \(n-1\) and not \(k\).
- Using the left tail for the p-value. Large chi-square values indicate greater disagreement with \(H_0\), so the p-value is the probability in the right tail at or beyond the observed statistic.
- Claiming that a non-significant result confirms the model. Failure to reject \(H_0\) means the sample did not provide sufficient evidence against it; it does not establish that the model is exactly true.
- Ignoring the sampling conditions. A correct arithmetic result does not guarantee a valid chi-square approximation. Check how observations were obtained and whether expected counts are adequate.
Check Your Understanding
For each question, identify the calculation or reasoning that completes the test correctly.
- A null model assigns probabilities 0.25 and 0.75 to two categories, and the sample size is 80. What are the expected counts?
- A test has five categories and fixed null probabilities. What degrees of freedom should be used?
- In a category, \(O_i=24\) and \(E_i=20\). What is its contribution to the Pearson statistic?
- For a test statistic of 4.2 with 2 degrees of freedom, should the p-value be taken from the left or right tail? Explain briefly.
- A test gives \(p=0.12\) at \(\alpha=0.05\). Write a conclusion that does not claim the null model has been proved.