rename_draws_covariates {psborrow2}R Documentation

Rename Covariates in draws Object

Description

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

if (check_cmdstan()) {
  analysis_object <- create_analysis_obj(
    data_matrix = example_matrix,
    covariates = add_covariates(
      covariates = c("cov1", "cov2"),
      priors = prior_normal(0, 1000)
    ),
    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)
    )
  )
  samples <- mcmc_sample(analysis_object, 200, 400, 1)
  draws <- samples$draws()
  renamed_draws <- rename_draws_covariates(draws, analysis_object)
  summary(renamed_draws)
}

[Package psborrow2 version 0.0.3.4 Index]