Free Chi-Square Test Calculator

Goodness of fit and test of independence

Chi-Square Test Calculator

Calculate chi-square statistics for goodness of fit and test of independence with p-values, critical values, and step-by-step analysis.

Enter Observed and Expected Frequencies

Category Observed Expected Action
Category 1
Category 2
Category 3

Critical Values Reference

Chi-square critical values for common significance levels:

df 0.10 0.05 0.01 0.001
12.7063.8416.63510.828
24.6055.9919.21013.816
36.2517.81511.34516.266
47.7799.48813.27718.467
59.23611.07015.08620.515
610.64512.59216.81222.458
712.01714.06718.47524.322
813.36215.50720.09026.125
914.68416.91921.66627.877
1015.98718.30723.20929.588
1218.54921.02626.21732.909
1522.30724.99630.57837.697
2028.41231.41037.56645.315
2534.38237.65244.31452.620
3040.25643.77350.89259.703

Understanding the Chi-Square Test

What is the Chi-Square Test?

The chi-square test is a statistical method used to determine if there is a significant association between categorical variables or if observed frequencies differ from expected frequencies. The test calculates a statistic that measures the discrepancy between what we observe and what we expect under the null hypothesis.

Chi-Square Formula

The chi-square statistic is calculated as:

χ² = Σ[(O - E)² / E]

Where O is the observed frequency and E is the expected frequency for each category or cell.

Types of Chi-Square Tests

1. Goodness of Fit Test

Tests whether observed sample data fits a hypothesized distribution. Used when you have one categorical variable.

  • Null hypothesis: The data follows the expected distribution
  • Degrees of freedom: k - 1 (where k is the number of categories)
  • Example: Testing if a die is fair by comparing observed rolls to expected uniform distribution

2. Test of Independence

Tests whether two categorical variables are independent or related. Used when you have two categorical variables in a contingency table.

  • Null hypothesis: The two variables are independent
  • Degrees of freedom: (rows - 1) × (columns - 1)
  • Example: Testing if gender and voting preference are independent
  • Expected frequency for each cell: (row total × column total) / grand total

Interpreting Results

P-Value Interpretation

  • p < 0.05: Strong evidence against null hypothesis (typically significant)
  • p < 0.01: Very strong evidence against null hypothesis
  • p < 0.001: Extremely strong evidence against null hypothesis
  • p >= 0.05: Insufficient evidence to reject null hypothesis

Cramer's V Effect Size

For test of independence, Cramer's V measures the strength of association:

  • 0.00 - 0.10: Negligible association
  • 0.10 - 0.30: Weak association
  • 0.30 - 0.50: Moderate association
  • 0.50+: Strong association

Assumptions and Requirements

  1. Independence: Observations must be independent of each other
  2. Sample Size: Expected frequency in each cell should be at least 5
  3. Random Sampling: Data should be collected through random sampling
  4. Categorical Data: Variables must be categorical (not continuous)

Common Applications

  • Market research: Testing if product preference differs by demographic group
  • Medical studies: Testing if treatment outcome is independent of patient characteristics
  • Quality control: Testing if defect rates are consistent across production batches
  • Genetics: Testing if observed offspring ratios match Mendelian expectations
  • Social sciences: Testing relationships between categorical variables like education level and political affiliation

Example Calculation

Scenario: Testing if a die is fair using 60 rolls.

Observed: 1→8, 2→12, 3→9, 4→11, 5→10, 6→10

Expected: Each face should appear 10 times (60/6)

Calculation:

  • χ² = (8-10)²/10 + (12-10)²/10 + (9-10)²/10 + (11-10)²/10 + (10-10)²/10 + (10-10)²/10
  • χ² = 0.4 + 0.4 + 0.1 + 0.1 + 0 + 0 = 1.0
  • df = 6 - 1 = 5
  • Critical value at α=0.05: 11.070
  • Since 1.0 < 11.070, fail to reject H₀ - the die appears fair

Privacy & Limitations

  • All calculations run entirely in your browser -- nothing is sent to any server.
  • Results are computed using standard formulas and should be verified for critical applications.

Related Tools

Related Tools

View all tools

Chi-Square Test Calculator FAQ

What is a chi-square test?

A chi-square test is a statistical hypothesis test that examines whether observed frequencies differ significantly from expected frequencies. It tests relationships between categorical variables or checks if sample data fits a theoretical distribution.

When should I use a goodness of fit test?

Use a goodness of fit test when you have one categorical variable and want to test if your observed data matches an expected distribution. For example, testing if a die is fair by comparing observed rolls to expected uniform distribution.

What does the p-value tell me?

The p-value represents the probability of obtaining results as extreme as yours if the null hypothesis is true. A small p-value (typically less than 0.05) suggests you should reject the null hypothesis.

What is degrees of freedom in a chi-square test?

Degrees of freedom (df) represents the number of values free to vary. For goodness of fit, df = categories - 1. For independence tests, df = (rows - 1) times (columns - 1).

What is Cramers V?

Cramers V is an effect size measure for chi-square tests of independence, ranging from 0 to 1. Values of 0.1 indicate a small effect, 0.3 a medium effect, and 0.5 or higher a large effect.

What are the assumptions of the chi-square test?

The main assumptions are independence of observations, random sampling, adequate sample size (generally at least 5 expected observations per cell), and categorical data.

Request a New Tool
Improve This Tool