Skip to content
Omnikalc

Cochran’s Q test calculator

Enter the number of successes of three matched treatments and the sum of squared row totals to get Cochran’s Q, its p-value and the success rate of each treatment.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Value out of range

Results

Cochran’s Q

7.538

p-value (2 degrees of freedom)
0.0231
The success rates differ significantly at the 5 % level
Success rate under treatment 1
70.0 %
Success rate under treatment 2
45.0 %
Success rate under treatment 3
30.0 %

The Cochran’s Q test calculator gives Q and its p-value to decide whether three matched treatments have different success rates when the same subjects are tested each time.

How the calculation works

  • Enter the number of subjects and the successes under each of the three treatments.
  • Enter the sum of the squared row totals.
  • The calculator gives Q, the p-value on 2 degrees of freedom and the success rate of each treatment.

Example

20 subjects with 14, 9 and 6 successes have a total of 29. With a sum of squared row totals of 61, Q = 2 × (3 × 313 − 841) / (3 × 29 − 61) = 7.538. The p-value is 0.0231, and the success rates are 70.0 %, 45.0 % and 30.0 %.

Why it matters

The calculator helps researchers, students and quality engineers to compare several methods, tests or raters on the same cases, for example three diagnostic tests on the same patients or three checks on the same samples.

Good to know

Build the table with one row per subject and one column per treatment, with 1 for a success and 0 for a failure. The column sums are the successes of each treatment and the row sums give the sum of squares. Order effects can bias the result, so randomize the order in which the treatments are applied. If k is 2, the test reduces to the McNemar test. Q is compared with a chi-square distribution with k − 1 degrees of freedom, and the approximation is acceptable when the number of subjects with mixed results is about 10 or more. The calculator is built for three treatments, and it returns a p-value of 1 if all the subjects have the same result everywhere.

The McNemar test calculator handles two treatments, the chi-square test calculator handles independent groups, the chi-square distribution calculator gives p-values and the Fisher exact test calculator handles small samples.

Frequently asked questions

What is Cochran’s Q test?

It extends the McNemar test to three or more matched treatments with a yes or no outcome. The same subjects are measured under each treatment, and the test asks whether the proportion of successes is the same. Q = (k − 1) [k Σ C² − T²] / (k T − Σ R²), where C are the column totals, R the row totals and T the grand total.

How do I get the sum of squared row totals?

For each subject, count the treatments with a success, giving 0, 1, 2 or 3. Square each count and add them up over all the subjects. In the example, 3 subjects with 3 successes, 7 with 2, 6 with 1 and 4 with none give 3 × 9 + 7 × 4 + 6 × 1 = 61.

What are the conditions of use?

The test needs a binary outcome, matched subjects and a reasonably large number of subjects whose results differ across treatments, as the chi-square approximation is poor for small counts. Subjects with the same result under all treatments carry no information. After a significant result, compare pairs with McNemar tests and correct for multiple comparisons.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.