R/fit_survival_model.R
fit_survival_model.RdThis function is a helper function for fit_LOCF_landmark_model and fit_LME_landmark_model.
fit_survival_model(
data,
individual_id,
cv_name = NA,
covariates,
event_time,
event_status,
survival_submodel = c("standard_cox", "cause_specific", "fine_gray"),
x_hor
)| data | Data frame containing covariates and time-to-event data, one row for each individual. |
|---|---|
| individual_id | Character string specifying the column name in |
| cv_name | Character string specifying the column name in |
| covariates | Vector of character strings specifying the column names in |
| event_time | Character string specifying the column name in |
| event_status | Character string specifying the column name in |
| survival_submodel | Character string specifying which survival submodel to
use. Three options: the standard Cox model i.e. no competing risks ( |
| x_hor | Numeric specifying the horizon time(s) |
List containing data_survival and model_survival
data_survival contains the predicted risk of event by the horizon time x_hor.
model_survival contains the outputs from the function used to fit the survival submodel, including the estimated parameters of the model.
For a model using cross-validation, model_survival contains a list of outputs with each
element in the list corresponding to a different cross-validation fold.
This function fits the survival model from the landmark model framework. The individuals are censored at the time horizon x_hor and the survival model is fitted with
covariates specified in parameter covariates.
For the survival model, there are three choices of model:
the standard Cox model, this is a wrapper function for coxph from the package survival
the cause-specific model, this is a wrapper function for CSC from package riskRegression
the Fine Gray model, this is a wrapper function for FGR from package riskRegression
The latter two models estimate the probability of the event of interest in the presence of competing events.
Isobel Barrott isobel.barrott@gmail.com