| metahet | R Documentation | 
Calculates various between-study heterogeneity measures in meta-analysis, including the conventional measures (e.g., I^2) and the alternative measures (e.g., I_r^2) which are robust to outlying studies; p-values of various tests are also calculated.
metahet(y, s2, data, n.resam = 1000)
| y | a numeric vector specifying the observed effect sizes in the collected studies; they are assumed to be normally distributed. | 
| s2 | a numeric vector specifying the within-study variances. | 
| data | an optional data frame containing the meta-analysis dataset. If  | 
| n.resam | a positive integer specifying the number of resampling iterations for calculating p-values of test statistics and 95% confidence interval of heterogeneity measures. | 
Suppose that a meta-analysis collects n studies. The observed effect size in study i is y_i and its within-study variance is s^{2}_{i}. Also, the inverse-variance weight is w_i = 1 / s^{2}_{i}. The fixed-effect estimate of overall effect size is \bar{\mu} = \sum_{i = 1}^{n} w_i y_i / \sum_{i = 1}^{n} w_i. The conventional test statistic for heterogeneity is
Q = \sum_{i = 1}^{n} w_i (y_{i} - \bar{\mu})^2.
Based on the Q statistic, the method-of-moments estimate of the between-study variance \hat{\tau}_{DL}^2 is (DerSimonian and Laird, 1986)
\hat{\tau}^2_{DL} = \max \left\{ 0, \frac{Q - (n - 1)}{\sum_{i = 1}^{n} w_{i} - \sum_{i = 1}^{n} w_{i}^{2} / \sum_{i = 1}^{n} w_{i}} \right\}.
Also, the H and I^2 statistics (Higgins and Thompson, 2002; Higgins et al., 2003) are widely used in practice because they do not depend on the number of collected studies n and the effect size scale; these two statistics are defined as
H = \sqrt{Q/(n - 1)};
I^{2} = \frac{Q - (n - 1)}{Q}.
Specifically, the H statistic reflects the ratio of the standard deviation of the underlying mean from a random-effects meta-analysis compared to the standard deviation from a fixed-effect meta-analysis; the I^2 statistic describes the proportion of total variance across studies that is due to heterogeneity rather than sampling error.
Outliers are frequently present in meta-analyses, and they may have great impact on the above heterogeneity measures. Alternatively, to be more robust to outliers, the test statistic may be modified as (Lin et al., 2017):
Q_{r} = \sum_{i = 1}^{n} \sqrt{w_i} |y_{i} - \bar{\mu}|.
Based on the Q_r statistic, the method-of-moments estimate of the between-study variance \hat{\tau}_r^2 is defined as the solution to
Q_r \sqrt{\frac{\pi}{2}} = \sum_{i = 1}^{n} \left\{1 - \frac{w_{i}}{\sum_{j = 1}^{n} w_{j}} + \tau^{2} \left[ w_{i} - \frac{2 w_{i}^{2}}{\sum_{j = 1}^{n} w_{j}} + \frac{w_{i} \sum_{j = 1}^{n} w_{j}^{2}}{(\sum_{j = 1}^{n} w_{j})^2} \right]\right\}.
If no positive solution exists to the equation above, set \hat{\tau}_{r}^{2} = 0. The counterparts of the H and I^2 statistics are defined as
H_{r} = Q_r \sqrt{\pi/[2 n (n - 1)]};
I_{r}^{2} = \frac{Q_{r}^{2} - 2 n (n - 1) / \pi}{Q_{r}^{2}}.
To further improve the robustness of heterogeneity assessment, the weighted mean in the Q_r statistic may be replaced by the weighted median \hat{\mu}_m, which is the solution to \sum_{i = 1}^{n} w_i [I (\theta \geq y_i) - 0.5] = 0 with respect to \theta. The new test statistic is
Q_m = \sum_{i = 1}^{n} \sqrt{w_i} |y_{i} - \hat{\mu}_m|.
Based on Q_m, the new estimator of the between-study variance \hat{\tau}_m^2 is the solution to
Q_m \sqrt{\pi/2} = \sum_{i = 1}^{n} \sqrt{(s_i^2 + \tau^2)/s_i^2}.
The counterparts of the H and I^2 statistics are
H_m = \frac{Q_m}{n} \sqrt{\pi/2};
I_m^2 = \frac{Q_m^2 - 2 n^2/\pi}{Q_m^2}.
This function returns a list containing p-values of various heterogeneity tests and various heterogeneity measures with 95% confidence intervals. Specifically, the components include:
| p.Q | p-value of the  | 
| p.Q.theo | p-value of the  | 
| p.Qr | p-value of the  | 
| p.Qm | p-value of the  | 
| Q | the  | 
| ci.Q | 95% CI of the  | 
| tau2.DL | DerSimonian–Laird estimate of the between-study variance. | 
| ci.tau2.DL | 95% CI of the between-study variance based on the DerSimonian–Laird method. | 
| H | the  | 
| ci.H | 95% CI of the  | 
| I2 | the  | 
| ci.I2 | 95% CI of the  | 
| Qr | the  | 
| ci.Qr | 95% CI of the  | 
| tau2.r | the between-study variance estimate based on the  | 
| ci.tau2.r | 95% CI of the between-study variance based on the  | 
| Hr | the  | 
| ci.Hr | 95% CI of the  | 
| Ir2 | the  | 
| ci.Ir2 | 95% CI of the  | 
| Qm | the  | 
| ci.Qm | 95% CI of the  | 
| tau2.m | the between-study variance estimate based on the  | 
| ci.tau2.m | 95% CI of the between-study variance based on the  | 
| Hm | the  | 
| ci.Hm | 95% CI of the  | 
| Im2 | the  | 
| ci.Im2 | 95% CI of the  | 
DerSimonian R, Laird N (1986). "Meta-analysis in clinical trials." Controlled Clinical Trials, 7(3), 177–188. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0197-2456(86)90046-2")}>
Higgins JPT, Thompson SG (2002). "Quantifying heterogeneity in a meta-analysis." Statistics in Medicine, 21(11), 1539–1558. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/sim.1186")}>
Higgins JPT, Thompson SG, Deeks JJ, Altman DG (2003). "Measuring inconsistency in meta-analyses." BMJ, 327(7414), 557–560. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1136/bmj.327.7414.557")}>
Lin L, Chu H, Hodges JS (2017). "Alternative measures of between-study heterogeneity in meta-analysis: reducing the impact of outlying studies." Biometrics, 73(1), 156–166. <\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/biom.12543")}>
data("dat.aex")
set.seed(1234)
metahet(y, s2, dat.aex, 100)
metahet(y, s2, dat.aex, 1000)
data("dat.hipfrac")
set.seed(1234)
metahet(y, s2, dat.hipfrac, 100)
metahet(y, s2, dat.hipfrac, 1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.