View source: R/set_covariates.r
set_covariates | R Documentation |
Generate a survival distribution representing model predictions for a specified cohort. The cohort can be defined by providing a data frame of covariate values (for multiple subjects) or by providing covariate values as named arguments (for a single subject).
set_covariates(dist, data, ...)
dist |
a survfit or flexsurvreg object |
data |
a data.frame representing subjets for which predictions will be generated |
... |
optional argument representing covariate values to generate predictions for, can be used instead of data argument |
a surv_model
object
library(flexsurv)
fs1 <- flexsurvreg(
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.