Learn R Programming

psborrow2 (version 0.0.4.0)

create_analysis_obj: Compile MCMC sampler using STAN and create analysis object

Description

Compile MCMC sampler using STAN and create analysis object

Usage

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

Value

Object of class Analysis.

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.

outcome

Outcome. Object of class Outcome as output by outcome_surv_exponential(), outcome_surv_weibull_ph(), or outcome_bin_logistic().

borrowing

Borrowing. Object of class Borrowing as output by borrowing_full(), borrowing_none(), and borrowing_hierarchical_commensurate().

treatment

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

covariates

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

quiet

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

Examples

Run this code
if (check_cmdstan()) {
  anls <- create_analysis_obj(
    data_matrix = example_matrix,
    outcome = outcome_surv_exponential(
      "time",
      "cnsr",
      baseline_prior = prior_normal(0, 1000)
    ),
    borrowing = borrowing_hierarchical_commensurate(
      "ext",
      prior_exponential(.001)
    ),
    treatment = treatment_details(
      "trt",
      prior_normal(0, 1000)
    ),
    covariates = add_covariates(
      covariates = c("cov1", "cov2"),
      priors = prior_normal(0, 1000)
    )
  )
}

Run the code above in your browser using DataLab