set_covariates {heemod}R Documentation

Set Covariates of a Survival Distribution

Description

Set the covariate levels of a survival model to be represented in survival projections.

Usage

set_covariates(dist, ..., data = NULL)

set_covariates_(dist, covariates, data = NULL)

Arguments

dist

a survfit or flexsurvreg object

...

Covariate values representing the group for which survival probabilities will be generated when evaluated.

data

A an optional data frame representing multiple sets of covariate values for which survival probabilities will be generated. Can be used to generate aggregate survival for a heterogeneous set of subjects.

covariates

Used to work around non-standard evaluation.

Value

A surv_model object.

Examples


fs1 <- flexsurv::flexsurvreg(
  survival::Surv(rectime, censrec)~group,
  data=flexsurv::bc,
  dist = "llogis"
)
good_model <- set_covariates(fs1, group = "Good")
cohort <- data.frame(group=c("Good", "Good", "Medium", "Poor"))
mixed_model <- set_covariates(fs1, data = cohort)


[Package heemod version 1.0.1 Index]