set_covariates: Set Covariates of a Survival Distribution

Description Usage Arguments Value Examples

View source: R/survival_operations.R

Description

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

Usage

1
2
3

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 heterogenous set of subjects.

covariates

Used to work around non-standard evaluation.

Value

A surv_model object.

Examples

1
2
3
4
5
6
7
8
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)

heemod documentation built on July 8, 2020, 6:55 p.m.