oc_pos: Assessing probability of success

View source: R/oc_pos.R

oc_posR Documentation

Assessing probability of success

Description

Assessment of the probability of truly or falsely (depending on simulated scenario) rejecting the null hypothesis of interest for a given weight and evidence level, using simulated data as input.

Usage

oc_pos(
  m,
  se,
  probs,
  weights = seq(0, 1, by = 0.01),
  map_prior,
  sigma,
  null_effect = 0,
  direction_pos = T,
  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).

probs

Vector of quantiles q, with 1 minus q representing an evidence level of interest (where positive effect estimate indicate a beneficial treatment).

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.

null_effect

Numerical value, representing the null effect (defaults to 0).

direction_pos

Logical value, TRUE (default) if effects greater that the null_effect indicate a beneficial treatment and FALSE otherwise.

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 probabilities, either of truly (probability of success) or falsely rejecting the null hypothesis of interest for a given weight and evidence level.

See Also

oc_bias 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_pos(
  m = sim_dat[["m"]],
  se = sim_dat[["se"]],
  probs = c(0.025, 0.05, 0.1, 0.2), 
  weights = seq(0, 1, by = 0.01), 
  map_prior = load_tipmap_data("tipmapPrior.rds"), 
  sigma = 16.23,
  null_effect = 0,
  direction_pos = TRUE, 
  eval_strategy = "sequential",
  n_cores = 1
) 
print(results)

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