Skip to contents

Note that this function is quite rudimentary and only suitable for quick-and-dirty approximations. Use stan_bssd for a more rigorous analysis, preferably with an informative MAP prior generated by stan_map_patient_data or stan_map_summary_data.

Usage

approx_bssd(
  y,
  time,
  prob_arm1,
  pi1_alpha,
  pi1_beta,
  pi2_alpha = 0.3,
  pi2_beta = 0.3,
  num_samples = 50000,
  seed = NULL
)

Arguments

y

integer, number of subjects with adverse events across both arms.

time

numeric, total time at risk (units = study duration).

prob_arm1

numeric, probability of being randomized to placebo (arm1).

pi1_alpha

numeric, first shape param of beta prior distribution on unit-time event probability in placebo (arm1).

pi1_beta

numeric, second shape param of beta prior distribution on unit-time event probability in placebo (arm1).

pi2_alpha

numeric, first shape param of beta prior distribution on unit-time event probability in active (arm2).

pi2_beta

numeric, second shape param of beta prior distribution on unit-time event probability in active (arm2).

num_samples

integer.

seed

integer, used to initialize the random number generator for 'rbeta' function to add function result reproducibility.

Value

numeric, Pr(active AE rate > placebo AE rate).

Examples

approx_bssd(y = 10, time = 100, prob_arm1 = 0.5,
pi1_alpha = 9, pi1_beta = 92, pi2_alpha = 0.3, pi2_beta = 0.3,seed = NULL)
#> [1] 0.4810293