Skip to contents

Compile MCMC sampler using STAN and create analysis object

Usage

create_analysis_obj(
  data_matrix,
  covariates = NULL,
  outcome,
  borrowing,
  treatment,
  quiet = FALSE
)

Arguments

data_matrix

matrix. The data matrix, including all covariates to be adjusted for, all relevant outcome variables, and treatment arm and external control arm flags.

covariates

Covariates. Object of class Covariates as output by the function add_covariates().

outcome

Outcome. Object of class Outcome as output by exp_surv_dist(), weib_ph_surv_dist(), or logistic_bin_outcome().

borrowing

Borrowing. Object of class Borrowing as output by borrowing_details().

treatment

Treatment. Object of class Treatment as output by treatment_details().

quiet

logical. Whether to suppress messages (TRUE) or not (FALSE, the default)

Value

Object of class Analysis.

Examples

anls <- create_analysis_obj(
  data_matrix = example_matrix,
  covariates = add_covariates(
    covariates = c("cov1", "cov2"),
    priors = normal_prior(0, 1000)
  ),
  outcome = exp_surv_dist(
    "time",
    "cnsr",
    baseline_prior = normal_prior(0, 1000)
  ),
  borrowing = borrowing_details(
    "BDB",
    "ext",
    exponential_prior(.001)
  ),
  treatment = treatment_details(
    "trt",
    normal_prior(0, 1000)
  )
)
#> Inputs look good.
#> Stan program compiled successfully!
#> Ready to go! Now call `mcmc_sample()`.