How to use this calculator
Test whether three or more matched binary conditions have equal marginal response probabilities.
- Enter Binary observations by subject row, Conditions per subject. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Cochran Q repeated binary outcomes explained
Use Binary observations by subject row with Conditions per subject to reproduce the sample calculation, then review the stated limits before carrying the result into another scenario.
A numerical walkthrough
Binary observations by subject row = 1,1,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0; Conditions per subject = 3.
- Cochran Q statistic: 1.2
- Chi-square reference p-value: 0.54881164
- Degrees of freedom: 2
The eighteen entries form six subjects observed under three conditions. Preserve the rows: rearranging values between subjects can change the denominator even when column totals remain fixed.
The model behind the numbers
Q=(k−1)[kΣCj²−T²]/[kT−ΣRi²], with df=k−1.
Arrange one subject per row and one condition per column. Cj is a column success total, Ri a subject success total, and T the grand total. Subject totals account for the matched design. The p-value uses an asymptotic chi-square reference.
What to enter
x— Binary observations by subject row- Flatten complete subjects row by row. Each row contains the same k conditions and every entry is 0 or 1. Use comma-separated values in the stated order.
k— Conditions per subject- Number of binary conditions within each subject, not number of subjects. The value list length must be divisible by k. Enter a whole number.
Interpreting the result
Complete binary rows and independent subjects. This omnibus test does not identify which conditions differ. Small samples or sparse discordance can make the reference approximation unreliable.
Reading the outputs
Q summarizes departure from equal marginal proportions. Follow-up paired comparisons require a separate multiplicity plan.
Frequently asked questions
Can rows have missing measurements?
No. This tool requires complete observations for every subject and condition.
Is this for repeated continuous values?
No. Use a repeated-measures method such as Friedman for ranked continuous responses.
Why can identical columns cause an error?
If there is no within-subject binary variation, the Q denominator contains no testable contrast.
How do I use the Cochran Q repeated binary outcomes calculator?
Enter Binary observations by subject row, Conditions per subject. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Cochran Q repeated binary outcomes?
Binary observations by subject row = 1,1,0,1,0,0,0,1,0,1,1,1,0,0,1,1,0,0; Conditions per subject = 3. Cochran Q statistic: 1.2 Chi-square reference p-value: 0.54881164 Degrees of freedom: 2 The eighteen entries form six subjects observed under three conditions. Preserve the rows: rearranging values between subjects can change the denominator even when column totals remain fixed.
Method reference: Statsmodels Cochran Q definition.
Read our calculation methodology.