Cochran's Q Test
Cochran's Q Test compares three or more related binary measurements on the same subjects — the analogue of Friedman for yes/no, success/failure, or 0/1 outcomes. Example: testing whether three different rapid tests give the same positivity rate when applied to the same group of patients.
Step 1 — Provide your binary data
One column per binary measurement (3+ columns), one row per subject. Each value must be 0 or 1.
Input methods:
- Manual entry with Add Group / Remove Group controls
- Upload from Excel — column-selection panel where you tick columns, click Use Selected Data
- Generate Random Data — generates 4 groups of 15 binary observations
Step 2 — Calculate
Click Calculate Cochran's Q Test.
Step 3 — Read the results
| Field | What it shows |
|---|---|
| Q Statistic | Cochran's Q value |
| Degrees of Freedom | k − 1 |
| p-value | Significance from chi-square distribution |
| Effect Size (W) | Kendall's W with interpretation label |
| Success Proportions | Proportion of 1s in each condition |
Step 4 — Post-hoc analysis
If significant (p < 0.05), pairwise comparisons using McNemar's test with Bonferroni correction are shown:
- Condition labels
- Difference in success proportions
- Bonferroni-corrected p-value
- Significance flag
A UniversalChatBot is available for discussion.
Statistical methods used
Test statistic — Cochran's Q
| Component | Formula |
|---|---|
| Cⱼ | Number of successes in condition j |
| Lᵢ | Number of successes across all conditions for subject i |
| Q | [k(k − 1) × Σⱼ Cⱼ² − (Σⱼ Cⱼ)²] / [Σᵢ Lᵢ(k − Lᵢ)] |
p-value: 1 − χ²_CDF(Q, k − 1)
Hypothesis statement
- H₀: Success probability is the same across all k conditions
- H₁: At least one condition differs
- Significance level: α = 0.05
Effect size — Kendall's W
W = Q / (n × (k − 1))
| Kendall's W | Label |
|---|---|
< 0.10 |
Very weak effect |
0.10 – 0.30 |
Weak effect |
0.30 – 0.50 |
Moderate effect |
0.50 – 0.70 |
Strong effect |
≥ 0.70 |
Very strong effect |
Post-hoc — McNemar's test with Bonferroni correction
For each pair (i, j), builds a 2×2 contingency table:
- b = subjects succeeding in i but failing in j
- c = subjects failing in i but succeeding in j
| Sample size | Formula |
|---|---|
b + c ≥ 25 |
`χ² = ( |
b + c < 25 |
χ² = (b − c)² / (b + c) (without correction) |
Bonferroni adjustment: adjusted_p = min(p × k(k − 1)/2, 1)