Math & Stats
Chi-Square Test Calculator
Enter observed and expected frequencies to compute the chi-square statistic, degrees of freedom, approximate p-value, and statistical conclusion.
Observed vs Expected Frequencies
Enter observed and expected frequencies and click Calculate
Chi-Square Formula
Chi-Square = Sum [(Observed - Expected)^2 / Expected]
Degrees of freedom: df = k - 1 (k = number of categories)
Decision rule:
If p-value < alpha -> Reject H0 (significant difference)
If p-value >= alpha -> Fail to reject H0 (no significant difference) FAQ
Frequently asked questions about chi-square tests
What is the chi-square test?
The chi-square test is a statistical test that determines whether observed frequencies differ significantly from expected frequencies. It measures how well observed data fits an expected distribution.
How do I calculate degrees of freedom?
For a goodness-of-fit test, degrees of freedom = number of categories − 1. For a test of independence with an r×c table, df = (rows − 1) × (columns − 1). More degrees of freedom means a larger chi-square value is needed to reject H₀.
What does the p-value mean in a chi-square test?
The p-value is the probability of observing a chi-square statistic as extreme as (or more extreme than) the calculated value, assuming the null hypothesis is true. If p < α (usually 0.05), you reject the null hypothesis.
When should I use a chi-square test?
Use chi-square when you have categorical data and want to test whether observed frequencies match expected frequencies (goodness of fit) or whether two categorical variables are independent (test of independence).
What are the assumptions of the chi-square test?
Key assumptions: (1) data must be frequencies/counts (not percentages), (2) categories are mutually exclusive, (3) expected frequency in each cell should be at least 5, (4) observations are independent.
What if my expected frequencies are less than 5?
If expected frequencies are below 5 in more than 20% of cells, the chi-square approximation may be unreliable. Consider combining categories, using Fisher's exact test, or collecting more data.