Cochran's Q Test Calculator

Run Cochran's Q Test on your binary (0/1) data to determine whether proportions differ significantly across three or more related conditions. Enter your data matrix (rows = subjects, columns = conditions) as comma-separated 0s and 1s, set your significance level, and get back the Q statistic, degrees of freedom, p-value, and a clear reject/fail-to-reject decision for your hypothesis.

How many treatments or conditions are being compared (minimum 3).

How many subjects (rows) are in your dataset.

Enter one row per subject. Each row should contain k values (0 or 1) separated by commas. Example: 1,0,1 means subject 1 scored 1 in condition A, 0 in B, 1 in C.

The threshold probability at which you reject the null hypothesis.

Results

Cochran's Q Statistic

--

Degrees of Freedom (df)

--

p-value

--

Chi-Square Critical Value

--

Decision

--

Total Successes (T..)

--

Effect Size (Kendall's W)

--

Successes per Condition

Results Table

Frequently Asked Questions

What is Cochran's Q Test?

Cochran's Q Test is a non-parametric statistical test used to detect differences in proportions across three or more related groups when the dependent variable is binary (e.g., success/failure, yes/no). It is the extension of McNemar's Test to more than two conditions and a special case of Friedman's Test applied to binary data.

When should I use Cochran's Q Test?

Use Cochran's Q Test when your outcome variable is binary, you have three or more related conditions or treatments, and the same subjects are observed under each condition (repeated measures design). Common applications include clinical trials, psychology experiments, and educational research where subjects are exposed to multiple treatments.

What are the null and alternative hypotheses?

The null hypothesis (H₀) states that the proportions of successes are equal across all k conditions — in other words, the treatments are not significantly different. The alternative hypothesis (Hₐ) states that at least one condition has a different proportion of successes from the others.

How is the Cochran's Q statistic calculated?

The Q statistic is calculated as Q = (k−1) × [k × ΣTj² − T..²] / (k × T.. − ΣRi²), where k is the number of conditions, Tj is the column total (successes in condition j), T.. is the grand total of all successes, and Ri is the row total (successes for subject i). Under H₀, Q follows a chi-square distribution with k−1 degrees of freedom.

How do I enter my data into this calculator?

Enter your data as a matrix in the text area, with one row per subject. Within each row, separate the condition values (0 or 1) with commas. For example, if subject 1 succeeded in conditions A and C but not B, enter '1,0,1'. Ensure every row has exactly k values corresponding to your number of conditions.

How do I interpret the p-value?

If the p-value is less than or equal to your chosen significance level (α), you reject the null hypothesis and conclude that at least one condition has a significantly different proportion of successes. If the p-value is greater than α, you fail to reject the null hypothesis, meaning the data do not provide sufficient evidence of a difference.

What are the limitations of Cochran's Q Test?

Cochran's Q Test only tells you that at least one condition differs — it does not identify which specific conditions are different. For that, post-hoc pairwise McNemar tests with a Bonferroni correction are recommended. The test also assumes that subjects are independent of each other and that the binary classification is consistent across conditions.

What test should I use if Cochran's Q Test finds a significant result?

If Cochran's Q Test is significant, follow up with pairwise McNemar's Tests between each pair of conditions to identify where the differences lie. Apply a Bonferroni correction (divide α by the number of comparisons) to control the family-wise error rate. Some researchers also use Dunn's test or other post-hoc methods adapted for binary repeated measures.

More Statistics Tools