Test whether the counts in one categorical variable match the distribution you expected.
The chi-square goodness of fit test asks whether the frequencies of a single categorical variable follow a distribution you specify in advance. Typical questions are whether students choose three course formats equally often, whether a sample's ethnic make-up matches census proportions, or whether a die is fair. Unlike the chi-square test of independence, which relates two variables, the goodness of fit test looks at one variable and compares its observed counts with expected counts.
The test statistic sums, over all categories, the squared difference between observed and expected counts divided by the expected count. It is referred to a chi-square distribution with k − 1 degrees of freedom, where k is the number of categories. A significant result says the observed distribution departs from the expected one; the per-category table shows which categories drive the misfit.
In StatRyx the expected distribution can be equal across categories (the default), a set of proportions you state in your message (for example 35% : 45% : 20%), or a column of expected frequencies. A numeric measurement can also be grouped into bins first, using cut points you name. The result includes the observed and expected count for each category, each category's contribution to χ², and an APA 7 sentence.
The main assumption is that expected counts are large enough — a common rule is at least 5 in every category. Observations must be independent: each person or object is counted once.
| Format | Observed | Expected | Contribution to χ² |
|---|---|---|---|
| Hybrid | 52 | 50.0 | 0.08 |
| On campus | 30 | 50.0 | 8.00 |
| Online | 68 | 50.0 | 6.48 |
| Total | 150 | 150.0 | χ²(2) = 14.56, p < .001 |
A chi-square goodness of fit test showed that 150 students did not choose the three course formats equally often, χ²(2, N = 150) = 14.56, p < .001. Online was chosen more often than expected (68 vs 50) and on-campus less often (30 vs 50).
Yes. You can run it without an account (3 free analyses), and a free account adds 10 more — a one-time allowance, no payment needed. Every result includes the APA 7 write-up. Paid plans (Student from $9/month) add more analyses and Word, PDF and Excel export.
Goodness of fit looks at one categorical variable and compares its counts with a distribution you specify. The test of independence looks at two categorical variables and asks whether they are related, using a contingency table.
Give χ² with its degrees of freedom and N, then p: "χ²(2, N = 150) = 14.56, p < .001." State what the expected distribution was (equal, or the proportions you tested) and which categories were above or below expectation.
Yes. State the expected shares in your request, one per category in category order — for example 35% : 45% : 20%. StatRyx converts them to expected counts for your sample size.
The number of categories minus one. Three categories give df = 2.
Run a Chi-Square Goodness of Fit Test on your data →