calculator.onl
Categories50

Chi-square independence calculator

Calculate Pearson’s chi-square statistic, degrees of freedom and upper-tail p-value from a count table.

A worked example

Change the top-left count. Larger circles show which cells contribute more to χ².

Pearson χ² statistic6.6667Degrees of freedom1
One row per line or semicolon, with space-separated observed counts. Use counts, not percentages or precomputed expected values.

Updates as you type

Enter a rectangular 2–10 by 2–10 table of integer counts from 0 to 1,000,000,000. Separate columns with spaces and rows with line breaks or semicolons; every row and column must have a positive total.

YOUR RESULT

Pearson χ² statistic

6.6667

Calculated from your inputs

Upper-tail p-value0.98%
Degrees of freedom1
Total observations60
Smallest expected count15
Cells with expected count below 50
The numbers, at a glance

Calculations run in your browser.
UNDERSTAND THE RESULT

A little context. A clearer answer.

↑ Back to calculator

When this calculator is useful

Calculate Pearson’s chi-square statistic, degrees of freedom and upper-tail p-value from a count table. Enter your values and inspect the calculation details. For a related calculation, try Binomial probability calculator.

What to enter

InputWhat it meansExample value
Observed count tableOne row per line or semicolon, with space-separated observed counts. Use counts, not percentages or precomputed expected values.10 20 20 10

How the calculation works

  1. Calculate row totals Rᵢ, column totals Cⱼ and grand total N; independence gives Eᵢⱼ = RᵢCⱼ/N.
  2. Sum (Oᵢⱼ − Eᵢⱼ)²/Eᵢⱼ and use df = (rows − 1)(columns − 1).
  3. Find the upper-tail χ² probability and inspect every expected count and cell contribution.
The formulaEᵢⱼ = RᵢCⱼ/N; χ² = Σ(Oᵢⱼ − Eᵢⱼ)²/Eᵢⱼ; df = (r − 1)(c − 1)

A worked example

Worked example: Rows 10 20 and 20 10 give expected counts 15, χ² = 6.666667, df = 1 and p ≈ 0.98233%.

Example you can load

What to enter
Result for this example · Pearson χ² statistic6.6667

This is a fixed example; changing the form above does not change these numbers.

Assumptions & limits

For independent observations in a 2–10 by 2–10 contingency table. Counts must be integers from 0 to 1,000,000,000 with positive row and column totals. Uses the asymptotic Pearson test without Yates correction; small expected counts can invalidate the approximation. This is not a goodness-of-fit test.

Frequently asked questions

Is Yates correction applied to a 2 × 2 table?

No. The output is the uncorrected Pearson statistic for every supported table size.

What if expected counts are small?

The asymptotic p-value may be unreliable. Review the sampling design and consider an appropriate exact or resampling method.

Does a small p-value prove causation?

No. It concerns compatibility with independence under the model, not effect size, causation or practical importance.