Skip to contents

Rename Covariates in draws Object

Usage

rename_draws_covariates(draws, analysis)

Arguments

draws

draws created from sampled analysis object. See example.

analysis

Analysis as created by create_analysis_obj().

Value

A draws[posterior::draws] object with covariate names.

Examples

analysis_object <- 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"
  ),
  borrowing = borrowing_details(
    "BDB",
    "ext",
    exponential_prior(.001),
    baseline_prior = normal_prior(0, 1000)
  ),
  treatment = treatment_details(
    "trt",
    normal_prior(0, 1000)
  )
)
#> Inputs look good.
#> Error: CmdStan path has not been set yet. See ?set_cmdstan_path.
samples <- mcmc_sample(analysis_object)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'mcmc_sample': object 'analysis_object' not found
draws <- samples$draws()
#> Error in eval(expr, envir, enclos): object 'samples' not found
renamed_draws <- rename_draws_covariates(draws, analysis_object)
#> Error in checkClass(x, classes, ordered, null.ok): object 'draws' not found
summary(renamed_draws)
#> Error in summary(renamed_draws): object 'renamed_draws' not found