Cochran Q Test Calculator
Compare more than two related proportions from matched subjects using Cochran's Q test. Paste binary (0,1) outcomes for each treatment to obtain the Q statistic, chi-square p-value, Kendall's W effect size, and a guided interpretation.
1. Provide Matched Binary Data
Treatments share the same subjectsEnter 0 and 1 values for each treatment or time point (use commas or spaces to separate values). Each column must contain the same number of subjects and represent the same ordering.
Used when rendering the summary table (e.g., Subject 1, Subject 2).
Test Results
Results readyKey Values
- Treatments (k)
- Subjects (n)
- Q statistic
- Degrees of freedom
- p-value
- Alpha
Effect Size
- Kendall W
- Mean success rate
- Total successes
Decision
Step-by-Step Workflow
Subject Summary
Formula Reference
Cochran's Q statistic
\\[ Q = \frac{(k - 1)\left[k \sum_{i=1}^{n} R_i^2 - \left(\sum_{i=1}^{n} R_i\right)^2\right]}{k \sum_{j=1}^{k} C_j - \sum_{j=1}^{k} C_j^2} \\]
Here \(R_i\) is the row total for subject \(i\) and \(C_j\) is the column total for treatment \(j\).
Reference distribution
\\[ Q \sim \chi^2_{k-1} \\]
The approximation holds when the number of subjects and successes is moderate; for very small samples consider exact methods or permutation tests.
Kendall's W effect size
\\[ W = \frac{Q}{k (n - 1)} \\]
Values near 0 indicate weak agreement among treatments, while values near 1 suggest strong consistency.
Success rate
\\[ \bar{p} = \frac{1}{k n} \sum_{j=1}^{k} C_j \\]
Provides context on how frequently the binary outcome is observed across all treatments.
Step-by-Step Guide
- Arrange matched binary outcomes for each subject across all treatments in the same order.
- Compute row totals \(R_i\) (successes per subject) and column totals \(C_j\) (successes per treatment).
- Plug these totals into the Cochran Q formula to obtain the test statistic and degrees of freedom \(k-1\).
- Evaluate the p-value from the chi-square distribution and compare it with the chosen alpha level.
- Report Kendall's W to describe agreement strength and follow up with post-hoc paired tests if Q is significant.
References
- Cochran, W. G. (1950). The comparison of percentages in matched samples. Biometrika, 37(3/4), 256-266.
- Fleiss, J. L., Levin, B., & Paik, M. C. (2013). Statistical Methods for Rates and Proportions (3rd ed.). Wiley.
- Agresti, A. (2018). Statistical Methods for the Social Sciences (5th ed.). Pearson.