| name | mediation-meta-analyst |
| description | Meta-analysis frameworks and methods for mediation studies |
Mediation Meta-Analyst
Methods for synthesizing mediation effects across multiple studies
Use this skill when working on: meta-analysis of indirect effects, cross-study effect aggregation, heterogeneity assessment in mediation, individual participant data (IPD) meta-analysis, or systematic reviews of mediation studies.
Meta-Analysis Fundamentals
Why Meta-Analysis of Mediation is Challenging
| Challenge | Description | Solution Approach |
|---|
| Non-normal effects | Product $ab$ is not normally distributed | Use appropriate pooling methods |
| Correlated paths | $a$ and $b$ may be correlated | Model correlation structure |
| Heterogeneity | Effects vary across studies | Random effects models |
| Missing information | Studies report different statistics | Imputation or subset analysis |
| Publication bias | Small studies with null effects unpublished | Sensitivity analysis |
Effect Size Measures
| Measure | Formula | Use Case |
|---|
| Unstandardized $ab$ | $a \times b$ | Same scales across studies |
| Partially standardized | $a \times b / SD_Y$ | Standardize by outcome only |
| Fully standardized | $a' \times b'$ (standardized coefficients) | Different scales |
| $R^2_{med}$ | Proportion of effect mediated | Bounded measure |
Aggregate Data Meta-Analysis
Fixed Effects Model
When assuming homogeneous true effects, the pooled estimate is:
$$\hat{\theta}_{FE} = \frac{\sum_i w_i \hat{\theta}_i}{\sum_i w_i}, \quad w_i = \frac{1}{\text{SE}_i^2}$$
This pooled estimate uses inverse-variance weights to optimally combine study-specific estimates.
Random Effects Model
When true effects vary across studies, the pooled estimate incorporates between-study variance:
$$\hat{\theta}_{RE} = \frac{\sum_i w_i^* \hat{\theta}_i}{\sum_i w_i^}, \quad w_i^ = \frac{1}{\text{SE}_i^2 + \hat{\tau}^2}$$
where $\hat{\tau}^2$ is the between-study variance (tau-squared). The pooled estimate under random effects provides a more generalizable result when heterogeneity is present.
Heterogeneity Assessment
Key statistics for assessing heterogeneity:
| Statistic | Formula | Interpretation |
|---|
| Q statistic | $Q = \sum_i w_i(\hat{\theta}_i - \hat{\theta})^2$ | Test for heterogeneity |
| I-squared ($I^2$) | $I^2 = \max(0, \frac{Q - (k-1)}{Q})$ | % variance due to heterogeneity |
| tau-squared ($\tau^2$) | Between-study variance | Absolute heterogeneity |
| H-squared | $H^2 = Q/(k-1)$ | Relative excess variance |
The I-squared statistic ranges from 0-100%: <25% indicates low heterogeneity, 25-75% moderate, and >75% high heterogeneity. The tau-squared provides the absolute magnitude of between-study variance.
R Implementation
meta_indirect <- function(effects, se, study_names = NULL,
method = c("RE", "FE")) {
method <- match.arg(method)
k <- length(effects)
if (is.null(study_names)) {
study_names <- paste0("Study ", 1:k)
}
w_fe 1 se
theta_fe w_fe effects w_fe
Q w_fe effects theta_fe
df k
I2 Q df Q
w_fe w_fe w_fe
tau2 Q df
method
weights w_fe
pooled theta_fe
se_pooled w_fe
weights 1 se tau2
pooled weights effects weights
se_pooled weights
ci pooled se_pooled
p_het 1 pchisqQ df
pooled_effect pooled
se se_pooled
ci ci
z pooled se_pooled
p_value pnormpooled se_pooled
heterogeneity
Q Q
df df
p p_het
I2 I2
tau2 tau2
study_data data.frame
study study_names
effect effects
se se
weight weights weights
method method
Multivariate Meta-Analysis
Pooling Correlated Effects
When studies report both $a$ and $b$ paths:
$$\begin{pmatrix} \hat{a} \ \hat{b} \end{pmatrix} \sim N\left(\begin{pmatrix} a \ b \end{pmatrix}, \Sigma\right)$$
Two-Stage Approach
Stage 1: Extract path coefficients from each study
Stage 2: Pool using multivariate random effects
multivariate_meta_mediation <- function(a_effects, b_effects,
a_se, b_se, ab_cor = 0) {
library(metafor)
k <- length(a_effects)
V_list <- lapply(1:k, function(i) {
cov_ab <- ab_cor * a_se[i] * b_se[i
matrixa_sei cov_ab cov_ab b_sei
yi rbinda_effects b_effects
vi unlistlapplyV_list as.vector
V bldiagV_list
effect_type k
study_id k each
fit rma.mvyi yi V V
mods effect_type
random effect_type study_id
struct
data data.frameyi effect_type study_id
pooled_a coeffit
pooled_b coeffit
vcov_pooled vcovfit
indirect pooled_a pooled_b
grad pooled_b pooled_a
se_indirect tgrad vcov_pooled grad
pooled_a pooled_a
pooled_b pooled_b
pooled_indirect indirect
se_indirect se_indirect
ci_indirect indirect se_indirect
model_fit fit
Individual Participant Data (IPD) Meta-Analysis
One-Stage Approach
Pool all data and fit single model with study-level random effects:
ipd_meta_mediation <- function(data, study_var, treatment, mediator, outcome) {
library(lme4)
m_formula <- as.formula(paste(
mediator, "~", treatment, "+ (1 +", treatment, "|", study_var, ")"
))
m_model <- lmer(m_formula, data = data)
y_formula as.formulapaste
outcome treatment mediator
treatment mediator study_var
y_model lmery_formula data data
a fixefm_modeltreatment
b fixefy_modelmediator
c_prime fixefy_modeltreatment
indirect a b
boot_indirect replicate
boot_idx samplenrowdata replace
boot_data databoot_idx
m_boot tryCatch
lmerm_formula data boot_data
error e
y_boot tryCatch
lmery_formula data boot_data
error e
m_boot y_boot
fixefm_boottreatment fixefy_bootmediator
boot_indirect boot_indirectboot_indirect
pooled_a a
pooled_b b
pooled_c_prime c_prime
pooled_indirect indirect
pooled_total indirect c_prime
se_indirect sdboot_indirect
ci_indirect quantileboot_indirect
n_studies uniquedatastudy_var
n_total nrowdata
m_model m_model
y_model y_model
Two-Stage Approach
Estimate effects within each study, then pool:
two_stage_ipd <- function(data, study_var, treatment, mediator, outcome) {
studies <- unique(data[[study_var]])
k <- length(studies)
study_results <- lapply(studies, function(s) {
study_data <- data[data[[study_var]] == s, ]
m_model <- lm(as.formula(paste(mediator, "~", treatment) data study_data
y_model lmas.formulapasteoutcome treatment mediator
data study_data
a coefm_modeltreatment
b coefy_modelmediator
se_a vcovm_modeltreatment treatment
se_b vcovy_modelmediator mediator
se_indirect a se_b b se_a
data.frame
study s
n nrowstudy_data
a a
b b
indirect a b
se_a se_a
se_b se_b
se_indirect se_indirect
study_df do.callrbind study_results
meta_result meta_indirect
effects study_dfindirect
se study_dfse_indirect
study_names study_dfstudy
method
stage1 study_df
stage2 meta_result
pooled_indirect meta_resultpooled_effect
ci meta_resultci
I2 meta_resultheterogeneityI2
Publication Bias
Detection Methods
| Method | Description | Limitation |
|---|
| Funnel plot | SE vs effect plot | Visual, subjective |
| Egger's test | Regression of effect on SE | Low power |
| Trim-and-fill | Impute missing studies | Assumes specific mechanism |
| PET-PEESE | Conditional regression | Requires assumptions |
| Selection models | Model publication process | Complex, sensitive |
R Implementation
publication_bias_mediation <- function(effects, se) {
library(metafor)
res <- rma(yi = effects, sei = se, method = "REML")
funnel_data <- data.frame(
effect = effects,
se = se,
precision = 1/se
)
egger <- regtest(res, model = "lm")
tf <- trimfill(res)
pet <- lmeffects se weights se
peese lmeffects Ise weights se
pet_est coefpet
peese_est coefpeese
coefsummarypet
adjusted_estimate peese_est
method_used
adjusted_estimate pet_est
method_used
original_estimate coefres
egger_test
z eggerzval
p eggerpval
interpretation ifelseeggerpval
trim_fill
original_k resk
imputed_k tfk0
adjusted_estimate coeftf
adjusted_ci tfci.lb tfci.ub
pet_peese
pet_estimate pet_est
peese_estimate peese_est
method_used method_used
adjusted_estimate adjusted_estimate
funnel_data funnel_data
Moderator Analysis
Meta-Regression
Test whether study-level characteristics explain heterogeneity:
meta_regression_mediation <- function(effects, se, moderators) {
library(metafor)
mod_formula <- as.formula(paste("~", paste(names(moderators), collapse = " + ")))
res <- rma(yi = effects, sei = se,
mods = mod_formula,
data = moderators,
method = "REML")
res_null rmayi effects sei se method
R2 res_nulltau2 restau2 res_nulltau2
QE_test
QE resQE
df resk resp
p resQEp
coefficients coefsummaryres
tau2_residual restau2
I2_residual resI2
R2 R2
residual_heterogeneity QE_test
model res
Subgroup Analysis
subgroup_analysis <- function(effects, se, subgroup) {
groups <- unique(subgroup)
group_results <- lapply(groups, function(g) {
idx <- subgroup == g
meta_indirect(effects[idx], se[idx], method = "RE")
})
names(group_results) <- groups
group_effects <- sapply(group_results, x xpooled_effect
group_se sapplygroup_results x xse
group_k sapplygroup_results x xstudy_dataeffect
overall meta_indirecteffects se method
Q_total overallheterogeneityQ
Q_within sapplygroup_results x xheterogeneityQ
Q_between Q_total Q_within
df_between groups
p_between 1 pchisqQ_between df_between
subgroup_estimates data.frame
subgroup groups
k group_k
effect group_effects
se group_se
ci_lower group_effects group_se
ci_upper group_effects group_se
test_for_differences
Q_between Q_between
df df_between
p p_between
interpretation ifelsep_between
group_results group_results
Reporting Checklist
PRISMA for Mediation Meta-Analysis
Forest Plot Template
forest_plot_mediation <- function(meta_result) {
library(ggplot2)
df <- meta_result$study_data
df$ci_lower <- df$effect - 1.96 * df$se
df$ci_upper <- df$effect + 1.96 * df$se
pooled <- data.frame(
study = "Pooled",
effect = meta_result$pooled_effect,
se = meta_result$se,
weight = NA,
ci_lower = meta_result$ci[1],
ci_upper = meta_result$ci[
df rbinddf pooled
dfstudy factordfstudy levels revdfstudy
ggplotdf aesx effect y study
geom_vlinexintercept linetype color
geom_pointaessize weight
geom_errorbarhaesxmin ci_lower xmax ci_upper height
geom_pointdata dfdfstudy
shape size color
labs
x
y
title
subtitle sprintf
meta_resultheterogeneityI2
meta_resultheterogeneitytau2
theme_minimal
themelegend.position
References
Meta-Analysis Methods
- Borenstein, M., et al. (2009). Introduction to Meta-Analysis
- Higgins, J. P., & Green, S. (2011). Cochrane Handbook for Systematic Reviews
Mediation Meta-Analysis
- Cheung, M. W. L. (2015). Meta-Analysis: A Structural Equation Modeling Approach
- MacKinnon, D. P. (2008). Introduction to Statistical Mediation Analysis
Publication Bias
- Rothstein, H. R., et al. (2005). Publication Bias in Meta-Analysis
- Stanley, T. D., & Doucouliagos, H. (2014). Meta-regression approximations
Software
- Viechtbauer, W. (2010). Conducting meta-analyses in R with the metafor package
- Cheung, M. W. L. (2015). metaSEM: Meta-analysis using structural equation modeling
Version: 1.0.0
Created: 2025-12-09
Domain: Meta-analysis of mediation effects
Applications: Systematic reviews, research synthesis, evidence aggregation