Chi-Square Goodness of Fit Test

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.

When to use the Chi-Square Goodness of Fit Test

When not to use it

Worked example

FormatObservedExpectedContribution to χ²
Hybrid5250.00.08
On campus3050.08.00
Online6850.06.48
Total150150.0χ²(2) = 14.56, p < .001

How to report it (APA 7)

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).

Frequently asked questions

Is the chi-square goodness of fit test free on StatRyx?

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.

What is the difference between goodness of fit and the test of independence?

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.

How do I report a chi-square goodness of fit test in APA 7?

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.

Can I test against proportions that are not equal?

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.

What are the degrees of freedom?

The number of categories minus one. Three categories give df = 2.

Run a Chi-Square Goodness of Fit Test on your data →

Related analyses