Statistics & Data Analysis

Chi-square Test Calculator

Run goodness-of-fit or contingency-table independence tests from counts, with expected counts, cell contributions, p-values and sparse-data warnings.

Mutually exclusive counts · pre-specified probabilities · inspect sparsity

Inputs

Test purpose

Enter observation counts, not percentages; each observation belongs in one cell.

Expected percentages must be pre-specified and sum to 100%. This version fits no model parameters; df = categories − 1.

CategoryObserved countExpected %Action

For example, 0.05 = 5%; supported range: 0.000001 to 0.5.

Raw observations are processed only in this tab. Shared cards contain calculated summaries; recalculate after editing inputs.

Results

Start with your numbers

Review or adjust your inputs, then calculate to see your results and interpretation.

Understand this calculation

Chi-square sums squared observed–expected discrepancies divided by expected counts. It is nonnegative, and an equal discrepancy contributes more in a cell with a small expectation. Goodness-of-fit tests one classification against specified proportions; independence tests association between two classifications.

See calculation method and assumptions

Formula

Chi-square Test

Observed versus expected

Expected counts

Contingency df and effect size

Variables, rates and periods

Oᵢ, Eᵢ
Observed and expected counts; enter counts, not percentages.
pᵢ, n
Prespecified probabilities (sum 1) and total count.
r, c, ν
Rows, columns and df; prespecified GOF df is categories−1.
V
Cramér's V association effect size; not causation.

Two different questions

  • Goodness-of-fit H₀ specifies category probabilities;
  • expectations equal the total times those probabilities, with df=k−1 in this version.
  • Independence H₀ says the classifications are independent;
  • expectations use row totals, column totals and the overall total, with df=(r−1)(c−1).

Counts and sampling design

  • Assign each independent observation to an appropriate mutually exclusive category.
  • Repeated measurements or clustered household surveys do not become independent by being placed in a table.
  • Expected counts must be positive;
  • one effective category cannot support a meaningful goodness-of-fit test.

A large χ² is not an effect size

  • A larger sample can produce a larger χ² for the same proportional discrepancy.
  • Cramér's V additionally scales association by sample size and table dimension.
  • Read the actual proportions as well;
  • V does not establish causal direction.

Run goodness-of-fit or contingency-table independence tests from counts, with expected counts, cell contributions, p-values and sparse-data warnings.

Worked example

  1. Choose goodness-of-fit and enter counts with prespecified proportions, or supply a contingency table.
  2. Check proportion totals, expected counts and independent observations; set α.
  3. Read contributions, χ², df and p-value; independence also supplies Cramér’s V. Heed expected-count warnings.

Frequently asked questions

Must every expected count exceed five?

Approximation quality depends on table size, sample size and the pattern of expectations. The tool flags cells below one, cells below five and their prevalence; a single cutoff is not a universal reliability guarantee.

Can I estimate the null proportions from these data?

This version restricts goodness-of-fit to prespecified theoretical proportions. It does not adjust df for parameters fitted from the same sample; in that setting k−1 cannot simply be retained.

Is Fisher's exact test available for sparse tables?

Fisher's exact test may be appropriate for some sparse contingency tables, but it is not implemented here. A chi-square approximation is not an exact Fisher result.

Related calculators