Statistical Calculators › Proportions: Correlated and Paired › Cochran’s Q Test Sample Size Calculator
← All Calculators

Proportions: Correlated and Paired

Cochran's Q Test Sample Size Calculator

Calculate the number of subjects required for Cochran's Q test when the same subjects are evaluated under three or more related conditions with a binary outcome. Enter the expected success proportion for each condition, alpha, and desired power. The calculation uses an asymptotic noncentral-χ2 planning approximation.

Study Design

Specify the number of related conditions and the expected success proportions under the alternative hypothesis.
Expected success proportions
Condition
Expected proportion

Sample Size Result

The reported N is the number of complete paired subjects required under the planning assumptions entered at left.
Enter the planning assumptions and click Calculate Sample Size.

Methodology

Cochran's Q test compares the success proportions of k related binary measurements made on the same subjects. It is the repeated-measures extension of McNemar's test and tests whether the marginal success proportions are equal across the conditions.

For binary responses, let \(Y_{ij}\) denote the response from subject \(i\) in condition \(j\), with success coded as 1 and failure as 0. If \(G_j=\sum_iY_{ij}\) is the number of successes in condition \(j\), \(T=\sum_jG_j\), and \(L_i=\sum_jY_{ij}\) is the number of successes contributed by subject \(i\), Cochran's Q statistic is

Q = (k - 1) [ k ΣGj2 - T2 ] / [ kT - ΣLi2 ]

For sufficiently large effective samples, Q is approximately distributed as a chi-square random variable with \(k-1\) degrees of freedom. NCSS's Cochran's Q documentation gives the same statistic and large-sample chi-square approximation. The documented rule of thumb is that at least four subjects should have non-identical responses across conditions and that \(nk\) should be at least 24.

Sample Size Calculation

For planning, this calculator specifies the expected marginal success probabilities \(p_1,\ldots,p_k\). Under the transparent working approximation used here, the expected Cochran Q statistic is obtained from the corresponding expected values of the numerator and denominator of the Q statistic. The resulting expected Q is treated as the noncentrality parameter of the asymptotic chi-square distribution.

λ(N) ≈ E[Q]

Power = Pr{ χ2k-1,λ(N) > χ21-α,k-1 }

The calculator searches upward over integer values of N and reports the smallest number of paired subjects for which the calculated power reaches the requested target.

Important Planning Assumption

Because marginal proportions alone do not completely specify the joint distribution of repeated binary outcomes, this implementation uses a working independence assumption when calculating the planning noncentrality parameter. The subjects are still treated as matched repeated observations for the Cochran Q statistic itself. If substantial within-subject dependence beyond this working assumption is expected, simulation based on a specified joint binary distribution is preferable.

Interpretation

References

Cochran, W. G. (1950). The comparison of percentages in matched samples. Biometrika, 37(3–4), 256–266.

Ramsey, P. P., & Ramsey, P. H. (1981). Minimum sample sizes for Cochran's test. Proceedings of the American Statistical Association, Survey Research Methods Section.

NCSS, LLC. Cochran's Q Test, Chapter 521. NCSS Statistical Software documentation. The documentation describes Cochran's Q for matched binary responses, its test statistic, its chi-square approximation, and practical large-sample requirements.