FBartos / RoBMA

RoBMA R package for estimating robust Bayesian meta-analyses
https://fbartos.github.io/RoBMA/
8 stars 3 forks source link

A simple example for RoBMA.reg()? #33

Closed ghost closed 11 months ago

ghost commented 11 months ago

I'm interested in trying robust Bayesian meta-regression for a publication but couldn't really ascertain how to perform it with this package. Let's say I want to perform the robust Bayesian version of a classical random-effects meta-regression to predict the effects size based on the risk-of-bias level of studies and the type of intervention. So basically, I want to reproduce the code below with RoBMA.reg()

library(metafor)

data("ThirdWave", package = "dmetar")

freq_meta_reg <- rma(
  yi = TE,
  sei = seTE,
  mods = ~ RiskOfBias + InterventionType ,
  data = ThirdWave
)

freq_meta_reg

Mixed-Effects Model (k = 18; tau^2 estimator: REML)

tau^2 (estimated amount of residual heterogeneity):     0.0717 (SE = 0.0472)
tau (square root of estimated tau^2 value):             0.2677
I^2 (residual heterogeneity / unaccounted variability): 59.93%
H^2 (unaccounted variability / sampling variability):   2.50
R^2 (amount of heterogeneity accounted for):            12.56%

Test for Residual Heterogeneity:
QE(df = 14) = 33.8998, p-val = 0.0021

Test of Moderators (coefficients 2:4):
QM(df = 3) = 5.2801, p-val = 0.1524

Model Results:

                             estimate      se     zval    pval    ci.lb   ci.ub      
intrcpt                        1.0753  0.2575   4.1761  <.0001   0.5706  1.5800  *** 
RiskOfBiaslow                 -0.3061  0.1863  -1.6432  0.1003  -0.6712  0.0590      
InterventionTypemindfulness   -0.3414  0.2397  -1.4243  0.1544  -0.8113  0.1284      
InterventionTypePCI           -0.4137  0.3107  -1.3315  0.1830  -1.0226  0.1953      

---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

This model analyses the effect of RiskOfBias and InterventionType on standardized mean differences / effect sizes. How can I specify the parameters in RoBMA.reg() to conduct a similar analysis?

Thanks!

FBartos commented 11 months ago

Hi Çağrı,

This is a good question. Fitting meta-regression with RoBMA is slightly more involved and I should add the corresponding vignette soon.

Using your example, you first need to create a new data set that renames the outcome and standard error as d and se so the RoBMA function automatically identifies the effect size measure and the standard error:

data("ThirdWave", package = "dmetar")
library(RoBMA)
df_reg <- data.frame(
  d                = ThirdWave$TE,   # name "d" directly forwards the effect size in RoBMA as Cohen's d
  se               = ThirdWave$seTE, # name "se" directly forwards into the standard error in RoBMA
  RiskOfBias       = ThirdWave$RiskOfBias,
  InterventionType = ThirdWave$InterventionType
)

Then you fit the RoBMA meta-regression using the following command:

fit.RoBMA <- RoBMA.reg(~ RiskOfBias + InterventionType, data = df_reg, parallel = TRUE)

This will definitely take a while as you need to estimate 144 models. (You can first fit a smaller test model by reducing the number of chains, iterations etc by adding ..., sample = 2000, chains = 1)

The important thing is that the default RoBMA output,


> summary(fit.RoBMA)
Robust Bayesian meta-regression
Components summary:
               Models Prior prob. Post. prob. Inclusion BF
Effect         72/144       0.500       0.214        0.273
Heterogeneity  72/144       0.500       0.311        0.452
Bias          128/144       0.500       0.998      407.889

Meta-regression components summary:
                 Models Prior prob. Post. prob. Inclusion BF
RiskOfBias       72/144       0.500       0.224        0.288
InterventionType 72/144       0.500       0.196        0.244

Model-averaged estimates:
                   Mean Median  0.025  0.975
mu                0.009  0.000 -0.263  0.276
tau               0.036  0.000  0.000  0.213
omega[0,0.025]    1.000  1.000  1.000  1.000
omega[0.025,0.05] 1.000  1.000  1.000  1.000
omega[0.05,0.5]   1.000  1.000  1.000  1.000
omega[0.5,0.95]   0.999  1.000  1.000  1.000
omega[0.95,0.975] 0.999  1.000  1.000  1.000
omega[0.975,1]    0.999  1.000  1.000  1.000
PET               0.878  0.000  0.000  3.790
PEESE             6.889  9.518  0.000 12.522
The estimates are summarized on the Cohen's d scale (priors were specified on the Cohen's d scale).
(Estimated publication weights omega correspond to one-sided p-values.)

Model-averaged meta-regression estimates:
                                      Mean Median  0.025 0.975
intercept                            0.009  0.000 -0.263 0.276
RiskOfBias [dif: high]               0.007  0.000 -0.050 0.112
RiskOfBias [dif: low]               -0.007  0.000 -0.112 0.050
InterventionType [dif: ACT]          0.016  0.000 -0.039 0.202
InterventionType [dif: mindfulness] -0.015  0.000 -0.164 0.009
InterventionType [dif: PCI]         -0.001  0.000 -0.114 0.107
The estimates are summarized on the Cohen's d scale (priors were specified on the Cohen's d scale).

has a different meaning than the default meta for output. The intercept (and the Bayes factor for the Effect) correspond to the average effect, i.e., across factor levels, while the metafor intercept corresponds to the meta-analytic effect size estimate in the default factor categories.

The Meta-regression components summary gives you a test for differences within the factor levels and Model-averaged meta-regression estimates gives you estimates for differences between the individual factor levels and the mean effect)

You can also test whether the marginal effect size estimates for the individual factor levels (adjusted for other factors, bias, etc differ from zero using,

> marginal_summary(fit.RoBMA)
Robust Bayesian meta-analysis
Model-averaged marginal estimates:
                                Mean Median  0.025 0.975 Inclusion BF
intercept                      0.009  0.000 -0.263 0.276        0.266
RiskOfBias[high]               0.016  0.000 -0.259 0.307        0.192
RiskOfBias[low]                0.003  0.000 -0.270 0.248        0.191
InterventionType[ACT]          0.025  0.000 -0.257 0.334        0.304
InterventionType[mindfulness] -0.006  0.000 -0.285 0.246        0.282
InterventionType[PCI]          0.009  0.000 -0.274 0.278        0.263
The estimates are summarized on the Cohen's d scale (priors were specified on the Cohen's d scale).

Cheers, Frantisek

ghost commented 11 months ago

Thanks František, that was really helpful!