Categorical › Contingency / proportions

Cochran's Q (≥3 matched binary)

Cochran's Q tests whether the success rate stays constant across k ≥ 3 repeated binary measurements on the same subjects — McNemar's test extended beyond two.

What is Cochran's Q (≥3 matched binary)?

Cochran's Q generalises McNemar (k = 2) to arbitrary k. The statistic Q = k(k − 1) · Σ_j (T_j − T̄)² / [k · Σᵢ Lᵢ − Σᵢ Lᵢ²] follows χ²(k − 1) under H₀ (all treatments have equal success rate), where T_j is the success total in column j and Lᵢ is the row total.

Friedman is the equivalent test for ordered or continuous rank data on the same blocks; Cochran's Q is specifically for binary 0/1 outcomes.

When should I use Cochran's Q (≥3 matched binary)?

  • Same subjects evaluated under ≥ 3 binary conditions (e.g. positive/negative across 3 lab assays).
  • Repeated yes/no questions on the same panel.

What data does it need?

≥ 3 binary 0/1 columns (subjects × conditions).

What does it report?

Q statistic, df = k − 1, p, success rate per condition.

What does it assume?

  • Independent rows (subjects).
  • Binary outcomes.
  • Rows with all 0s or all 1s contribute nothing — they're absorbed automatically.

How do I interpret the result?

If Q is significant, follow up with pairwise McNemar tests with Bonferroni / Holm adjustment to identify which conditions differ.

See also

References

  • Cochran (1950). The comparison of percentages in matched samples. Biometrika 37(3/4).