getAutoKM {Coxmos} | R Documentation |
getAutoKM
Description
Generates a Kaplan-Meier plot for the specified Coxmos model. The plot can be constructed based on the model's Linear Predictor value, the PLS-COX component, or the original variable level.
Usage
getAutoKM(
type = "LP",
model,
comp = 1:2,
top = 10,
ori_data = TRUE,
BREAKTIME = NULL,
n.breaks = 20,
only_sig = FALSE,
alpha = 0.05,
title = NULL,
verbose = FALSE
)
Arguments
type |
Character. Kaplan Meier for complete model linear predictor ("LP"), for PLS components ("COMP") or for original variables ("VAR") (default: LP). |
model |
Coxmos model. |
comp |
Numeric vector. Vector of length two. Select which components to plot (default: c(1,2)). |
top |
Numeric. Show "top" first variables. If top = NULL, all variables are shown (default: 10). |
ori_data |
Logical. Compute the Kaplan-Meier plot with the raw-data or the normalize-data to compute the best cut-point for splitting the data into two groups. Only used when type = "VAR" (default: TRUE). |
BREAKTIME |
Numeric. Size of time to split the data into "total_time / BREAKTIME + 1" points. If BREAKTIME = NULL, "n.breaks" is used (default: NULL). |
n.breaks |
Numeric. If BREAKTIME is NULL, "n.breaks" is the number of time-break points to compute (default: 20). |
only_sig |
Logical. If "only_sig" = TRUE, then only significant log-rank test variables are returned (default: FALSE). |
alpha |
Numeric. Numerical values are regarded as significant if they fall below the threshold (default: 0.05). |
title |
Character. Kaplan-Meier plot title (default: NULL). |
verbose |
Logical. If verbose = TRUE, extra messages could be displayed (default: FALSE). |
Details
The getAutoKM
function offers a flexible approach to visualize survival analysis
results using the Kaplan-Meier method. Depending on the type
parameter, the function can
generate plots based on different aspects of the Coxmos model:
"LP": Uses the Linear Predictor value of the model.
"COMP": Utilizes the PLS-COX component.
"VAR": Operates at the original variable level.
The function provides options to customize the number of components (comp
), the number of top
variables (top
), and whether to use raw or normalized data (ori_data
). Additionally, users can
specify the time intervals (BREAKTIME
and n.breaks
) for the Kaplan-Meier plot. If significance
testing is desired, the function can filter out non-significant variables based on the log-rank
test (only_sig
and alpha
parameters).
It's essential to ensure that the provided model
is of the correct class (Coxmos
). The function
will return an error message if an incompatible model is supplied.
Value
A list of two elements per each model in the list:
info_logrank_num
: A list of two data.frames with the numerical variables categorize as
qualitative and the cutpoint to divide the data into two groups.
LST_PLOTS
: A list with the Kaplan-Meier Plots.
Author(s)
Pedro Salguero Garcia. Maintainer: pedsalga@upv.edu.es
References
Kaplan EL, Kaplan EL, Meier P (1958). “Nonparametric Estimation from Incomplete Observations.” Journal of the American Statistical Association. doi:10.1007/978-1-4612-4380-9_25, https://link.springer.com/chapter/10.1007/978-1-4612-4380-9_25.
Examples
data("X_proteomic")
data("Y_proteomic")
set.seed(123)
index_train <- caret::createDataPartition(Y_proteomic$event, p = .5, list = FALSE, times = 1)
X_train <- X_proteomic[index_train,1:50]
Y_train <- Y_proteomic[index_train,]
X_test <- X_proteomic[-index_train,1:50]
Y_test <- Y_proteomic[-index_train,]
splsicox.model <- splsicox(X_train, Y_train, n.comp = 2, penalty = 0.5, x.center = TRUE,
x.scale = TRUE)
getAutoKM(type = "LP", model = splsicox.model)