InfyCalculator
📊

Cochran's Q Test Calculator

Cochran’s Q test for three or more related yes/no outcomes — Q statistic, degrees of freedom, p-value, success rate of each treatment and the effect size η²Q.

Binary data (one row per subject)
Significance level
Loading calculator…

How it works

Q = (k − 1)·[k·ΣCⱼ² − N²] ÷ [k·N − ΣRᵢ²] where Cⱼ = successes of treatment j, Rᵢ = successes of subject i, N = total successes; Q ~ χ² with k − 1 df; η²Q = Q ÷ [n(k − 1)]

Cochran’s Q extends McNemar’s test to three or more related binary outcomes — the same people tried under several conditions, or the same items judged by several methods — and asks whether the proportion of successes is the same for every treatment. Subjects with all-0 or all-1 rows carry no information and do not change Q. Under the null hypothesis Q follows a chi-square distribution with k − 1 degrees of freedom (Cochran, 1950).

Worked example

Twelve subjects try three treatments with success rates 66.7%, 83.3% and 25.0%: Q = 8.667 on 2 df, p = 0.0131 and η²Q = 0.361 — the success rates differ significantly.

Sources: Cochran (1950), The comparison of percentages in matched samples, Biometrika · NIST Dataplot — Cochran test

Frequently asked questions

What is the difference between Cochran’s Q and McNemar’s test?

McNemar compares two related proportions; Cochran’s Q compares three or more. With exactly two treatments Q equals McNemar’s chi-square without continuity correction.

What should I do after a significant Q?

Compare treatments in pairs with McNemar’s test and adjust the p-values for multiple comparisons (Bonferroni or Holm).

How many subjects do I need?

The chi-square approximation works well when the number of subjects that are not all-0 or all-1 times the number of treatments is at least about 24.

Can I use it for Likert answers?

Only after collapsing them to yes/no. For ordinal answers measured repeatedly use the Friedman test instead.

Related calculators

Educational tool: check the test’s assumptions (sample size, independence, distribution) before relying on a result for a real decision.