rank_models | R Documentation |
Rank a collection of survstan models
rank_models(formula, data, survreg, baseline, dist = NULL, ...)
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. |
data |
data an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which function is called. |
survreg |
survival regression models to be fitted (AFT, AH, PH, PO, YP and EH). |
baseline |
baseline distributions to be fitted; options currently available are: exponential, weibull, lognormal, loglogistic and Birnbaum-Saunders (fatigue) distributions. |
dist |
alternative way to specify the baseline distributions (for compability with the |
... |
further arguments passed to other methods. |
a tibble containing the fitted models ranked according to their AICs.
library(survstan)
library(dplyr)
veteran <- veteran %>%
mutate(across(c(trt, prior, celltype), as.factor))
fits <- rank_models(
formula = Surv(time, status) ~ celltype+karno,
data = veteran,
survreg = c("aftreg", "ahreg", "phreg", "poreg", "ypreg", "ehreg"),
baseline = c("exponential", "weibull", "lognormal", "loglogistic", "fatigue", "gamma", "rayleigh")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.