Chi-Square Calculator
Chi-square goodness of fit: compare observed counts with what you expected, and get χ², its degrees of freedom and the p-value.
Result
Chi-square statistic, χ²: 3
Exact arithmetic on the counts entered. The p-value relies on the chi-square approximation, which needs enough in each category.
- Degrees of freedom
- 4
- P-value
- 0.557825
- Compared with α
- p = 0.5578 is above α = 5%, so the result is not statistically significant at that level.
- Total observed
- 60
- Expected count in each category
- Monday 12, Tuesday 12, Wednesday 12, Thursday 12, Friday 12
- Each category’s (O − E)² ÷ E
- Monday 0.75, Tuesday 0, Wednesday 0.75, Thursday 0.75, Friday 0.75
https://calcgallery.com/statistics/chi-square-calculator/
Results follow the mathematical operation and values shown. Check that you selected the intended operation, convention and dataset type before relying on the result. Read the full disclaimer
How to use the Chi-Square Calculator
- Enter each category's name and how many times it was observed, one row per category.
- Choose what you expected. Equal is right for a fair die or evenly spread absences; proportions scale a ratio such as 9 to 3 to 3 to 1 to your total; counts are used exactly as typed.
- Read χ², its degrees of freedom and the p-value, and check the note for categories with too few expected.
The formula
χ² = Σ (O − E)² ÷ Edf = categories − 1 − parameters estimated from the datap = area to the right of χ² under the chi-square curve with df degrees of freedom
Each category adds (O − E)² ÷ E. Squaring treats shortfalls and excesses alike, and dividing by E means a gap of 5 counts for more where only 10 were expected than where 100 were.
Expected counts
With equal expectations every category expects the total divided by the number of categories. Proportions are divided by their own sum and multiplied by the observed total, so 9, 3, 3, 1 and 56.25%, 18.75%, 18.75%, 6.25% give the same result. Counts entered directly should add up to the observed total; if they do not, the page still calculates and tells you.
What the diagram shows
A solid bar for each observed count beside an outlined bar for its expected count. The larger the gaps, the larger χ².
With your numbers
- Monday: (15 − 12)² ÷ 12 = 0.75
- Tuesday: (12 − 12)² ÷ 12 = 0
- Wednesday: (9 − 12)² ÷ 12 = 0.75
- Thursday: (9 − 12)² ÷ 12 = 0.75
- Friday: (15 − 12)² ÷ 12 = 0.75
- χ² = 3 with 4 degrees of freedom
Quick reference
Exact arithmetic on the counts entered. The p-value relies on the chi-square approximation, which needs enough in each category.
| Example | Chi-square statistic, χ² |
|---|---|
| Absences 15, 12, 9, 9, 15, equal | 3 |
| A die rolled 60 times | 13.4 |
| 315, 108, 101, 32 against 9 : 3 : 3 : 1 | 0.47 |
| 50, 30, 20 against 50%, 30%, 20% | 0 |
| 40 and 60 against 50 and 50 | 4 |
| Four categories, one parameter estimated | 2 |
Common questions about the Chi-Square Calculator
- What does the chi-square goodness-of-fit test check?
- Whether counts spread across categories are consistent with a distribution you specified in advance: that a die is fair, that absences are spread evenly across the week, that offspring follow a 9 to 3 to 3 to 1 ratio. A small p-value says the observed counts are further from those expectations than chance usually produces.
- How are the degrees of freedom worked out?
- Categories minus one, because once all but one count is known the total fixes the last. Each parameter of the expected distribution that you estimated from the same data, such as a mean fitted to the counts, removes one more. Five days of absences with equal expectations give 4.
- Why do the expected counts need to be at least 5?
- The p-value comes from the chi-square distribution, which is an approximation that works when every expected count is large enough. OpenStax gives 5 as the minimum. Below that the page still calculates, but warns you; combining sparse categories is the usual remedy.
- Can I use this for a two-way table?
- No. This page is the one-variable goodness-of-fit test. A test of independence between two categorical variables needs a table of rows and columns with expected counts from the row and column totals, which this page does not take.