Compile MCMC sampler using STAN and create analysis object
Source:R/create_analysis_obj.R
create_analysis_obj.Rd
Compile MCMC sampler using STAN and create analysis object
Usage
create_analysis_obj(
data_matrix,
outcome,
borrowing,
treatment,
covariates = NULL,
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.
- outcome
Outcome
. Object of classOutcome
as output byoutcome_surv_exponential()
,outcome_surv_weibull_ph()
, oroutcome_bin_logistic()
.- borrowing
Borrowing
. Object of classBorrowing
as output byborrowing_full()
,borrowing_none()
, andborrowing_hierarchical_commensurate()
.- treatment
Treatment
. Object of classTreatment
as output bytreatment_details()
.- covariates
Covariates
. Object of classCovariates
as output by the functionadd_covariates()
.- quiet
logical. Whether to suppress messages (
TRUE
) or not (FALSE
, the default)
Value
Object of class Analysis
.
Examples
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)
)
)
}
#> Inputs look good.
#> Stan program compiled successfully!
#> Ready to go! Now call `mcmc_sample()`.