Skip to contents

Assessment of coverage of posterior intervals for a given weight and evidence level, using simulated data as input.

Usage

oc_coverage(
  m,
  se,
  true_effect,
  weights = seq(0, 1, by = 0.01),
  map_prior,
  sigma,
  n_cores = 1,
  eval_strategy = "sequential"
)

Arguments

m

Numerical vector of simulated effect estimates.

se

Numerical vector of simulated standard errors (m and se need to have the same length).

true_effect

Numerical value, representing the true treatment effect (usually the mean of the simulated m).

weights

Vector of weights of the informative component of the MAP prior (defaults to seq(0, 1, by = 0.01)).

map_prior

A MAP prior containing information about the trials in the source population, created using RBesT; a mixture of normal distributions is required.

sigma

Standard deviation of the weakly informative component of the MAP prior, recommended to be the unit-information standard deviation.

n_cores

Integer value, representing the number of cores to be used (defaults to 1); only applies if eval_strategy is not "sequential".

eval_strategy

Character variable, representing the evaluation strategy, either "sequential", "multisession", or "multicore" (see documentation of future::plan, defaults to "sequential").

Value

A 2-dimensional array containing results on coverage.

See also

[oc_pos()] and [oc_bias()].

Examples

set.seed(123)
n_sims <- 5 # small number for exemplary application 
sim_dat <- list(
  "m" = rnorm(n = n_sims, mean = 1.15, sd = 0.1),
  "se" = rnorm(n = n_sims, mean = 1.8, sd = 0.3)
)
results <- oc_coverage(
  m = sim_dat[["m"]],
  se = sim_dat[["se"]],
  true_effect = 1.15,
  weights = seq(0, 1, by = 0.01), 
  map_prior = load_tipmap_data("tipmapPrior.rds"), 
  sigma = 16.23
) 
print(results)
#>         oc_types
#> weights  cov.50p cov.80p cov.90p cov.95p
#>   w=0        1.0       1       1       1
#>   w=0.01     1.0       1       1       1
#>   w=0.02     1.0       1       1       1
#>   w=0.03     1.0       1       1       1
#>   w=0.04     1.0       1       1       1
#>   w=0.05     1.0       1       1       1
#>   w=0.06     1.0       1       1       1
#>   w=0.07     1.0       1       1       1
#>   w=0.08     1.0       1       1       1
#>   w=0.09     1.0       1       1       1
#>   w=0.1      1.0       1       1       1
#>   w=0.11     1.0       1       1       1
#>   w=0.12     1.0       1       1       1
#>   w=0.13     1.0       1       1       1
#>   w=0.14     1.0       1       1       1
#>   w=0.15     1.0       1       1       1
#>   w=0.16     1.0       1       1       1
#>   w=0.17     1.0       1       1       1
#>   w=0.18     1.0       1       1       1
#>   w=0.19     1.0       1       1       1
#>   w=0.2      1.0       1       1       1
#>   w=0.21     1.0       1       1       1
#>   w=0.22     1.0       1       1       1
#>   w=0.23     1.0       1       1       1
#>   w=0.24     1.0       1       1       1
#>   w=0.25     1.0       1       1       1
#>   w=0.26     1.0       1       1       1
#>   w=0.27     1.0       1       1       1
#>   w=0.28     1.0       1       1       1
#>   w=0.29     1.0       1       1       1
#>   w=0.3      1.0       1       1       1
#>   w=0.31     1.0       1       1       1
#>   w=0.32     1.0       1       1       1
#>   w=0.33     1.0       1       1       1
#>   w=0.34     1.0       1       1       1
#>   w=0.35     1.0       1       1       1
#>   w=0.36     1.0       1       1       1
#>   w=0.37     1.0       1       1       1
#>   w=0.38     1.0       1       1       1
#>   w=0.39     1.0       1       1       1
#>   w=0.4      1.0       1       1       1
#>   w=0.41     1.0       1       1       1
#>   w=0.42     1.0       1       1       1
#>   w=0.43     1.0       1       1       1
#>   w=0.44     1.0       1       1       1
#>   w=0.45     1.0       1       1       1
#>   w=0.46     1.0       1       1       1
#>   w=0.47     1.0       1       1       1
#>   w=0.48     1.0       1       1       1
#>   w=0.49     1.0       1       1       1
#>   w=0.5      1.0       1       1       1
#>   w=0.51     1.0       1       1       1
#>   w=0.52     1.0       1       1       1
#>   w=0.53     1.0       1       1       1
#>   w=0.54     1.0       1       1       1
#>   w=0.55     1.0       1       1       1
#>   w=0.56     1.0       1       1       1
#>   w=0.57     1.0       1       1       1
#>   w=0.58     1.0       1       1       1
#>   w=0.59     1.0       1       1       1
#>   w=0.6      1.0       1       1       1
#>   w=0.61     1.0       1       1       1
#>   w=0.62     1.0       1       1       1
#>   w=0.63     1.0       1       1       1
#>   w=0.64     1.0       1       1       1
#>   w=0.65     1.0       1       1       1
#>   w=0.66     1.0       1       1       1
#>   w=0.67     1.0       1       1       1
#>   w=0.68     1.0       1       1       1
#>   w=0.69     1.0       1       1       1
#>   w=0.7      1.0       1       1       1
#>   w=0.71     1.0       1       1       1
#>   w=0.72     1.0       1       1       1
#>   w=0.73     1.0       1       1       1
#>   w=0.74     1.0       1       1       1
#>   w=0.75     1.0       1       1       1
#>   w=0.76     1.0       1       1       1
#>   w=0.77     1.0       1       1       1
#>   w=0.78     1.0       1       1       1
#>   w=0.79     1.0       1       1       1
#>   w=0.8      1.0       1       1       1
#>   w=0.81     1.0       1       1       1
#>   w=0.82     1.0       1       1       1
#>   w=0.83     1.0       1       1       1
#>   w=0.84     1.0       1       1       1
#>   w=0.85     0.8       1       1       1
#>   w=0.86     0.8       1       1       1
#>   w=0.87     0.8       1       1       1
#>   w=0.88     0.8       1       1       1
#>   w=0.89     0.8       1       1       1
#>   w=0.9      0.8       1       1       1
#>   w=0.91     0.8       1       1       1
#>   w=0.92     0.8       1       1       1
#>   w=0.93     0.8       1       1       1
#>   w=0.94     0.8       1       1       1
#>   w=0.95     0.8       1       1       1
#>   w=0.96     0.8       1       1       1
#>   w=0.97     0.8       1       1       1
#>   w=0.98     0.8       1       1       1
#>   w=0.99     0.8       1       1       1
#>   w=1        0.8       1       1       1