Chi-Square Calculator

Perform chi-square goodness-of-fit and independence tests.

Chi-Square goodness-of-fit test: compare observed vs expected frequencies

What Is the Chi-Square Calculator?

The Chi-Square Goodness-of-Fit Calculator tests whether observed frequencies differ significantly from expected frequencies. Enter your observed counts and the expected counts (based on a theoretical distribution or null hypothesis), and the tool computes the chi-square statistic, degrees of freedom, and a significance decision.

Formula

Chi-Square Statistic: χ² = Σ [(Observed − Expected)² / Expected] Degrees of freedom: df = number of categories − 1 Decision rule: If χ² > χ²_critical (at significance α), reject H₀ Common critical values (α=0.05): df=1: 3.841, df=2: 5.991, df=3: 7.815 df=4: 9.488, df=5: 11.071

How to Use

Enter the observed frequencies as comma-separated values (e.g., "20 30 25 25"). Enter the expected frequencies in the same order. Click Calculate to get the χ² statistic, each category's contribution, degrees of freedom, and whether the result is significant at α = 0.05.

Example Calculation

A die is rolled 60 times. Each face should appear 10 times. Observed: 8, 9, 12, 11, 10, 10 Expected: 10, 10, 10, 10, 10, 10 χ² = (8−10)²/10 + (9−10)²/10 + ... + (10−10)²/10 = 0.4 + 0.1 + 0.4 + 0.1 + 0 + 0 = 1.0 df = 6−1 = 5, χ²_critical(5, 0.05) = 11.07 Since 1.0 < 11.07, fail to reject H₀ (die appears fair)

Understanding Chi-Square

The chi-square test is one of the most widely used non-parametric statistical tests because it applies whenever you have categorical data and want to test if your observations match a theoretical prediction.

Karl Pearson introduced the chi-square goodness-of-fit test in 1900, in a paper testing whether Weldon's dice data were consistent with fair dice. This was one of the founding moments of modern mathematical statistics.

Chi-square tests appear in genetics (testing Mendelian inheritance ratios), market research (testing if customer preferences match expectations), quality control (testing if defect rates match specifications), and survey analysis (testing if response distributions differ from a reference).

Frequently Asked Questions

What is the null hypothesis in chi-square testing?

The null hypothesis (H₀) is that the observed frequencies match the expected frequencies — i.e., there is no significant difference between what was observed and what was expected under the theoretical model.

What is the chi-square distribution?

The chi-square distribution is a family of distributions parameterized by degrees of freedom (df). It is the distribution of the sum of squares of df independent standard normal random variables. It is always non-negative and right-skewed.

What are the assumptions of the chi-square test?

The data must be frequencies (counts), not percentages. All expected values should be ≥ 5 (rule of thumb). Observations must be independent. The categories must be mutually exclusive and exhaustive.

What is the chi-square test of independence?

This calculator performs the goodness-of-fit test. A separate chi-square test of independence tests whether two categorical variables are associated, using a contingency table.

What does degrees of freedom mean?

Degrees of freedom (df) is the number of values free to vary once constraints are imposed. For goodness-of-fit, df = k−1 where k is the number of categories, because the observed frequencies must sum to a fixed total.

Related Tools