Viechtbauer 2010 - tau2 Estimators, Q-Test and Heterogeneity Statistics
Summary
Random and mixed-effects models are fitted in two steps: estimate , then weight by . metafor offers seven estimators (HS, HE, DL, SJ, ML, REML, EB), defaulting to REML. This note states the DerSimonian-Laird estimator, Cochran’s , and the Higgins-Thompson and formally (from the cited foundational papers), and records how metafor computes and truncates them.
Overview
The paper only names the estimators and cites sources (Sec. 2.4, 3.3); closed-form formulas for DL and the Higgins-Thompson measures are given here as foundational concepts, attributed to DerSimonian and Laird (1986) Controlled Clinical Trials 7(3):177-188 and Higgins and Thompson (2002) Statistics in Medicine 21(11):1539-1558. These are standard statements, not text of the metafor paper; the IntHout et al. paper reproduces the DL formulas in its Appendix 1 (IntHout 2014 - HKSJ and DerSimonian-Laird Formal Specification).
Main Content
The estimator menu (method= argument)
| Code | Estimator | Source cited | Form |
|---|---|---|---|
HS | Hunter-Schmidt | Hunter and Schmidt (2004); general version Viechtbauer (2005) | closed form |
HE | Hedges | Hedges and Olkin (1985); Raudenbush (2009) | closed form |
DL | DerSimonian-Laird | DerSimonian and Laird (1986) | closed form |
SJ | Sidik-Jonkman | Sidik and Jonkman (2005a,b) | closed form (never negative) |
ML | Maximum likelihood | Viechtbauer (2005) | iterative (Fisher scoring) |
REML | Restricted maximum likelihood (default) | Viechtbauer (2005); “approximately unbiased and quite efficient” | iterative |
EB | Empirical Bayes | Morris (1983); Berkey et al. (1995) | iterative |
FE | Fixed effects () | n/a | n/a |
Cochran’s Q
Cochran's (Hedges and Olkin 1985)
With fixed-effects weights and ,
Under , . For mixed models the analogue tests residual heterogeneity (reported as ). The paper prefers the -test over a (boundary-adjusted) likelihood-ratio test for because it controls Type I error better (Viechtbauer 2007b).
DerSimonian-Laird
DerSimonian-Laird (1986) method-of-moments estimator
Let and as above. Then , so equating to its expectation gives
Proof sketch. With random, and has variance . Using gives .
The random-effects mean is then with and, in the classical DL analysis, with normal-based tests (the Knapp-Hartung/HKSJ correction is in IntHout 2014 - HKSJ and DerSimonian-Laird Formal Specification).
Higgins-Thompson heterogeneity statistics
, (Higgins and Thompson 2002)
Let the typical within-study variance be
Population-level definitions (used by metafor with plugged in):
The -based sample versions are and . is the share of total variability in the attributable to heterogeneity; and .
metafor output “I^2 (% of total variability due to heterogeneity)” and “H^2 (total variability / within-study variance)” use the first (population) forms; Viechtbauer warns that , , “are often estimated imprecisely, especially when the number of studies is small” and offers confint() for CIs: for BCG, 95% CI 0.1197 to 1.1115, 81.92% to 97.68%, 5.53 to 43.07 (CI method from Viechtbauer 2007a).
Computation and truncation (Sec. 3.6)
- HS, HE, DL, SJ are closed form; ML, REML, EB use Fisher scoring (Harville 1977; Jennrich and Sampson 1976): robust to poor starts, default start = Hedges estimate, stop when , max 100 iterations (
control=list(tau2.init, threshold, maxiter, stepadj, verbose)). - All estimators except SJ can be negative. HS/HE/DL truncate at 0; ML/REML/EB use step-halving to stay non-negative.
control=list(tau2.min=)changes the bound; technically only is needed (footnote 6), but is of interpretive interest so negative values are avoided. - Zero sampling variances break some estimators (weight ); unweighted fitting is a workaround. A “singular matrix” error means collinear moderators.
Examples
DL, REML and on the BCG data
Using the 13 log relative risks of Viechtbauer 2010 - BCG Vaccine Worked Example: , , , so the DL denominator is and (computed here; the paper reports REML 0.3132). The -based versus the REML-plug-in reported by metafor, with typical and . Different estimators, slightly different answers: the choice of estimator is itself a (small) analytic decision.
import numpy as np
from scipy import optimize
def dl_tau2(y, v):
w = 1/v; mu = (w*y).sum()/w.sum(); Q = (w*(y-mu)**2).sum(); k = len(y)
return max(0, (Q-(k-1))/(w.sum()-(w**2).sum()/w.sum())), Q
def reml_tau2(y, v):
f = lambda t: .5*(np.log(v+t).sum() + np.log((1/(v+t)).sum())
+ ((y-((y/(v+t)).sum()/(1/(v+t)).sum()))**2/(v+t)).sum())
return optimize.minimize_scalar(f, bounds=(0,5), method="bounded").x
def i2_h2(tau2, v):
w = 1/v; k = len(v); s2 = (k-1)*w.sum()/(w.sum()**2-(w**2).sum())
return tau2/(tau2+s2), (tau2+s2)/s2Connections
- DL’s known failure with few studies (inflated Type I error because is treated as known) motivates IntHout 2014 - HKSJ and DerSimonian-Laird Formal Specification and the fully Bayesian treatment in Roever 2020 - Marginal Likelihood and Conditional Posteriors.
- In marketing measurement, across geo tests is the quantity that tells you how far a new market’s lift may deviate from the average, and a zero or near-zero from a handful of tests is more likely a small- artefact than evidence of homogeneity (Röver notes 57% of Cochrane heterogeneity estimates were exactly zero: Roever 2020 - Overview and Motivation of Bayesian Meta-Analysis).
- See Power Analysis and Sample Size for why few-study meta-analyses have little power to detect heterogeneity.