Calculator Suite

Chi-Square Test Calculator

Chi-Square Analysis

Perform chi-square goodness of fit tests and tests of independence with comprehensive statistical analysis

Analysis Settings
Test Configuration
Choose your chi-square test type and analysis parameters
Goodness of Fit Data
Enter observed and expected frequencies for each category

Enter the actual counts for each category

Enter the theoretical expected counts for each category

Labels for each category (leave empty for auto-generated labels)

Educational Resources

Chi-Square Formulas
Mathematical foundations of chi-square testing

Test Statistic

χ2=i(OiEi)2Ei\chi^2 = \sum_{i} \frac{(O_i - E_i)^2}{E_i}

OiO_i = Observed frequency in cell i

EiE_i = Expected frequency in cell i

χ2\chi^2 = Chi-square test statistic

Expected Frequency (Independence)

Eij=Ri×CjNE_{ij} = \frac{R_i \times C_j}{N}

RiR_i = Row i total

CjC_j = Column j total

NN = Grand total

Degrees of Freedom

Goodness of Fit: df=k1df = k - 1
Independence: df=(r1)(c1)df = (r-1)(c-1)

kk = Number of categories

rr = Number of rows, cc = Number of columns

TL;DR — Chi-Square Test Explained

Chi-square tests analyze categorical data frequencies. Use Goodness of Fit to test if observed frequencies match an expected distribution. Use Test of Independenceto examine if two categorical variables are related. If p-value < 0.05, the result is statistically significant.

How to Use This Calculator: Step-by-Step
1

Select Test Type

Goodness of Fit (one variable) or Test of Independence (two variables).

2

Enter Your Data

For GoF: observed and expected frequencies. For Independence: contingency table.

3

Run the Test

Click "Run Chi-Square Test" to calculate χ² statistic and p-value.

4

Interpret Results

Check p-value, degrees of freedom, and Cramér's V (for independence tests).

📊 Example: Dice Fairness Test (Goodness of Fit)

Roll a die 60 times. If fair, expect 10 per side. Observed: [8, 12, 11, 9, 10, 10]

χ² statistic

1.20

df

5

p-value

0.945

Result

Not Significant

Interpretation: p = 0.945 > 0.05, so we cannot reject the hypothesis that the die is fair.

⚠️ Assumptions & Limitations

Key Assumptions:

  • • Data from random sampling
  • • Expected frequencies ≥ 5 in most cells
  • • Independent observations
  • • Categorical (not continuous) data

When to Use Alternatives:

  • • Small expected frequencies: Fisher's exact test
  • • 2×2 tables with small n: Yates' correction
  • • Continuous data: Use t-test or ANOVA
  • • Paired/matched data: McNemar's test
Frequently Asked Questions

When should I use a chi-square test?

Use chi-square for categorical data to test if observed frequencies differ from expected (goodness of fit) or if two categorical variables are related (independence).

What are degrees of freedom in chi-square?

For goodness of fit: df = k - 1 (k = categories). For independence: df = (rows - 1) × (columns - 1).

What if expected frequencies are less than 5?

The chi-square approximation becomes unreliable. Consider combining categories or using Fisher's exact test.

What does Cramér's V tell me?

Cramér's V measures association strength (0-1). ~0.1 = weak, ~0.3 = moderate, ~0.5+ = strong association.

How is chi-square different from a t-test?

Chi-square analyzes categorical frequencies. T-tests compare means of continuous data. Use chi-square for categories, t-test for measurements.

Curated video guide
Selected YouTube lessons that add context after the calculator, formulas, examples, assumptions, and limitations.

Chi-Square Tests

Source: CrashCourse on YouTube

Why this video: Selected because it introduces chi-square testing with categorical data in a broad educational format.

What it adds: It supplements the calculator's goodness-of-fit and independence modes by explaining observed versus expected counts.

Use with this calculator: Use the calculator to compute the statistic and p-value, then use the video to review the test setup.

Limits: The video is introductory and does not replace expected-count checks, exact tests, residual review, or study design.

How this calculator works
Method, formula, examples, assumptions, and review notes for this calculator.

How this calculator works

  • The calculator compares observed categorical counts with expected counts from the selected null model.
  • For independence tests, expected counts are derived from row totals, column totals, and grand total.
  • The chi-square statistic is converted to a p-value using degrees of freedom for the selected design.

Formula

Chi-square statistic

χ2=(OiEi)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}

Plain text formula: Chi-square = sum of squared observed-minus-expected counts divided by expected counts.

O_i = observed count in cell i
E_i = expected count in cell i under the null hypothesis
\chi^2 = test statistic compared with a chi-square distribution

Worked examples

Goodness-of-fit cell contribution

Inputs

  • Observed count: 30
  • Expected count: 24

Calculation

  • Cell contribution = (30 - 24)^2 / 24 = 1.5.

Large contributions identify categories that differ most from expected counts.

Curated video guide
Selected YouTube lessons that add context after the calculator, formulas, examples, assumptions, and limitations.

Chi-Square Tests

Source: CrashCourse on YouTube

Why this video: Selected because it introduces chi-square testing with categorical data in a broad educational format.

What it adds: It supplements the calculator's goodness-of-fit and independence modes by explaining observed versus expected counts.

Use with this calculator: Use the calculator to compute the statistic and p-value, then use the video to review the test setup.

Limits: The video is introductory and does not replace expected-count checks, exact tests, residual review, or study design.

How to interpret your result

  • A small p-value suggests observed counts differ from the null model more than expected by chance.
  • Review expected counts and residuals before trusting the result.

Assumptions

  • Data are counts, not percentages or continuous measurements.
  • Observations are independent.
  • Expected cell counts are large enough for the chi-square approximation.

Limitations

  • Small expected counts may require exact tests or category combining.
  • The test shows association or lack of fit, not causation.
  • Large samples can make small practical differences statistically significant.

Common mistakes

  • Entering percentages instead of counts.
  • Using chi-square for continuous data that require a t-test or regression.
  • Ignoring low expected cell counts.

Sources

Disclaimer

Last updated and reviewed by

Updated 2026-06-06Calculator Suite editorial review