Sensitivity analysis assuming different prior distributions for the two main parameters of a Bayesian meta-analysis (i.e., the overall effect and the heterogeneity of effect sizes across studies).
meta_sensitivity(
y,
SE,
labels,
data,
d_list,
tau_list,
analysis = "bma",
combine_priors = "crossed",
...
)
effect size per study. Can be provided as (1) a numeric vector, (2)
the quoted or unquoted name of the variable in data
, or (3) a
formula
to include discrete or continuous moderator
variables.
standard error of effect size for each study. Can be a numeric
vector or the quoted or unquoted name of the variable in data
optional: character values with study labels. Can be a
character vector or the quoted or unquoted name of the variable in
data
data frame containing the variables for effect size y
,
standard error SE
, labels
, and moderators per study.
a list
of prior distributions specified via prior()
for the overall effect size (mean) across studies
a list
of prior distributions specified via prior()
for the heterogeneity (SD) of effect sizes across studies
which type of meta-analysis should be performed for analysis? Can be one of the following:
"fixed"
for fixed-effects model, see meta_fixed()
"random"
for random-effects model, see meta_random()
"bma"
for model averaging, see meta_bma()
either "matched"
, in which case the analysis
includes the matched pairwise combinations of the prior distributions
specified in d_list
and tau_list
, or crossed
, in
which case the analysis uses all possible pairwise combinations of priors.
further arguments passed to the function specified in analysis
.
an object of the S3 class meta_sensitivity
, that is, a list of fitted
meta-analysis models. Results can be printed or plotted using
plot.meta_sensitivity()
.
# \donttest{
data(towels)
sensitivity <- meta_sensitivity(
y = logOR, SE = SE, labels = study, data = towels,
d_list = list(prior("cauchy", c(0, .707)),
prior("norm", c(0, .5)),
prior("norm", c(.5, .3))),
tau_list = list(prior("invgamma", c(1, 0.15), label = "tau"),
prior("gamma", c(1.5, 3), label = "tau")),
analysis = "random",
combine_priors = "crossed")
#> Warning: There were 1 divergent transitions after warmup. See
#> https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#> to find out why this is a problem and how to eliminate them.
#> Warning: Examine the pairs() plot to diagnose sampling problems
#> Warning: There were 3 divergent transitions after warmup. See
#> https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#> to find out why this is a problem and how to eliminate them.
#> Warning: Examine the pairs() plot to diagnose sampling problems
#> Warning: There were 6 divergent transitions after warmup. See
#> https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#> to find out why this is a problem and how to eliminate them.
#> Warning: Examine the pairs() plot to diagnose sampling problems
print(sensitivity, digits = 2)
#> ### Sensitivity analysis for Bayesian meta-analysis ###
#>
#> Prior distributions on d (= overall effect size):
#>
#> [1] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [2] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [3] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [4] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [5] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#> [6] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#>
#> Prior distributions on tau (= SD of effect sizes):
#>
#> [1] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [2] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [3] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [4] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [5] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [6] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#>
#> Parameter estimates:
#>
#> prior mean sd 2.5% 50% 97.5% hpd95_lower hpd95_upper n_eff Rhat
#> d1 1 0.20 0.106 -0.023 0.20 0.39 -0.01439 0.40 4090 1
#> d2 2 0.18 0.124 -0.095 0.19 0.40 -0.08173 0.41 3790 1
#> d3 3 0.19 0.111 -0.048 0.20 0.39 -0.02611 0.41 3616 1
#> d4 4 0.18 0.129 -0.101 0.19 0.40 -0.07736 0.42 1976 1
#> d5 5 0.24 0.095 0.048 0.24 0.42 0.04690 0.42 6443 1
#> d6 6 0.24 0.109 0.018 0.24 0.46 0.01496 0.45 4730 1
#> tau1 1 0.13 0.096 0.034 0.11 0.39 0.02130 0.32 4136 1
#> tau2 2 0.18 0.144 0.015 0.15 0.56 0.00040 0.46 2874 1
#> tau3 3 0.14 0.122 0.033 0.11 0.43 0.02215 0.35 745 1
#> tau4 4 0.18 0.142 0.015 0.14 0.55 0.00055 0.46 2658 1
#> tau5 5 0.13 0.088 0.033 0.10 0.36 0.01967 0.29 4607 1
#> tau6 6 0.17 0.141 0.013 0.14 0.53 0.00011 0.42 2811 1
#>
#> Posterior model probabilities:
#>
#> random_H0 random_H1
#> prior1 0.55 0.45
#> prior2 0.63 0.37
#> prior3 0.41 0.59
#> prior4 0.50 0.50
#> prior5 0.38 0.62
#> prior6 0.47 0.53
par(mfrow = c(1,2))
plot(sensitivity, "d", "prior")
#> Prior distributions on d (= overall effect size):
#>
#> [1] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [2] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [3] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [4] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [5] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#> [6] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#>
#> Prior distributions on tau (= SD of effect sizes):
#>
#> [1] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [2] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [3] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [4] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [5] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [6] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
plot(sensitivity, "d", "posterior")
#> Prior distributions on d (= overall effect size):
#>
#> [1] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [2] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [3] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [4] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [5] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#> [6] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#>
#> Prior distributions on tau (= SD of effect sizes):
#>
#> [1] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [2] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [3] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [4] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [5] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [6] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
plot(sensitivity, "tau", "prior")
#> Prior distributions on d (= overall effect size):
#>
#> [1] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [2] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [3] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [4] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [5] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#> [6] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#>
#> Prior distributions on tau (= SD of effect sizes):
#>
#> [1] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [2] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [3] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [4] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [5] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [6] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
plot(sensitivity, "tau", "posterior")
#> Prior distributions on d (= overall effect size):
#>
#> [1] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [2] "'t' (location=0, scale=0.707, nu=1) with support on the interval [-Inf,Inf]."
#> [3] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [4] "'norm' (mean=0, sd=0.5) with support on the interval [-Inf,Inf]."
#> [5] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#> [6] "'norm' (mean=0.5, sd=0.3) with support on the interval [-Inf,Inf]."
#>
#> Prior distributions on tau (= SD of effect sizes):
#>
#> [1] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [2] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [3] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [4] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
#> [5] "'invgamma' (shape=1, scale=0.15) with support on the interval [0,Inf]."
#> [6] "'gamma' (shape=1.5, rate=3) with support on the interval [0,Inf]."
# }