View source: R/survival_operations.R
set_covariates | R Documentation |
Set the covariate levels of a survival model to be represented in survival projections.
set_covariates(dist, ..., data = NULL)
set_covariates_(dist, covariates, data = NULL)
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. |
A surv_model
object.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.