Cochran's Q Test Calculator

Free Cochran's Q test calculator for 3 or more related groups with binary outcomes (yes/no, success/fail). Enter matched subjects across treatments, get Q statistic, degrees of freedom, chi-square p-value, assumptions and interpretation.

Each row represents one matched subject.

Each column represents one condition (k ≥ 3).

Fill each cell with 0 (failure) or 1 (success) for every subject & condition.

How to use this calculator

Enter the number of matched subjects and the treatments (k ≥ 3), build the data table, then fill each cell with 0 (failure) or 1 (success). When every cell is defined, the calculator estimates the Cochran's Q statistic, its degrees of freedom, and the chi-square p-value for the null hypothesis that the success proportion is equal across all conditions.

Methodology

The calculator aggregates row and column totals, computes the Q statistic from the Cochran's Q formula, and evaluates the chi-square upper tail to derive the p-value. The computation mimics the classical matrix-based derivation while guarding against invalid or degenerate tables.

Assumptions

  • k ≥ 3 related groups sharing the same subjects.
  • Binary outcomes (0 or 1) with no missing entries.
  • Each subject is measured under every treatment.

Notation:

  • n = number of matched subjects.
  • k = number of treatments/conditions.
  • Cj = column total for treatment j.
  • Ri = row total for subject i.
  • T = total number of successes = ΣCj.

Test statistic:

\( Q = \frac{(k-1)\left[k \sum_{j=1}^{k} C_j^2 - T^2 \right]}{kT - \sum_{i=1}^{n} R_i^2} \)

Under the null hypothesis, Q ~ χ²(k − 1).

Post-hoc?

Cochran's Q only signals that at least two conditions have different proportions. To identify the specific pairs, run pairwise McNemar tests with a multiple-comparisons correction (Bonferroni, Holm, etc.).

Full original guide (expanded)

Notes

  • Use for matched dichotomous data with ≥3 conditions.
  • If p < 0.05 → reject equal proportions.
  • Follow up with pairwise McNemar + correction.

About the author

Ugo Candido builds statistical tools and educational explanations so readers can replicate the formulas and understand assumptions.

Profile · LinkedIn

Editorial policy

CalcDomain content is reviewed for clarity, accuracy, and transparency. We do not accept paid placements that influence calculator outputs, and we display inputs and assumptions directly in the interface so you can verify every number.

Formulas

Cochran's Q statistic:

Q = ((k − 1) [ k ΣC_j² − T² ]) / (kT − ΣR_i²)

Notation mirrors the table inputs: each C_j is a treatment total, each R_i is a subject total, and all entries are 0 or 1.

Citations

NIST — Weights and measures — nist.gov · Accessed 2026-01-19
https://www.nist.gov/pml/weights-and-measures

FTC — Consumer advice — consumer.ftc.gov · Accessed 2026-01-19
https://consumer.ftc.gov/

Changelog
  • 0.1.0-draft — 2026-01-19: Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido Last Updated: 2026-01-19 Version 0.1.0-draft
Version 1.5.0