Cochran's Q test is the classical statistical test for heterogeneity in a meta-analysis: it asks whether the variation among the individual study results is larger than would be expected from sampling error alone. The test takes each study's effect estimate, measures how far it sits from the pooled effect, and adds up those deviations after weighting each study by its precision. Under the null hypothesis that every study is estimating one common true effect, that weighted sum follows a known reference distribution, so a value much larger than expected is evidence that the studies disagree. In plain terms, Cochran's Q answers a single question: are these studies telling the same story, or are they pulling in different directions?
How Q is computed as a weighted sum of squared deviations
The arithmetic behind Cochran's Q is a weighted sum of squared deviations from the pooled estimate. For each of the k studies you take the difference between that study's observed effect and the fixed-effect pooled estimate, square that difference so positive and negative gaps both count, and multiply it by the study's inverse-variance weight so that precise large studies count more than small noisy ones. Q is the total of those weighted squared deviations across all studies. When every study lands close to the pooled effect the deviations are tiny and Q is small; when studies scatter widely Q grows large.
- Compute the pooled effect on the analysis scale, which for ratio measures such as the odds ratio or risk ratio is the natural logarithm.
- For each study, take the squared distance from that pooled value and weight it by the inverse of the study's variance, so studies with narrow confidence intervals dominate.
- Add the weighted squared deviations together to obtain the single Q statistic.
Because the contribution of each study scales with its weight, a single large precise study that disagrees with the rest can inflate Q sharply, while many tiny studies that disagree may barely move it. That weighting is the same machinery that produces the pooled diamond when you turn extracted study counts into a forest plot, which is why the heterogeneity row sits directly beneath the pooled result on most figures.
The chi-square reference distribution and degrees of freedom
To decide whether a given Q is "large," you compare it to a chi-square distribution. Under the null hypothesis of one common true effect, Q is expected to follow a chi-square distribution with degrees of freedom equal to the number of studies minus one, written as k minus 1. The intuition for that count is that once the pooled effect is estimated from the data, only k minus 1 of the study deviations are free to vary. A useful checkpoint is that the expected value of a chi-square distribution equals its degrees of freedom, so on average Q should be close to k minus 1 when there is no real heterogeneity.
This gives a direct interpretation of the p-value. You look up the probability of seeing a Q at least as large as the one observed, given k minus 1 degrees of freedom. A small p-value means the studies vary more than chance predicts, so you reject the assumption of a single common effect; a large p-value means the observed scatter is compatible with sampling error alone. Many authors use a relaxed threshold such as 0.10 rather than 0.05 for this test, precisely because of the power problems described next.
Why Q has low power with few studies and over-detects with many
The biggest practical limitation of Cochran's Q is that its behaviour depends heavily on how many studies you have. With a handful of studies the test has low statistical power: real and important differences between studies can easily produce a non-significant result, so a large p-value does not prove the studies agree, it may only mean you could not detect the disagreement. This is why a reassuring Q in a meta-analysis of four or five trials should never be read as a clean bill of homogeneity.
At the other extreme, when a meta-analysis pools dozens of studies the test becomes over-powered and tends to over-detect heterogeneity. With many studies even trivial, clinically meaningless differences can drive Q to statistical significance, so a tiny p-value does not, on its own, tell you whether the variation matters. The lesson is that Cochran's Q is a test of the presence of heterogeneity, not a measure of its magnitude, and it must be read in light of the number of studies behind it.
How Q feeds the I-squared statistic and tau-squared
Because the raw Q statistic is hard to interpret across analyses of different sizes, modern reporting transforms it into quantities that describe how much heterogeneity exists. The I-squared statistic is computed directly from Q and its degrees of freedom: it rescales Q to express the percentage of total variation across studies that is due to real differences rather than chance, on a fixed zero to one hundred percent scale that does not depend on the number of studies. Our deeper guide to quantifying inconsistency between studies walks through that conversion and its common thresholds.
Q is also the starting point for estimating tau-squared, the between-study variance. Where I-squared expresses heterogeneity as a proportion, tau-squared expresses it as an absolute variance on the effect scale, and the most widely used DerSimonian and Laird estimator derives tau-squared from Q, the degrees of freedom, and the study weights. That estimated between-study variance is exactly what is added back into the weights in a random-effects model, and it is also what determines the width of a plausible range for a future study's effect. You can see all three quantities reported together when you run pooled counts through our pooled-effect computation tool.
From the Q test to choosing a random-effects model
The most consequential use of Cochran's Q is helping decide how to combine the studies in the first place. A fixed-effect model assumes one shared true effect, so it is only defensible when heterogeneity is negligible; a random-effects model assumes the true effect varies across studies and folds the estimated tau-squared into the weights. A significant Q, especially when paired with a substantial I-squared, is a signal that the fixed-effect assumption is shaky and that a random-effects approach is more honest. Our comparison of the two pooling philosophies explains why the choice is conceptual and not purely a reaction to one p-value.
- Treat a non-significant Q with few studies cautiously, since low power can hide real differences.
- Treat a significant Q with many studies cautiously, since trivial differences can reach significance.
- Report Q, its degrees of freedom, the p-value, I-squared, and tau-squared together so readers can judge both the presence and the magnitude of heterogeneity.
- Let the body of evidence and clinical reasoning, not a single threshold, drive the decision to use a random-effects model.
If you are still orienting to the wider workflow, our overview of how pooled evidence is synthesised sets the context in which the Q test sits, from extracting effects to displaying the final summary.
A note on the other Cochran's Q test
It is worth disambiguating one source of confusion. There is a separate, unrelated Cochran's Q test for related categorical samples, which is a generalisation of the McNemar test to three or more matched binary measurements, for example the same subjects rated under several conditions or by several raters. That test asks whether the proportion of successes differs across the related conditions, and it lives in the world of repeated-measures categorical data, not evidence synthesis. Although both carry the Cochran name, the heterogeneity statistic described throughout this article is the one that matters for meta-analysis, and the two should never be conflated in a methods section.