Cochran's Q test

Analytika TeamLast reviewed 4 min read

When the same people give yes/no responses under three or more conditions (passed or failed several tasks, endorsed several items, tested positive at several visits), Cochran’s Q (Cochran, 1950) tests whether the success rates differ.

How it works

Like McNemar’s test, it only gets information from people whose answers vary across conditions. Someone who succeeds at everything, or at nothing, says nothing about which condition is harder.

  • H₀: the probability of “yes” is the same in every condition.
  • H₁: at least one condition differs.

Worked example: three tasks

Eighteen participants each attempted three tasks, and success was recorded as yes or no. (This is a small example dataset from Analytika’s R-checked test suite.)

Analytika engine output
Category counted: yes
N: 18
Proportion (task1): 0.6667
Proportion (task2): 0.4444
Proportion (task3): 0.1667
Cochran's Q: 12.2000
df: 2
P-value: 0.002243
Method used: mcnemar_holm
task1 vs task2: p_adj=0.2188, significant=no
task1 vs task3: p_adj=0.01172, significant=yes
task2 vs task3: p_adj=0.125, significant=no
Rows excluded for missing values: 0 of 18

Interpretation

  • Success rates: 67%, 44% and 17%.
  • Q(2) = 12.20, p = .002: success rates differ across tasks.
  • Holm-corrected McNemar comparisons: task 1 vs task 3 differ (p = .012). The other pairs don’t reach significance with this small sample.

APA write-up

Cochran’s Q test showed that success rates differed across the three tasks (67%, 44% and 17%), Q(2) = 12.20, p = .002. Holm-corrected McNemar tests indicated a higher success rate on task 1 than on task 3, p = .012.

How to run it

  • SPSS: Analyze → Nonparametric Tests → Related Samples, then choose Cochran’s Q.
  • R: rstatix::cochran_qtest() or DescTools::CochranQTest().
  • Analytika: with one yes/no column per condition, ask whether the rate differs across them. It picks McNemar’s test for two columns and Cochran’s Q for three or more.

References

  • Cochran, W. G. (1950). The comparison of percentages in matched samples. Biometrika, 37(3–4), 256–266.

More in Categorical data

Run this on your own data

Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.

Try it free