Chi-square test of independence

Hypothesis tests · Method and input reference

Nonnegative integer counts. Fisher and McNemar require 2×2. McNemar uses the exact binomial test for paired binary outcomes. Synthetic example: Three treatment groups by response category (complete, partial, none); cells contain counts, not participant rows.

Open calculator · Compare methods in the decision matrix

When to consider it

  • Test association between categorical variables using an independent-samples contingency table.

Assumptions and scope

  • Observations must be independent between subjects; repeated rows from one subject are not independent samples.
  • Review expected cell counts; Fisher’s exact is available for sparse 2×2 tables. Sparse larger tables need methods outside this calculator.

Required inputs

  • Observed count matrix — Numeric observations; preserve the row and column structure described above.

Review missing values and data coding before running. Sample inputs are synthetic teaching examples.

Implementation

Lifescio validates inputs and formats results; listed functions are the principal calculation routines, not an exhaustive transitive dependency list.

  • scipy 1.15.3: scipy.stats.chi2_contingency

These are pinned library versions; saved results record the versions actually used at runtime.

Library references