Cochran's Q test calculator
Paste 0/1 results for the same subjects under three or more conditions to test whether success rates differ, with an effect size and Holm-adjusted pairwise McNemar tests.
Paste the yes/no results
The same subjects under three or more conditions, or rated by three or more judges.
LIVE RESULT
INSTANTCochran's Q test
Subjects must be independent of each other; only the conditions are related. Lines with a value other than 0 or 1 are rejected.
What Cochran's Q tests
Cochran's Q test checks whether the proportion of “yes” outcomes is the same across three or more related conditions: the same participants solving four types of task, the same patients tested with three diagnostic methods, or the same items judged by several raters. It extends McNemar's test, which handles two conditions, in the same way that a repeated-measures ANOVA extends the paired t test.
Q = (k − 1) [k Σ Cj² − T²] ÷ (k T − Σ Ri²), df = k − 1
Cj = successes in condition j, Ri = successes for subject i, T = total successes
Effect size: η²Q = Q ÷ (n(k − 1))
Subjects with the same result in every condition (all 0 or all 1) do not affect Q; the test is driven by subjects whose results differ between conditions. Q is compared with a chi-square distribution, which works well when the number of informative subjects is not too small. Results match the cochrans_q function in Python's statsmodels.
Worked example
Twelve students attempted four types of problem. The success rates were 75%, 58%, 17%, 92%. Cochran's Q(3) = 16.27, p < .001, so the problem types differ in difficulty. In the pairwise McNemar tests below the calculator, only the gap between the third and fourth types (17% against 92%) remains significant after Holm's correction; with 12 students, the other differences are too uncertain to call.
Comparing related-proportions tests
| Design | Outcome type | Conditions / groups | Recommended test |
|---|---|---|---|
| Same subjects measured twice | Binary (0 / 1) | 2 related conditions | McNemar's test |
| Same subjects measured 3+ times | Binary (0 / 1) | 3+ related conditions | Cochran's Q test |
| Same subjects measured 3+ times | Ordinal / ranked | 3+ related conditions | Friedman test |
| Independent groups compared once | Categorical / binary | 2+ independent groups | Pearson chi-square / Cramér's V |
After a significant Q
- Pairwise follow-ups. Compare each pair of conditions with McNemar's test and adjust the p-values for multiple comparisons; the calculator uses the exact McNemar test and Holm's method. For a single pair, see the McNemar test calculator and read the post-hoc and multiple comparisons guide.
- Effect size. η²Q ranges from 0 to 1 and describes how much the conditions differ relative to the maximum possible.
- Agreement rather than difference. If the columns are raters and you want to know how well they agree, rather than whether their rates differ, use Fleiss' kappa or Krippendorff's alpha.
- Continuous outcomes measured under several conditions need a repeated-measures ANOVA or the Friedman test instead.
Useful context
Before reporting Cochran's Q
Why do subjects with all 0s or all 1s drop out of Q?
Subjects who succeed in every condition or fail in every condition give zero information about which condition is easier or harder. Cochran's Q depends entirely on informative subjects whose outcomes change across conditions—which is why the calculator flags when fewer than 10 informative subjects are present.
How should missing values be handled?
Standard Cochran's Q requires complete binary observations across every condition for each subject. If participants dropped out partway through, consider mixed-effects logistic regression or generalized estimating equations (GEE) rather than dropping incomplete cases silently.
What does a significant Q with non-significant Holm pairwise tests mean?
The omnibus Q test pools evidence across all k conditions, whereas pairwise McNemar comparisons divide power across k(k − 1)/2 tests and apply a family-wise Holm correction. With modest sample sizes, an overall difference can be detectable even when individual pairs fall short after correction.