| Category Name | Observed Count (O) | Expected Proportion (P) |
|---|
Total Observed Count (N) =
Calculated χ² =
Degrees of Freedom (df) =
For α = 0.01 (1%): χ²critical ≈
For α = 0.05 (5%): χ²critical ≈
For α = 0.10 (10%): χ²critical ≈
Note: Critical values are approximate.p =
The Chi-Square Goodness-of-Fit test checks whether the distribution of a single categorical variable matches a hypothesized (expected) distribution. Unlike the Test of Independence, which compares two variables against each other, this test compares your observed category counts against theoretical proportions you specify — for example, testing whether a die is fair, or whether survey responses match a company's historical distribution.
χ² = Σ [(O − E)² / E], where O is the observed count for each category and E is the expected count (total N × expected proportion). Degrees of freedom = k − 1, where k is the number of categories.
Suppose a die is rolled 60 times, with expected proportion 1/6 per face (E = 10 each), and observed counts: 8, 12, 7, 15, 9, 9. This gives χ² ≈ 4.4, df = 5, p ≈ 0.49. Since p > 0.05, we fail to reject H₀ — there's no significant evidence the die is unfair.
These two chi-square tests are often confused because they use the same formula and distribution, but they answer different questions. The Goodness-of-Fit test (this page) checks whether one categorical variable matches a hypothesized distribution — for example, "does this die roll each face equally often?" The Test of Independence checks whether two categorical variables are related to each other — for example, "is gender related to product preference?" If you have one variable and a theoretical expectation, use this page. If you have two variables and want to know if they're associated, use the Test of Independence instead.
When one or more categories have an expected count under 5, the chi-square distribution no longer approximates the test statistic well, and the resulting p-value may be inaccurate. Common solutions include combining adjacent categories with low expected counts into a single "Other" category, collecting more data to increase the total sample size, or using an exact test (such as a multinomial exact test) instead of the chi-square approximation when combining categories isn't appropriate for the research question.
Use the built-in chisq.test() function with observed counts and expected proportions:
observed <- c(8, 12, 7, 15, 9, 9)
expected_p <- rep(1/6, 6) # equal proportions
chisq.test(observed, p = expected_p)
Analyze → Nonparametric Tests → Legacy Dialogs → Chi-square. Move your categorical variable into the Test Variable List. Under Expected Values, choose "All categories equal" for uniform proportions, or "Values" to enter custom expected proportions or counts per category, then click OK.
Frequencies → Multinomial Test. Drag your categorical variable into the Factor box. Under Expected Proportions, either leave the default (equal proportions) or enter your own hypothesized proportions for each category, and JASP will output the χ² statistic, df, and p-value.