fit_models {easysurv} | R Documentation |
Fit Survival Models
Description
Fits survival models to the provided data using the specified engine and returns various outputs including model parameters, goodness of fit, and estimates of median survival.
Usage
fit_models(
data,
time,
event,
predict_by = NULL,
covariates = NULL,
dists = c("exp", "gamma", "gengamma", "gompertz", "llogis", "lnorm", "weibull"),
engine = "flexsurv",
k = c(1, 2, 3),
scale = "hazard",
add_time_0 = TRUE,
...
)
Arguments
data |
A data frame containing the survival data. |
time |
The name of the column in |
event |
The name of the column in |
predict_by |
(Optional) The name of the column in |
covariates |
(Optional) A character vector specifying the names of covariates to be included in the model. |
dists |
(Optional) A character vector specifying the distribution(s) to be fitted. When the engine parameter is set to "flexsurv", options are "exp", "exponential", "gamma", "genf", "genf.orig", "gengamma", "gengamma.orig", "gompertz", "llogis", "lnorm", "lognormal", "weibull", "weibullPH". When the engine parameter is set to "flexsurvcure", options are "exp", "gamma", "gengamma", "gompertz", "llogis", "lnorm", "weibull". When the engine parameter is set to "flexsurvspline", dists are ignored in favor of k and scale parameters. When the engine parameter is set to "survival", options are "exponential", "extreme", "gaussian", "loggaussian" (same as lognormal), "logistic", "lognormal", "rayleigh", "weibull". Default is |
engine |
(Optional) The survival analysis engine to be used. Options are "flexsurv", "flexsurvcure", "flexsurvspline", and "survival". Default is "flexsurv".
|
k |
(Optional) A numeric vector specifying the number of knots for
spline-based models. Default is |
scale |
(Optional) A character vector specifying the scale parameter(s)
for spline-based models. Options are "hazard", "odds", and "normal".
Default is |
add_time_0 |
Optional. Uses |
... |
Additional arguments just to catch them and avoid errors. |
Value
A list containing information about the fit_models() call, the distributions attempted, goodness of fit, fit averages, and cure fractions (if applicable).
Examples
models <- fit_models(
data = easysurv::easy_bc,
time = "recyrs",
event = "censrec",
predict_by = "group",
covariates = "group"
)
models