Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Inverse-variance pooling of aggregate study-level effect estimates

theta_hat = sum_(i=1)^k [w_i * y_i] / sum_(i=1)^k [w_i]

Maps the effect estimate and its variance from each of k studies to one pooled estimate, its standard error and measures of between-study heterogeneity. Each study is weighted by the inverse of the variance of its estimate, so more precise studies count for more. Under a common-effect model the weight uses the within-study variance alone; under a random-effects model it also includes the between-study variance tau2. In health technology assessment the pooled relative effect, usually a log hazard ratio or log odds ratio, is then applied to a baseline from another source in a decision model.

  • Common-effect inverse-variance pooled estimate and standard error

    theta_F = sum_(i=1)^k [y_i / v_i] / sum_(i=1)^k [1 / v_i]; SE_F = sqrt(1 / sum_(i=1)^k [1 / v_i])

    Pools the study estimates y_i with weights equal to the inverse of their variances v_i, under the assumption that every study estimates the same underlying effect. The weight of study i is 1/v_i, and the standard error of the pooled estimate is the square root of one over the summed weights. For a ratio measure the result is on the log scale and is exponentiated for presentation.

  • Cochran's Q statistic for an aggregate data meta-analysis

    Q = sum_(i=1)^k [(y_i - theta_F)^2 / v_i]

    Sums each study's squared deviation from the common-effect estimate, weighted by the inverse of its variance. Under the common-effect model Q follows approximately a chi-squared distribution with k-1 degrees of freedom, so values well above k-1 suggest heterogeneity. Q is the input to I-squared and to the DerSimonian and Laird estimate of tau2.

  • I-squared from Cochran's Q in an aggregate data meta-analysis

    I2 = max(0, (Q - (k - 1)) / Q) * 100

    Rescales Q to the percentage of total variation across studies attributed to heterogeneity rather than chance. Negative values, which arise when Q is below its degrees of freedom, are set to zero so that the result lies between 0% and 100%.

  • DerSimonian and Laird between-study variance estimate

    tau2 = max(0, (Q - (k - 1)) / (sum_(i=1)^k [1 / v_i] - sum_(i=1)^k [1 / v_i^2] / sum_(i=1)^k [1 / v_i]))

    The moment-based estimate of the between-study variance tau2, the simplest of the available estimators. The excess of Q over its degrees of freedom is divided by a scaling term built from the common-effect weights 1/v_i, and the result is truncated at zero.

  • Random-effects inverse-variance pooled mean and standard error

    theta_R = sum_(i=1)^k [y_i / (v_i + tau2)] / sum_(i=1)^k [1 / (v_i + tau2)]; SE_R = sqrt(1 / sum_(i=1)^k [1 / (v_i + tau2)])

    Pools the study estimates with weights 1/(v_i + tau2), so that the between-study variance is added to each study's own variance. The result estimates the mean of a distribution of true effects rather than one common effect. Larger tau2 makes the weights more equal and the standard error larger.

  • Random-effects prediction interval for the effect in a new setting

    PI_low = theta_R - t_crit * sqrt(tau2 + SE_R^2); PI_high = theta_R + t_crit * sqrt(tau2 + SE_R^2)

    Gives an approximate 95% range for the true effect in a new study or setting, combining the between-study variance with the squared standard error of the random-effects mean and using the 97.5th percentile of a t distribution with k-1 degrees of freedom. The square root term is also the standard deviation of the predictive distribution that NICE DSU TSD 3 suggests may be more relevant to decision making than the distribution of the mean.