rank_models {survstan} | R Documentation |
Rank a collection of survstan models
Description
Rank a collection of survstan models
Usage
rank_models(formula, data, survreg, baseline, dist = NULL, ...)
Arguments
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. |
Value
a tibble containing the fitted models ranked according to their AICs.
Examples
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")
)