This function provides a unified interface for cross-validation of all COX modeling methods in the package.
cv.coxmos(
method = c("coxEN", "splsicox", "splsdrcox", "splsdrcox_penalty", "splsdacox"),
X,
Y,
n_run = 3,
k_folds = 10,
x.center = TRUE,
x.scale = FALSE,
remove_near_zero_variance = TRUE,
remove_zero_variance = TRUE,
toKeep.zv = NULL,
remove_variance_at_fold_level = FALSE,
remove_non_significant_models = FALSE,
remove_non_significant = FALSE,
alpha = 0.05,
w_AIC = 0,
w_C.Index = 0,
w_AUC = 1,
w_I.BRIER = 0,
times = NULL,
max_time_points = 15,
MIN_AUC_INCREASE = 0.01,
MIN_AUC = 0.8,
MIN_COMP_TO_CHECK = 3,
pred.attr = "mean",
pred.method = "cenROC",
fast_mode = FALSE,
MIN_EPV = 5,
return_models = FALSE,
returnData = FALSE,
PARALLEL = FALSE,
verbose = FALSE,
seed = 123,
EN.alpha.list = seq(0, 1, 0.2),
max.ncomp = 8,
penalty.list = seq(0.1, 0.9, 0.2),
vector = NULL,
MIN_NVAR = 1,
MAX_NVAR = NULL,
n.cut_points = 5,
EVAL_METHOD = "AUC",
max.iter = 200,
max.variables = NULL
)
A cross-validation object of the specified type.
Cross-validation method to use: "coxEN", "splsicox", "splsdrcox", "splsdrcox_penalty", or "splsdacox" (default: coxEN).
Numeric matrix or data.frame. Explanatory variables. Qualitative variables must be transform into binary variables.
Numeric matrix or data.frame. Response variables. Object must have two columns named as "time" and "event". For event column, accepted values are: 0/1 or FALSE/TRUE for censored and event observations.
Numeric. Number of runs for cross validation (default: 3).
Numeric. Number of folds for cross-validation (default: 10).
Logical. If x.center = TRUE, X matrix is centered to zero means (default: TRUE).
Logical. If x.scale = TRUE, X matrix is scaled to unit variances (default: FALSE).
Logical. If remove_near_zero_variance = TRUE, near zero variance variables will be removed (default: TRUE).
Logical. If remove_zero_variance = TRUE, zero variance variables will be removed (default: TRUE).
Character vector. Name of variables in X to not be deleted by (near) zero variance filtering (default: NULL).
Logical. If remove_variance_at_fold_level = TRUE, (near) zero variance will be removed at fold level. Not recommended. (default: FALSE).
Logical. If remove_non_significant_models = TRUE, non-significant models are removed before computing the evaluation. A non-significant model is a model with at least one component/variable with a P-Value higher than the alpha cutoff.
Logical. If remove_non_significant = TRUE, non-significant variables/components in final cox model will be removed until all variables are significant by forward selection (default: FALSE).
Numeric. Numerical values are regarded as significant if they fall below the threshold (default: 0.05).
Numeric. Weight for AIC evaluator. All weights must sum 1 (default: 0).
Numeric. Weight for C-Index evaluator. All weights must sum 1 (default: 0).
Numeric. Weight for AUC evaluator. All weights must sum 1 (default: 1).
Numeric. Weight for BRIER SCORE evaluator. All weights must sum 1 (default: 0).
Numeric vector. Time points where the AUC will be evaluated. If NULL, a maximum of 'max_time_points' points will be selected equally distributed (default: NULL).
Numeric. Maximum number of time points to use for evaluating the model (default: 15).
Numeric. Minimum improvement between different cross validation models to continue evaluating higher values in the multiple tested parameters. If it is not reached for next 'MIN_COMP_TO_CHECK' models and the minimum 'MIN_AUC' value is reached, the evaluation stops (default: 0.01).
Numeric. Minimum AUC desire to reach cross-validation models. If the minimum is reached, the evaluation could stop if the improvement does not reach an AUC higher than adding the 'MIN_AUC_INCREASE' value (default: 0.8).
Numeric. Number of penalties/components to evaluate to check if the AUC improves. If for the next 'MIN_COMP_TO_CHECK' the AUC is not better and the 'MIN_AUC' is meet, the evaluation could stop (default: 3).
Character. Way to evaluate the metric selected. Must be one of the following: "mean" or "median" (default: "mean").
Character. AUC evaluation algorithm method for evaluate the model performance. Must be one of the following: "risksetROC", "survivalROC", "cenROC", "nsROC", "smoothROCtime_C", "smoothROCtime_I" (default: "cenROC").
Logical. If fast_mode = TRUE, for each run, only one fold is evaluated simultaneously. If fast_mode = FALSE, for each run, all linear predictors are computed for test observations. Once all have their linear predictors, the evaluation is perform across all the observations together (default: FALSE).
Numeric. Minimum number of Events Per Variable (EPV) you want reach for the final cox model. Used to restrict the number of variables/components can be computed in final cox models. If the minimum is not meet, the model cannot be computed (default: 5).
Logical. Return all models computed in cross validation (default: FALSE).
Logical. Return original and normalized X and Y matrices (default: TRUE).
Logical. Run the cross validation with multicore option. As many cores as your total cores - 1 will be used. It could lead to higher RAM consumption (default: FALSE).
Logical. If verbose = TRUE, extra messages could be displayed (default: FALSE).
Number. Seed value for performing runs/folds divisions (default: 123).
Numeric vector. Elastic net mixing parameter values for cross-validation. If NULL, default seq(0,1,0.1) will be used (default: NULL) (coxEN).
Numeric. Maximum number of latent components to compute for the (s)PLS model (default: NULL) (splsicox, splsdrcox, splsdrcox_penalty, splsdacox).
Numeric vector. Penalty values for variable selection. If NULL, default seq(0,0.9,0.1) will be used (default: NULL) (splsicox, splsdrcox_penalty).
Numeric vector. Used for computing best number of variables. As many values as components have to be provided. If vector = NULL, an automatic detection is perform (default: NULL) (splsdrcox, splsdacox).
Numeric. Minimum range size for computing cut points to select the best number of variables to use (default: NULL) (splsdrcox, splsdacox).
Numeric. Maximum range size for computing cut points to select the best number of variables to use. If NULL, the number of variables is selected (default: NULL) (splsdrcox, splsdacox).
Numeric. Number of cut points for searching the optimal number of variables. If only two cut points are selected, minimum and maximum size are used (default: NULL) (splsdrcox, splsdacox).
Character. The selected metric will be use to compute the best number of variables. Must be one of the following: "AUC", "IBS" or "C.Index" (default: NULL) (splsdrcox, splsdacox).
Numeric. Maximum number of iterations for PLS convergence (default: NULL) (splsdrcox, splsdacox).
Numeric. Maximum number of variables to keep in the cox model (default: NULL) (coxEN).
cv.coxEN
for Elastic Net cross-validation,
cv.splsicox
for SPLS-COX cross-validation,
cv.splsdrcox
for SPLS-DRCOX cross-validation,
cv.splsdrcox_penalty
for penalized SPLS-DRCOX cross-validation,
cv.splsdacox
for SPLS-DACOX cross-validation
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,]
# Elastic Net Cross-Validation
# cv_model <- cv_coxmos(method = "coxEN", X = X_train, Y = Y_train, EN.alpha.list = seq(0, 1, 0.2))
Run the code above in your browser using DataLab