oc_bias: Assessing bias

View source: R/oc_bias.R

oc_biasR Documentation

Assessing bias

Description

Assessment of absolute bias in posterior means and medians for a given weight and evidence level, using simulated data as input.

Usage

oc_bias(
  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 bias.

See Also

oc_pos and oc_coverage.

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_bias(
  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,
  eval_strategy = "sequential",
  n_cores = 1
) 
print(results)

tipmap documentation built on Aug. 14, 2023, 5:09 p.m.