Introduction to pye and covYI estimators

library(pye)

1. Package Introduction and Objective

The pye package provides an advanced framework for simultaneous variable selection and prediction within low- and high-dimensional binary classification contexts. Its core methodology focuses on maximizing the penalized Youden index function \(F_{Y=0}(\theta) - F_{Y=1}(\theta) - \Phi(\theta)\) with respect of the parameter vector \(\theta\), where \(F_{Y=y}(\theta)\) represents the distribution function of the feature combination for class \(Y=y\) and \(\Phi(\theta)\) is a sparsity-inducing penalty term. For the Penalized Youden Index Estimator (pye) - https://doi.org/10.1016/j.chemolab.2023.104786 -, \(\theta\) corresponds to the coefficients of a linear combination of biomarkers \(\beta\) together with diagnostic cut-off point \(c\). For the Covariate-Adjusted Youden Index Estimator (covYI), the biomarker score is a single known marker, and \(\theta\) denotes the coefficients of the linear combination of covariate that define the diagnostic cut-off point \(c\). pye is particularly suited for applications in medical diagnostics, where identifying a subset of relevant biomarkers is crucial for effective disease classification. covYI extends this framework by allowing the diagnostic cut-off to depend on patient covariates, thereby enhancing the accuracy of the biomarkers in heterogeneous populations.

The package implements two primary methodologies:

Penalized Youden Index Estimator (pye): The base estimator combining the Youden index function with sparsity-inducing penalization techniques (Lasso, SCAD, MCP) for simultaneous biomarker selection.

Covariate-Adjusted Youden Index Estimator (covYI): An extension of pye that allows the optimal diagnostic cut-off to be a linear function of patient covariates, improving the classification accuracy of the biomarker score.

3. Example Workflow

This section outlines a typical workflow. In practice, the user must define the specific functions for the gradient (delta_fx) and the proximal operator (proxx) based on their chosen penalty (e.g., SCAD, L1) and data structure.

# Load the package
library(pye)

# 1. Simulate data for the example
set.seed(123) # Always good to set a seed for reproducibility in examples
cols <- 200
cols_cov <- 20
max_rho <- 0.2
rows_train <- 200
sim_data <- create_sample_with_covariates(rows_train = rows_train, 
                                          cols = cols, 
                                          cols_cov = cols_cov, 
                                          max_rho = max_rho, 
                                          seed = 1)
df <- sim_data$train_df_scaled
X <- sim_data$X
y <- sim_data$y
C <- sim_data$C
regressors_betas <- sim_data$nregressors # True betas for evaluation
regressors_gammas <- sim_data$ncovariates # True gammas for evaluation

# 2. Set cross-validation parameters
penalty <- "SCAD" # Penalty for betas in pye estimation
penalty_g <- "L12" # Penalty for gammas in covYI estimation
trend <- "monotone" # Trend for the KS estimation
alpha <- 0.5
c_function_of_covariates <- TRUE # Use covariates for 'c' estimation
used_cores <- 1 # For this example, no parallelization
max_iter <- 10 # Keep iterations low for a quick example run
n_folds <- 3

# 3. Calibrate lambda_max and lambda_min for betas (pye estimation)
lambda_seq <- create_lambda(n = 4, lmax = 1.5, lmin = 0.1)
lambda_seq <- as.numeric(formatC(lambda_seq, format = "e", digits = 9))

# 4. Calibrate tau_max and tau_min for gammas (covYI estimation), if
tau_seq <- create_lambda(n = 4, lmax = 0.15, lmin = 0.05)
tau_seq <- as.numeric(formatC(tau_seq, format = "e", digits = 9))

# 5. Run the cross-validation
pye_cv_result <- pye_KS_compute_cv(
  n_folds = n_folds,
  df = df,
  X = X,
  y = y,
  C = C,
  lambda = lambda_seq,
  tau = tau_seq,
  trace = 1, # Show final results
  alpha = alpha,
  penalty = penalty,
  regressors_betas = regressors_betas,
  regressors_gammas = regressors_gammas,
  seed = 1,
  used_cores = used_cores,
  trend = trend,
  max_iter = max_iter,
  c_function_of_covariates = c_function_of_covariates,
  measure_to_select_lambda = "ccr",
  penalty_g = penalty_g,
  trend_g = trend,
  max_iter_g = max_iter
)
#> Starting CV with the following estimation/convergence parameters: 
#> max_iter: 10 
#> min_alpha: 1e-10 
#> convergence_error: 1e-07 
#> stepsizeShrink: 0.8 
#> c_function_of_covariates: FALSE 
#> ----------------------------------------------------------------
#> |       starting with the 1 -th fold for the CV of  lambda       |
#> ----------------------------------------------------------------
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; 
#> total iters: 10 ; Backtraking iters: 798 ; lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1444 ; youden_index: 0.4252 ; sensitivity: 0.9104 ; specificity: 0.8485 ; geometric_mean: 0.8789 ; fdr: 0.1408 ; mcc: 0.7607 ; auc: 0.9521 ; corrclass: 0.8797 ; 
#> TP: 61 ; TN: 56 ; FP: 10 ; FN: 6 ; betas: 
#>     norm2    norm35    norm51    norm52   norm101   norm102         c 
#> -0.028667 -0.003142  0.024869 -0.065990  0.034681 -0.029819  0.002434 
#> Estimation time: 0.2831 mins 
#> 
#> 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; 
#> total iters: 6 ; Backtraking iters: 638 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3781 ; youden_index: 0.7603 ; sensitivity: 0.9552 ; specificity: 0.9394 ; geometric_mean: 0.9473 ; fdr: 0.05882 ; mcc: 0.8948 ; auc: 0.9878 ; corrclass: 0.9474 ; 
#> TP: 64 ; TN: 62 ; FP: 4 ; FN: 3 ; betas: 
#>      norm2     norm12     norm16     norm18     norm23     norm35     norm39 
#> -0.0834877 -0.0024775  0.0014795 -0.0001693 -0.0024886 -0.0055629 -0.0139270 
#>     norm45     norm48     norm51 
#>  0.0060359 -0.0003150  0.0702604 
#>  [ reached 'max' / getOption("max.print") -- omitted 23 entries ]
#> Estimation time: 0.3149 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; 
#> total iters: 10 ; Backtraking iters: 653 ; lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.5969 ; youden_index: 0.9447 ; sensitivity: 0.9851 ; specificity: 1 ; geometric_mean: 0.9925 ; fdr: 0 ; mcc: 0.9851 ; auc: 0.9903 ; corrclass: 0.9925 ; 
#> TP: 66 ; TN: 66 ; FP: 0 ; FN: 1 ; betas: 
#>      norm2      norm5      norm9     norm16     norm17     norm18     norm22 
#> -0.1146306 -0.0006052  0.0032371  0.0431150 -0.0016098 -0.0051568 -0.0028814 
#>     norm23     norm24     norm28 
#> -0.0331921 -0.0318302 -0.0122568 
#>  [ reached 'max' / getOption("max.print") -- omitted 48 entries ]
#> Estimation time: 0.253 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; 
#> total iters: 10 ; Backtraking iters: 364 ; lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.732 ; youden_index: 0.8824 ; sensitivity: 0.9552 ; specificity: 1 ; geometric_mean: 0.9774 ; fdr: 0 ; mcc: 0.9559 ; auc: 0.986 ; corrclass: 0.9774 ; 
#> TP: 64 ; TN: 66 ; FP: 0 ; FN: 3 ; betas: 
#>     norm2    norm16    norm18    norm23    norm24    norm33    norm35    norm36 
#> -0.183942  0.013181 -0.034843 -0.018366 -0.010160 -0.024587 -0.014625  0.058445 
#>    norm39    norm48 
#> -0.007670 -0.009777 
#>  [ reached 'max' / getOption("max.print") -- omitted 28 entries ]
#> Estimation time: 0.1132 mins 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 1 ; 
#> lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1251 ; youden_index: 0.4287 ; sensitivity: 0.9118 ; specificity: 0.7879 ; geometric_mean: 0.8476 ; fdr: 0.1842 ; mcc: 0.706 ; auc: 0.9287 ; corrclass: 0.8507  
#> TP: 31 ; TN: 26 ; FP: 7 ; FN: 3 ;  betas: 
#>     norm2    norm35    norm51    norm52   norm101   norm102         c 
#> -0.028667 -0.003142  0.024869 -0.065990  0.034681 -0.029819  0.002434 
#> Cross-validation time: 0.2831 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 1 ; 
#> lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.219 ; youden_index: 0.4349 ; sensitivity: 0.8529 ; specificity: 0.8182 ; geometric_mean: 0.8354 ; fdr: 0.1714 ; mcc: 0.6717 ; auc: 0.9349 ; corrclass: 0.8358  
#> TP: 29 ; TN: 27 ; FP: 6 ; FN: 5 ;  betas: 
#>      norm2     norm12     norm16     norm18     norm23     norm35     norm39 
#> -8.349e-02 -2.477e-03  1.480e-03 -1.693e-04 -2.489e-03 -5.563e-03 -1.393e-02 
#>     norm45     norm48     norm51     norm52     norm60     norm66     norm78 
#>  6.036e-03 -3.150e-04  7.026e-02 -1.272e-01  8.754e-03 -6.666e-04 -4.795e-03 
#>     norm98     norm99    norm101    norm102    norm103    norm107    norm118 
#>  5.411e-03 -1.746e-02  9.307e-02 -9.918e-02  1.797e-04 -5.460e-03 -2.026e-02 
#>    norm122    norm131    norm139    norm141    norm150    norm155    norm161 
#>  7.857e-03  9.453e-03 -2.590e-02 -5.859e-04 -1.075e-03 -5.640e-04  4.895e-03 
#>    norm170    norm177    norm193    norm197          c 
#>  2.545e-04  5.668e-03  3.508e-03  1.465e-14  1.074e-02 
#> Cross-validation time: 0.3149 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 1 ; 
#> lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1986 ; youden_index: 0.3654 ; sensitivity: 0.8529 ; specificity: 0.7576 ; geometric_mean: 0.8038 ; fdr: 0.2162 ; mcc: 0.6138 ; auc: 0.8654 ; corrclass: 0.806  
#> TP: 29 ; TN: 25 ; FP: 8 ; FN: 5 ;  betas: 
#>      norm2      norm5      norm9     norm16     norm17     norm18     norm22 
#> -1.146e-01 -6.052e-04  3.237e-03  4.312e-02 -1.610e-03 -5.157e-03 -2.881e-03 
#>     norm23     norm24     norm28     norm33     norm35     norm36     norm38 
#> -3.319e-02 -3.183e-02 -1.226e-02 -4.374e-03 -2.868e-02  3.012e-02  3.311e-03 
#>     norm39     norm48     norm51     norm52     norm55     norm56     norm57 
#> -2.704e-03 -1.934e-02  8.884e-02 -1.551e-01 -5.938e-03  4.229e-02 -2.972e-03 
#>     norm60     norm64     norm66     norm69     norm78     norm98     norm99 
#>  2.970e-02 -1.330e-03 -1.884e-02 -4.437e-03 -3.688e-02  4.168e-03 -5.819e-02 
#>    norm101    norm102    norm103    norm107    norm113    norm117    norm118 
#>  8.004e-02 -1.101e-01  3.458e-02 -1.518e-02  2.411e-04 -5.445e-04 -3.529e-02 
#>    norm122    norm123    norm131    norm132    norm135    norm139    norm141 
#>  2.523e-02 -6.490e-04  1.657e-02 -1.709e-03  8.427e-05 -6.095e-02 -3.342e-02 
#>    norm144    norm147    norm148    norm150    norm155    norm158    norm161 
#> -2.348e-02  1.581e-05 -1.454e-03 -3.283e-03 -2.430e-02 -3.952e-02  2.446e-02 
#>    norm170    norm171    norm177    norm188    norm193    norm194    norm196 
#>  1.290e-03  1.950e-03  3.425e-02 -6.419e-03  1.719e-03 -2.443e-02  1.518e-02 
#>    norm200          c 
#> -8.214e-03  9.015e-03 
#> Cross-validation time: 0.253 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 1 ; 
#> lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.4726 ; youden_index: 0.4002 ; sensitivity: 0.9118 ; specificity: 0.7879 ; geometric_mean: 0.8476 ; fdr: 0.1842 ; mcc: 0.706 ; auc: 0.9002 ; corrclass: 0.8507  
#> TP: 31 ; TN: 26 ; FP: 7 ; FN: 3 ;  betas: 
#>     norm2    norm16    norm18    norm23    norm24    norm33    norm35    norm36 
#> -0.183942  0.013181 -0.034843 -0.018366 -0.010160 -0.024587 -0.014625  0.058445 
#>    norm39    norm48    norm51    norm52    norm56    norm60    norm64    norm66 
#> -0.007670 -0.009777  0.177061 -0.254797  0.014226  0.032208 -0.048231 -0.008406 
#>    norm69    norm78    norm81    norm98    norm99   norm101   norm102   norm103 
#> -0.012087 -0.003914 -0.006369  0.010994 -0.052027  0.104744 -0.174681  0.020391 
#>   norm107   norm118   norm122   norm130   norm131   norm134   norm139   norm141 
#> -0.005471 -0.045037  0.053654  0.010044  0.035643 -0.006386 -0.051197 -0.015690 
#>   norm150   norm155   norm158   norm176   norm177         c 
#> -0.003824 -0.010137 -0.031014 -0.002137  0.016758  0.005168 
#> Cross-validation time: 0.1132 ; Number of iterations: 10 
#> 
#> 
#> ----------------------------------------------------------------
#> |       starting with the 2 -th fold for the CV of  lambda       |
#> ----------------------------------------------------------------
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; 
#> total iters: 10 ; Backtraking iters: 1236 ; lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1533 ; youden_index: 0.4168 ; sensitivity: 0.9104 ; specificity: 0.8182 ; geometric_mean: 0.8631 ; fdr: 0.1644 ; mcc: 0.7321 ; auc: 0.9414 ; corrclass: 0.8647 ; 
#> TP: 61 ; TN: 54 ; FP: 12 ; FN: 6 ; betas: 
#>      norm2     norm51     norm52    norm101    norm102    norm142          c 
#> -0.0004153  0.0239183 -0.0613325  0.0436339 -0.0382461 -0.0080857 -0.0000515 
#> Estimation time: 0.426 mins 
#> 
#> 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; 
#> total iters: 7 ; Backtraking iters: 1124 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3894 ; youden_index: 0.7422 ; sensitivity: 0.9403 ; specificity: 0.9242 ; geometric_mean: 0.9322 ; fdr: 0.07353 ; mcc: 0.8647 ; auc: 0.9916 ; corrclass: 0.9323 ; 
#> TP: 63 ; TN: 61 ; FP: 5 ; FN: 4 ; betas: 
#>      norm2      norm9     norm14     norm26     norm33     norm35     norm39 
#> -0.0221927  0.0094674 -0.0043182  0.0079288 -0.0002049 -0.0029455 -0.0003129 
#>     norm50     norm51     norm52 
#> -0.0010401  0.0553048 -0.1180324 
#>  [ reached 'max' / getOption("max.print") -- omitted 21 entries ]
#> Estimation time: 0.4533 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; 
#> total iters: 10 ; Backtraking iters: 428 ; lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.6411 ; youden_index: 0.9376 ; sensitivity: 1 ; specificity: 1 ; geometric_mean: 1 ; fdr: 0 ; mcc: 1 ; auc: 1 ; corrclass: 1 ; 
#> TP: 67 ; TN: 66 ; FP: 0 ; FN: 0 ; betas: 
#>      norm2      norm7      norm9     norm14     norm17     norm23     norm26 
#> -0.0645211  0.0003921  0.0321560 -0.0106883 -0.0045308 -0.0002037  0.0313995 
#>     norm27     norm28     norm33 
#>  0.0031757 -0.0042952 -0.0077072 
#>  [ reached 'max' / getOption("max.print") -- omitted 54 entries ]
#> Estimation time: 0.1171 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; 
#> total iters: 10 ; Backtraking iters: 357 ; lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.7421 ; youden_index: 0.9452 ; sensitivity: 1 ; specificity: 0.9697 ; geometric_mean: 0.9847 ; fdr: 0.02899 ; mcc: 0.9704 ; auc: 0.9943 ; corrclass: 0.985 ; 
#> TP: 67 ; TN: 64 ; FP: 2 ; FN: 0 ; betas: 
#>      norm2      norm9     norm14     norm17     norm22     norm26     norm28 
#> -0.0645914  0.0598891 -0.0674312 -0.0416586  0.0007512  0.0631425 -0.0340830 
#>     norm32     norm35     norm36 
#> -0.0079048 -0.0315867  0.0050180 
#>  [ reached 'max' / getOption("max.print") -- omitted 45 entries ]
#> Estimation time: 0.1109 mins 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 2 ; 
#> lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.102 ; youden_index: 0.4082 ; sensitivity: 0.9412 ; specificity: 0.8182 ; geometric_mean: 0.8775 ; fdr: 0.1579 ; mcc: 0.7662 ; auc: 0.9082 ; corrclass: 0.8806  
#> TP: 32 ; TN: 27 ; FP: 6 ; FN: 2 ;  betas: 
#>      norm2     norm51     norm52    norm101    norm102    norm142          c 
#> -0.0004153  0.0239183 -0.0613325  0.0436339 -0.0382461 -0.0080857 -0.0000515 
#> Cross-validation time: 0.426 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 2 ; 
#> lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1794 ; youden_index: 0.3913 ; sensitivity: 0.9118 ; specificity: 0.8182 ; geometric_mean: 0.8637 ; fdr: 0.1622 ; mcc: 0.7339 ; auc: 0.8913 ; corrclass: 0.8657  
#> TP: 31 ; TN: 27 ; FP: 6 ; FN: 3 ;  betas: 
#>      norm2      norm9     norm14     norm26     norm33     norm35     norm39 
#> -0.0221927  0.0094674 -0.0043182  0.0079288 -0.0002049 -0.0029455 -0.0003129 
#>     norm50     norm51     norm52     norm61     norm71     norm72     norm74 
#> -0.0010401  0.0553048 -0.1180324  0.0001712  0.0189608 -0.0086096 -0.0011047 
#>     norm75     norm79     norm82     norm83    norm101    norm102    norm103 
#> -0.0003637 -0.0084191  0.0005923  0.0066332  0.1199288 -0.0834833  0.0087865 
#>    norm107    norm131    norm142    norm152    norm165    norm171    norm188 
#> -0.0096822  0.0114343 -0.0483673 -0.0001453  0.0077519  0.0145624 -0.0089935 
#>    norm192    norm196          c 
#>  0.0001891 -0.0001453  0.0070873 
#> Cross-validation time: 0.4533 ; Number of iterations: 7 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 2 ; 
#> lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2358 ; youden_index: 0.3663 ; sensitivity: 0.8235 ; specificity: 0.697 ; geometric_mean: 0.7576 ; fdr: 0.2632 ; mcc: 0.5252 ; auc: 0.8663 ; corrclass: 0.7612  
#> TP: 28 ; TN: 23 ; FP: 10 ; FN: 6 ;  betas: 
#>      norm2      norm7      norm9     norm14     norm17     norm23     norm26 
#> -6.452e-02  3.921e-04  3.216e-02 -1.069e-02 -4.531e-03 -2.037e-04  3.140e-02 
#>     norm27     norm28     norm33     norm35     norm36     norm43     norm47 
#>  3.176e-03 -4.295e-03 -7.707e-03 -2.345e-02  1.202e-02 -5.128e-03  2.393e-02 
#>     norm50     norm51     norm52     norm60     norm61     norm71     norm72 
#> -2.582e-03  8.086e-02 -1.556e-01  2.066e-02  1.962e-03  2.832e-02 -3.919e-02 
#>     norm74     norm75     norm77     norm79     norm82     norm83     norm92 
#> -2.223e-02 -2.900e-03  8.845e-03 -3.774e-02  4.273e-03  1.898e-02  1.073e-03 
#>    norm100    norm101    norm102    norm103    norm106    norm107    norm108 
#> -1.753e-04  1.700e-01 -1.172e-01  1.883e-02 -1.393e-02 -2.934e-02  1.042e-03 
#>    norm113    norm118    norm119    norm120    norm124    norm125    norm126 
#>  2.273e-04 -1.929e-03 -5.546e-03 -3.346e-04 -5.538e-04  1.265e-03 -3.133e-03 
#>    norm131    norm135    norm142    norm149    norm151    norm158    norm159 
#>  9.129e-04 -6.387e-05 -5.643e-02 -3.018e-03  3.461e-04  7.187e-04 -7.313e-04 
#>    norm160    norm165    norm166    norm167    norm170    norm171    norm175 
#>  6.255e-03  1.889e-02  3.316e-03 -1.896e-03 -4.601e-04  1.911e-02 -1.701e-02 
#>    norm180    norm184    norm188    norm189    norm192    norm195    norm196 
#>  8.102e-03  4.528e-03 -1.803e-02  1.839e-03  2.262e-02 -2.896e-03 -2.573e-03 
#>          c 
#>  1.484e-02 
#> Cross-validation time: 0.1171 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 2 ; 
#> lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2474 ; youden_index: 0.3289 ; sensitivity: 0.7353 ; specificity: 0.6667 ; geometric_mean: 0.7001 ; fdr: 0.3056 ; mcc: 0.403 ; auc: 0.8289 ; corrclass: 0.7015  
#> TP: 25 ; TN: 22 ; FP: 11 ; FN: 9 ;  betas: 
#>      norm2      norm9     norm14     norm17     norm22     norm26     norm28 
#> -0.0645914  0.0598891 -0.0674312 -0.0416586  0.0007512  0.0631425 -0.0340830 
#>     norm32     norm35     norm36     norm47     norm50     norm51     norm52 
#> -0.0079048 -0.0315867  0.0050180  0.0085638 -0.0488746  0.1158676 -0.3073828 
#>     norm53     norm62     norm69     norm71     norm72     norm74     norm76 
#> -0.0171630 -0.0323436  0.0114990  0.0042339 -0.0895150 -0.0155223  0.0050926 
#>     norm79     norm82     norm83     norm92    norm100    norm101    norm102 
#> -0.0641022  0.0031302  0.0061992  0.0045952 -0.0006344  0.3353582 -0.1677424 
#>    norm103    norm104    norm107    norm115    norm118    norm119    norm124 
#>  0.0452843  0.0030895 -0.0590861  0.0008549 -0.0138541 -0.0266964 -0.0002408 
#>    norm126    norm129    norm130    norm131    norm135    norm142    norm146 
#> -0.0025368  0.0016493  0.0061323  0.0297875 -0.0450681 -0.1276665 -0.0096072 
#>    norm148    norm158    norm160    norm165    norm166    norm171    norm174 
#> -0.0075802  0.0046764  0.0114635  0.0553625  0.0051047  0.0115194  0.0028345 
#>    norm180    norm184    norm188    norm192    norm195          c 
#>  0.0069444  0.0352305 -0.0739338  0.0191150 -0.0042548 -0.0070457 
#> Cross-validation time: 0.1109 ; Number of iterations: 10 
#> 
#> 
#> ----------------------------------------------------------------
#> |       starting with the 3 -th fold for the CV of  lambda       |
#> ----------------------------------------------------------------
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; 
#> total iters: 10 ; Backtraking iters: 906 ; lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1595 ; youden_index: 0.4309 ; sensitivity: 0.9706 ; specificity: 0.8333 ; geometric_mean: 0.8993 ; fdr: 0.1429 ; mcc: 0.8129 ; auc: 0.934 ; corrclass: 0.903 ; 
#> TP: 66 ; TN: 55 ; FP: 11 ; FN: 2 ; betas: 
#>   norm51   norm52   norm98  norm101  norm102        c 
#>  0.02201 -0.06112  0.01045  0.03708 -0.05029 -0.01111 
#> Estimation time: 0.3829 mins 
#> 
#> 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; 
#> total iters: 6 ; Backtraking iters: 619 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.394 ; youden_index: 0.7675 ; sensitivity: 0.9706 ; specificity: 0.9242 ; geometric_mean: 0.9471 ; fdr: 0.07042 ; mcc: 0.8963 ; auc: 0.9828 ; corrclass: 0.9478 ; 
#> TP: 66 ; TN: 61 ; FP: 5 ; FN: 2 ; betas: 
#>      norm2      norm7      norm8     norm10     norm12     norm33     norm36 
#> -8.924e-03  1.760e-04  3.634e-03 -1.820e-03 -3.012e-02 -2.632e-03  9.833e-04 
#>     norm38     norm45     norm51 
#>  5.766e-05  2.123e-04  5.859e-02 
#>  [ reached 'max' / getOption("max.print") -- omitted 22 entries ]
#> Estimation time: 0.308 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; 
#> total iters: 10 ; Backtraking iters: 384 ; lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.6339 ; youden_index: 0.9067 ; sensitivity: 0.9853 ; specificity: 0.9848 ; geometric_mean: 0.9851 ; fdr: 0.01471 ; mcc: 0.9701 ; auc: 0.9993 ; corrclass: 0.9851 ; 
#> TP: 67 ; TN: 65 ; FP: 1 ; FN: 1 ; betas: 
#>     norm1     norm2     norm8    norm10    norm12    norm25    norm27    norm32 
#>  0.009573 -0.019962  0.002220 -0.003928 -0.045978  0.018931 -0.004585 -0.012847 
#>    norm33    norm36 
#> -0.030224  0.018665 
#>  [ reached 'max' / getOption("max.print") -- omitted 27 entries ]
#> Estimation time: 0.1114 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; 
#> total iters: 10 ; Backtraking iters: 345 ; lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.7302 ; youden_index: 0.9938 ; sensitivity: 1 ; specificity: 1 ; geometric_mean: 1 ; fdr: 0 ; mcc: 1 ; auc: 1 ; corrclass: 1 ; 
#> TP: 68 ; TN: 66 ; FP: 0 ; FN: 0 ; betas: 
#>      norm2      norm5      norm7      norm8     norm10     norm12     norm15 
#> -0.0429020 -0.0002879  0.0013894  0.0009275 -0.0530969 -0.0856319  0.0009420 
#>     norm17     norm19     norm20 
#> -0.0018709  0.0002089  0.0003063 
#>  [ reached 'max' / getOption("max.print") -- omitted 87 entries ]
#> Estimation time: 0.1143 mins 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 3 ; 
#> lambda: 1.5 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1056 ; youden_index: 0.4128 ; sensitivity: 0.8788 ; specificity: 0.6364 ; geometric_mean: 0.7478 ; fdr: 0.2927 ; mcc: 0.531 ; auc: 0.9128 ; corrclass: 0.7576  
#> TP: 29 ; TN: 21 ; FP: 12 ; FN: 4 ;  betas: 
#>   norm51   norm52   norm98  norm101  norm102        c 
#>  0.02201 -0.06112  0.01045  0.03708 -0.05029 -0.01111 
#> Cross-validation time: 0.3829 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 3 ; 
#> lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2052 ; youden_index: 0.4229 ; sensitivity: 0.8485 ; specificity: 0.7576 ; geometric_mean: 0.8017 ; fdr: 0.2222 ; mcc: 0.6086 ; auc: 0.9229 ; corrclass: 0.803  
#> TP: 28 ; TN: 25 ; FP: 8 ; FN: 5 ;  betas: 
#>      norm2      norm7      norm8     norm10     norm12     norm33     norm36 
#> -8.924e-03  1.760e-04  3.634e-03 -1.820e-03 -3.012e-02 -2.632e-03  9.833e-04 
#>     norm38     norm45     norm51     norm52     norm64     norm66     norm79 
#>  5.766e-05  2.123e-04  5.859e-02 -1.341e-01 -1.386e-03 -1.653e-04 -5.358e-03 
#>     norm81     norm98    norm101    norm102    norm104    norm107    norm139 
#> -3.771e-02  3.610e-02  1.091e-01 -9.620e-02 -2.750e-03 -1.400e-02 -2.828e-03 
#>    norm141    norm149    norm162    norm165    norm171    norm182    norm183 
#> -1.449e-03 -1.951e-03  2.269e-03  1.886e-02  3.859e-03  4.895e-03 -3.751e-03 
#>    norm188    norm195    norm197          c 
#> -2.126e-02 -4.267e-03  4.607e-03  1.371e-02 
#> Cross-validation time: 0.308 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 3 ; 
#> lambda: 0.2466 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3042 ; youden_index: 0.4219 ; sensitivity: 0.8182 ; specificity: 0.7879 ; geometric_mean: 0.8029 ; fdr: 0.2059 ; mcc: 0.6063 ; auc: 0.9219 ; corrclass: 0.803  
#> TP: 27 ; TN: 26 ; FP: 7 ; FN: 6 ;  betas: 
#>     norm1     norm2     norm8    norm10    norm12    norm25    norm27    norm32 
#>  0.009573 -0.019962  0.002220 -0.003928 -0.045978  0.018931 -0.004585 -0.012847 
#>    norm33    norm36    norm37    norm38    norm45    norm49    norm50    norm51 
#> -0.030224  0.018665  0.035816  0.014334  0.002386 -0.015544 -0.020119  0.101471 
#>    norm52    norm60    norm79    norm81    norm98   norm100   norm101   norm102 
#> -0.185250  0.004312 -0.018793 -0.044783  0.047704  0.007257  0.129100 -0.122417 
#>   norm103   norm105   norm107   norm149   norm162   norm165   norm182   norm183 
#>  0.004531 -0.013386 -0.005617 -0.037282  0.009964  0.039251  0.024600 -0.010102 
#>   norm184   norm188   norm195   norm197         c 
#>  0.006549 -0.003960 -0.007028  0.027865  0.032417 
#> Cross-validation time: 0.1114 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET of pye
#> -> algorithm: pye_KS_proximal_gradient_method ; fold = 3 ; 
#> lambda: 0.1 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2715 ; youden_index: 0.377 ; sensitivity: 0.7879 ; specificity: 0.7576 ; geometric_mean: 0.7726 ; fdr: 0.2353 ; mcc: 0.5457 ; auc: 0.877 ; corrclass: 0.7727  
#> TP: 26 ; TN: 25 ; FP: 8 ; FN: 7 ;  betas: 
#>      norm2      norm5      norm7      norm8     norm10     norm12     norm15 
#> -4.290e-02 -2.879e-04  1.389e-03  9.275e-04 -5.310e-02 -8.563e-02  9.420e-04 
#>     norm17     norm19     norm20     norm25     norm29     norm32     norm33 
#> -1.871e-03  2.089e-04  3.063e-04  4.820e-02  7.561e-03 -1.685e-02 -3.377e-02 
#>     norm34     norm36     norm37     norm38     norm39     norm45     norm46 
#>  1.156e-03  3.197e-02  6.458e-02  1.787e-02 -5.395e-02  1.632e-03  4.784e-04 
#>     norm47     norm49     norm50     norm51     norm52     norm55     norm56 
#>  5.086e-04 -2.856e-02 -3.736e-02  1.261e-01 -3.731e-01 -3.093e-02 -2.121e-03 
#>     norm60     norm61     norm64     norm71     norm72     norm75     norm79 
#>  3.431e-02  9.420e-03 -2.163e-03  1.105e-02 -8.339e-04 -2.544e-03 -7.339e-02 
#>     norm81     norm83     norm84     norm92     norm98     norm99    norm100 
#> -8.987e-02 -1.354e-03  5.617e-04  8.175e-04  1.015e-01 -4.660e-03  5.484e-03 
#>    norm101    norm102    norm103    norm104    norm105    norm107    norm109 
#>  2.363e-01 -2.057e-01  5.936e-02 -2.986e-03 -3.003e-02 -3.129e-02  4.541e-02 
#>    norm111    norm113    norm118    norm119    norm120    norm121    norm122 
#>  5.318e-02  1.871e-02 -8.288e-03 -6.275e-04  2.150e-04  8.578e-04 -2.501e-02 
#>    norm123    norm124    norm126    norm128    norm129    norm131    norm132 
#>  2.125e-02 -1.282e-02 -2.332e-03 -1.685e-03 -2.183e-02  2.090e-03  1.085e-03 
#>    norm135    norm136    norm139    norm141    norm147    norm149    norm152 
#> -4.937e-03  8.464e-04 -5.587e-03 -2.260e-03  5.751e-02 -8.837e-02 -3.511e-02 
#>    norm153    norm157    norm159    norm162    norm165    norm166    norm167 
#> -1.181e-03 -8.656e-03 -1.536e-03  2.372e-02  5.915e-02 -4.926e-04 -1.652e-02 
#>    norm171    norm173    norm175    norm177    norm180    norm181    norm182 
#>  1.446e-04  9.811e-04 -4.880e-03  2.186e-03 -3.292e-04  5.592e-03  6.995e-02 
#>    norm183    norm184    norm185    norm187    norm188    norm190    norm191 
#> -3.580e-03  7.231e-02  3.415e-04 -1.765e-03 -3.118e-02  3.307e-02  1.816e-02 
#>    norm192    norm194    norm195    norm197    norm200          c 
#>  6.796e-06  1.111e-03 -1.070e-02  4.203e-02  4.269e-02  1.490e-02 
#> Cross-validation time: 0.1143 ; Number of iterations: 10 
#> 
#> 
#>  
#>  Starting the CV of tau using as lambda: 0.6082 , that is the best value of lambda as per: ccr 
#> ----------------------------------------------------------------
#> |       starting with the 1 -th fold for the CV of  tau       |
#> ----------------------------------------------------------------
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; 
#> total iters: 6 ; Backtraking iters: 638 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3781 ; youden_index: 0.7603 ; sensitivity: 0.9552 ; specificity: 0.9394 ; geometric_mean: 0.9473 ; fdr: 0.05882 ; mcc: 0.8948 ; auc: 0.9878 ; corrclass: 0.9474 ; 
#> TP: 64 ; TN: 62 ; FP: 4 ; FN: 3 ; betas: 
#>      norm2     norm12     norm16     norm18     norm23     norm35     norm39 
#> -0.0834877 -0.0024775  0.0014795 -0.0001693 -0.0024886 -0.0055629 -0.0139270 
#>     norm45     norm48     norm51 
#>  0.0060359 -0.0003150  0.0702604 
#>  [ reached 'max' / getOption("max.print") -- omitted 23 entries ]
#> Estimation time: 0.3188 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; total iters: 9 ; Backtraking iters: 151 ; tau: 0.15 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7618 ; youden_index: 0.7903 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9394 ; geometric_mean: 0.962 ; fdr: 0.05714 ; mcc: 0.9257 ; auc: 0.9878 ; aauc: 0 ; corrclass: 0.9624 ;
#> TP: 66 ; TN: 62 ; FP: 4 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.03618 
#> Estimation time: 0.0161 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; total iters: 10 ; Backtraking iters: 144 ; tau: 0.104 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7709 ; youden_index: 0.7923 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9394 ; geometric_mean: 0.962 ; fdr: 0.05714 ; mcc: 0.9257 ; auc: 0.9878 ; aauc: 0 ; corrclass: 0.9624 ;
#> TP: 66 ; TN: 62 ; FP: 4 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.04226 
#> Estimation time: 0.01553 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; total iters: 10 ; Backtraking iters: 144 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7832 ; youden_index: 0.825 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9697 ; geometric_mean: 0.9774 ; fdr: 0.02941 ; mcc: 0.955 ; auc: 0.9878 ; aauc: 0 ; corrclass: 0.9774 ;
#> TP: 66 ; TN: 64 ; FP: 2 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov19 
#>   -0.04714    0.03486   -0.03110 
#> Estimation time: 0.01583 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 1 ; total iters: 10 ; Backtraking iters: 162 ; tau: 0.05 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7963 ; youden_index: 0.8268 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9545 ; geometric_mean: 0.9697 ; fdr: 0.04348 ; mcc: 0.9403 ; auc: 0.9878 ; aauc: 0 ; corrclass: 0.9699 ;
#> TP: 66 ; TN: 63 ; FP: 3 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov19 
#>   -0.05096    0.03771   -0.03564 
#> Estimation time: 0.01593 mins 
#> 
#> 
#> 
#> Final results on TEST SET of covYI for the FOLD: 1 : 
#> With lambda: 0.6082 ,  penalty: SCAD and weight: 0.5 . Accuracy measures only pye: 
#> pye_KS: 0.219 ; youden_index: 0.4349 ; sensitivity: 0.8529 ; specificity: 0.8182 ; geometric_mean: 0.8354 ; fdr: 0.1714 ; mcc: 0.6717 ; auc: 0.9349 ; corrclass: 0.8358 ; 
#> TP: 29 ; TN: 27 ; FP: 6 ; FN: 5 ;  betas: 
#>      norm2     norm12     norm16     norm18     norm23     norm35     norm39 
#> -8.349e-02 -2.477e-03  1.480e-03 -1.693e-04 -2.489e-03 -5.563e-03 -1.393e-02 
#>     norm45     norm48     norm51     norm52     norm60     norm66     norm78 
#>  6.036e-03 -3.150e-04  7.026e-02 -1.272e-01  8.754e-03 -6.666e-04 -4.795e-03 
#>     norm98     norm99    norm101    norm102    norm103    norm107    norm118 
#>  5.411e-03 -1.746e-02  9.307e-02 -9.918e-02  1.797e-04 -5.460e-03 -2.026e-02 
#>    norm122    norm131    norm139    norm141    norm150    norm155    norm161 
#>  7.857e-03  9.453e-03 -2.590e-02 -5.859e-04 -1.075e-03 -5.640e-04  4.895e-03 
#>    norm170    norm177    norm193    norm197          c 
#>  2.545e-04  5.668e-03  3.508e-03  1.465e-14  1.074e-02 
#> Cross-validation time: 0.3188 ; Number of iterations: 6 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.15 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.6147 ; youden_index: 0.7059 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.7879 ; geometric_mean: 0.8476 ; fdr: 0.1842 ; mcc: 0.706 ; auc: 0.9349 ; aauc: 0 ; corrclass: 0.8507 ; 
#> TP: 31 ; TN: 26 ; FP: 7 ; FN: 3 ; gammas: 
#> norm_cov6 
#>  -0.03618 
#> Cross-validation time: 0.0161 ; Number of iterations: 9 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.104 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.6269 ; youden_index: 0.7059 ; aYI: 0 ; sensitivity: 0.9706 ; specificity: 0.7879 ; geometric_mean: 0.8745 ; fdr: 0.175 ; mcc: 0.7731 ; auc: 0.9349 ; aauc: 0 ; corrclass: 0.8806 ; 
#> TP: 33 ; TN: 26 ; FP: 7 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.04226 
#> Cross-validation time: 0.01553 ; Number of iterations: 10 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.07211 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.6264 ; youden_index: 0.7059 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.8788 ; geometric_mean: 0.8951 ; fdr: 0.1143 ; mcc: 0.7913 ; auc: 0.9349 ; aauc: 0 ; corrclass: 0.8955 ; 
#> TP: 31 ; TN: 29 ; FP: 4 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov19 
#>   -0.04714    0.03486   -0.03110 
#> Cross-validation time: 0.01583 ; Number of iterations: 10 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.05 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.6386 ; youden_index: 0.7059 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.8788 ; geometric_mean: 0.8951 ; fdr: 0.1143 ; mcc: 0.7913 ; auc: 0.9349 ; aauc: 0 ; corrclass: 0.8955 ; 
#> TP: 31 ; TN: 29 ; FP: 4 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov19 
#>   -0.05096    0.03771   -0.03564 
#> Cross-validation time: 0.01593 ; Number of iterations: 10 
#> 
#> 
#> 
#> ----------------------------------------------------------------
#> |       starting with the 2 -th fold for the CV of  tau       |
#> ----------------------------------------------------------------
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; 
#> total iters: 7 ; Backtraking iters: 1124 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3894 ; youden_index: 0.7422 ; sensitivity: 0.9403 ; specificity: 0.9242 ; geometric_mean: 0.9322 ; fdr: 0.07353 ; mcc: 0.8647 ; auc: 0.9916 ; corrclass: 0.9323 ; 
#> TP: 63 ; TN: 61 ; FP: 5 ; FN: 4 ; betas: 
#>      norm2      norm9     norm14     norm26     norm33     norm35     norm39 
#> -0.0221927  0.0094674 -0.0043182  0.0079288 -0.0002049 -0.0029455 -0.0003129 
#>     norm50     norm51     norm52 
#> -0.0010401  0.0553048 -0.1180324 
#>  [ reached 'max' / getOption("max.print") -- omitted 21 entries ]
#> Estimation time: 0.4538 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; total iters: 10 ; Backtraking iters: 143 ; tau: 0.15 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7469 ; youden_index: 0.8038 ; aYI: 0 ; sensitivity: 0.9701 ; specificity: 0.9848 ; geometric_mean: 0.9775 ; fdr: 0.01515 ; mcc: 0.955 ; auc: 0.9916 ; aauc: 0 ; corrclass: 0.9774 ;
#> TP: 65 ; TN: 65 ; FP: 1 ; FN: 2 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.03511    0.03673 
#> Estimation time: 0.01681 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; total iters: 9 ; Backtraking iters: 90 ; tau: 0.104 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7651 ; youden_index: 0.8075 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9697 ; geometric_mean: 0.9774 ; fdr: 0.02941 ; mcc: 0.955 ; auc: 0.9916 ; aauc: 0 ; corrclass: 0.9774 ;
#> TP: 66 ; TN: 64 ; FP: 2 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.04008    0.04315 
#> Estimation time: 0.01461 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; total iters: 10 ; Backtraking iters: 131 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7783 ; youden_index: 0.809 ; aYI: 0 ; sensitivity: 0.9851 ; specificity: 0.9697 ; geometric_mean: 0.9774 ; fdr: 0.02941 ; mcc: 0.955 ; auc: 0.9916 ; aauc: 0 ; corrclass: 0.9774 ;
#> TP: 66 ; TN: 64 ; FP: 2 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.04342    0.04703 
#> Estimation time: 0.01653 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 2 ; total iters: 10 ; Backtraking iters: 93 ; tau: 0.05 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7898 ; youden_index: 0.8183 ; aYI: 0 ; sensitivity: 0.9701 ; specificity: 0.9545 ; geometric_mean: 0.9623 ; fdr: 0.04412 ; mcc: 0.9249 ; auc: 0.9916 ; aauc: 0 ; corrclass: 0.9624 ;
#> TP: 65 ; TN: 63 ; FP: 3 ; FN: 2 ; gammas: 
#>  norm_cov3  norm_cov6 norm_cov11 
#>    0.01923   -0.04686    0.04676 
#> Estimation time: 0.01523 mins 
#> 
#> 
#> 
#> Final results on TEST SET of covYI for the FOLD: 2 : 
#> With lambda: 0.6082 ,  penalty: SCAD and weight: 0.5 . Accuracy measures only pye: 
#> pye_KS: 0.1794 ; youden_index: 0.3913 ; sensitivity: 0.9118 ; specificity: 0.8182 ; geometric_mean: 0.8637 ; fdr: 0.1622 ; mcc: 0.7339 ; auc: 0.8913 ; corrclass: 0.8657 ; 
#> TP: 31 ; TN: 27 ; FP: 6 ; FN: 3 ;  betas: 
#>      norm2      norm9     norm14     norm26     norm33     norm35     norm39 
#> -0.0221927  0.0094674 -0.0043182  0.0079288 -0.0002049 -0.0029455 -0.0003129 
#>     norm50     norm51     norm52     norm61     norm71     norm72     norm74 
#> -0.0010401  0.0553048 -0.1180324  0.0001712  0.0189608 -0.0086096 -0.0011047 
#>     norm75     norm79     norm82     norm83    norm101    norm102    norm103 
#> -0.0003637 -0.0084191  0.0005923  0.0066332  0.1199288 -0.0834833  0.0087865 
#>    norm107    norm131    norm142    norm152    norm165    norm171    norm188 
#> -0.0096822  0.0114343 -0.0483673 -0.0001453  0.0077519  0.0145624 -0.0089935 
#>    norm192    norm196          c 
#>  0.0001891 -0.0001453  0.0070873 
#> Cross-validation time: 0.4538 ; Number of iterations: 7 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.15 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5389 ; youden_index: 0.7353 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.8788 ; geometric_mean: 0.8951 ; fdr: 0.1143 ; mcc: 0.7913 ; auc: 0.8913 ; aauc: 0 ; corrclass: 0.8955 ; 
#> TP: 31 ; TN: 29 ; FP: 4 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.03511    0.03673 
#> Cross-validation time: 0.01681 ; Number of iterations: 10 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.104 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5589 ; youden_index: 0.7353 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.8788 ; geometric_mean: 0.8951 ; fdr: 0.1143 ; mcc: 0.7913 ; auc: 0.8913 ; aauc: 0 ; corrclass: 0.8955 ; 
#> TP: 31 ; TN: 29 ; FP: 4 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.04008    0.04315 
#> Cross-validation time: 0.01461 ; Number of iterations: 9 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.07211 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5737 ; youden_index: 0.7353 ; aYI: 0 ; sensitivity: 0.9118 ; specificity: 0.8788 ; geometric_mean: 0.8951 ; fdr: 0.1143 ; mcc: 0.7913 ; auc: 0.8913 ; aauc: 0 ; corrclass: 0.8955 ; 
#> TP: 31 ; TN: 29 ; FP: 4 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.04342    0.04703 
#> Cross-validation time: 0.01653 ; Number of iterations: 10 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.05 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5761 ; youden_index: 0.7353 ; aYI: 0 ; sensitivity: 0.8824 ; specificity: 0.8485 ; geometric_mean: 0.8653 ; fdr: 0.1429 ; mcc: 0.7315 ; auc: 0.8913 ; aauc: 0 ; corrclass: 0.8657 ; 
#> TP: 30 ; TN: 28 ; FP: 5 ; FN: 4 ; gammas: 
#>  norm_cov3  norm_cov6 norm_cov11 
#>    0.01923   -0.04686    0.04676 
#> Cross-validation time: 0.01523 ; Number of iterations: 10 
#> 
#> 
#> 
#> ----------------------------------------------------------------
#> |       starting with the 3 -th fold for the CV of  tau       |
#> ----------------------------------------------------------------
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; 
#> total iters: 6 ; Backtraking iters: 619 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.394 ; youden_index: 0.7675 ; sensitivity: 0.9706 ; specificity: 0.9242 ; geometric_mean: 0.9471 ; fdr: 0.07042 ; mcc: 0.8963 ; auc: 0.9828 ; corrclass: 0.9478 ; 
#> TP: 66 ; TN: 61 ; FP: 5 ; FN: 2 ; betas: 
#>      norm2      norm7      norm8     norm10     norm12     norm33     norm36 
#> -8.924e-03  1.760e-04  3.634e-03 -1.820e-03 -3.012e-02 -2.632e-03  9.833e-04 
#>     norm38     norm45     norm51 
#>  5.766e-05  2.123e-04  5.859e-02 
#>  [ reached 'max' / getOption("max.print") -- omitted 22 entries ]
#> Estimation time: 0.3033 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; total iters: 9 ; Backtraking iters: 414 ; tau: 0.15 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7808 ; youden_index: 0.817 ; aYI: 0 ; sensitivity: 0.9853 ; specificity: 0.9545 ; geometric_mean: 0.9698 ; fdr: 0.04286 ; mcc: 0.9407 ; auc: 0.9828 ; aauc: 0 ; corrclass: 0.9701 ;
#> TP: 67 ; TN: 63 ; FP: 3 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.05835 
#> Estimation time: 0.02049 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; total iters: 9 ; Backtraking iters: 414 ; tau: 0.104 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7922 ; youden_index: 0.8186 ; aYI: 0 ; sensitivity: 0.9853 ; specificity: 0.9545 ; geometric_mean: 0.9698 ; fdr: 0.04286 ; mcc: 0.9407 ; auc: 0.9828 ; aauc: 0 ; corrclass: 0.9701 ;
#> TP: 67 ; TN: 63 ; FP: 3 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.06452 
#> Estimation time: 0.01991 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; total iters: 10 ; Backtraking iters: 453 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.8004 ; youden_index: 0.8193 ; aYI: 0 ; sensitivity: 0.9853 ; specificity: 0.9545 ; geometric_mean: 0.9698 ; fdr: 0.04286 ; mcc: 0.9407 ; auc: 0.9828 ; aauc: 0 ; corrclass: 0.9701 ;
#> TP: 67 ; TN: 63 ; FP: 3 ; FN: 1 ; gammas: 
#> norm_cov6 
#>  -0.06855 
#> Estimation time: 0.0214 mins 
#> 
#> 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> fold = 3 ; total iters: 10 ; Backtraking iters: 447 ; tau: 0.05 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.8081 ; youden_index: 0.8283 ; aYI: 0 ; sensitivity: 0.9853 ; specificity: 0.9545 ; geometric_mean: 0.9698 ; fdr: 0.04286 ; mcc: 0.9407 ; auc: 0.9828 ; aauc: 0 ; corrclass: 0.9701 ;
#> TP: 67 ; TN: 63 ; FP: 3 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.06353    0.02332 
#> Estimation time: 0.02136 mins 
#> 
#> 
#> 
#> Final results on TEST SET of covYI for the FOLD: 3 : 
#> With lambda: 0.6082 ,  penalty: SCAD and weight: 0.5 . Accuracy measures only pye: 
#> pye_KS: 0.2052 ; youden_index: 0.4229 ; sensitivity: 0.8485 ; specificity: 0.7576 ; geometric_mean: 0.8017 ; fdr: 0.2222 ; mcc: 0.6086 ; auc: 0.9229 ; corrclass: 0.803 ; 
#> TP: 28 ; TN: 25 ; FP: 8 ; FN: 5 ;  betas: 
#>      norm2      norm7      norm8     norm10     norm12     norm33     norm36 
#> -8.924e-03  1.760e-04  3.634e-03 -1.820e-03 -3.012e-02 -2.632e-03  9.833e-04 
#>     norm38     norm45     norm51     norm52     norm64     norm66     norm79 
#>  5.766e-05  2.123e-04  5.859e-02 -1.341e-01 -1.386e-03 -1.653e-04 -5.358e-03 
#>     norm81     norm98    norm101    norm102    norm104    norm107    norm139 
#> -3.771e-02  3.610e-02  1.091e-01 -9.620e-02 -2.750e-03 -1.400e-02 -2.828e-03 
#>    norm141    norm149    norm162    norm165    norm171    norm182    norm183 
#> -1.449e-03 -1.951e-03  2.269e-03  1.886e-02  3.859e-03  4.895e-03 -3.751e-03 
#>    norm188    norm195    norm197          c 
#> -2.126e-02 -4.267e-03  4.607e-03  1.371e-02 
#> Cross-validation time: 0.3033 ; Number of iterations: 6 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.15 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5645 ; youden_index: 0.697 ; aYI: 0 ; sensitivity: 0.8788 ; specificity: 0.7576 ; geometric_mean: 0.8159 ; fdr: 0.2162 ; mcc: 0.6411 ; auc: 0.9229 ; aauc: 0 ; corrclass: 0.8182 ; 
#> TP: 29 ; TN: 25 ; FP: 8 ; FN: 4 ; gammas: 
#> norm_cov6 
#>  -0.05835 
#> Cross-validation time: 0.02049 ; Number of iterations: 9 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.104 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5738 ; youden_index: 0.697 ; aYI: 0 ; sensitivity: 0.8788 ; specificity: 0.7576 ; geometric_mean: 0.8159 ; fdr: 0.2162 ; mcc: 0.6411 ; auc: 0.9229 ; aauc: 0 ; corrclass: 0.8182 ; 
#> TP: 29 ; TN: 25 ; FP: 8 ; FN: 4 ; gammas: 
#> norm_cov6 
#>  -0.06452 
#> Cross-validation time: 0.01991 ; Number of iterations: 9 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.07211 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5807 ; youden_index: 0.697 ; aYI: 0 ; sensitivity: 0.8788 ; specificity: 0.7576 ; geometric_mean: 0.8159 ; fdr: 0.2162 ; mcc: 0.6411 ; auc: 0.9229 ; aauc: 0 ; corrclass: 0.8182 ; 
#> TP: 29 ; TN: 25 ; FP: 8 ; FN: 4 ; gammas: 
#> norm_cov6 
#>  -0.06855 
#> Cross-validation time: 0.0214 ; Number of iterations: 10 
#> 
#> 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> tau: 0.05 ; weight: 0.5 ; penalty: L12 ;  covYI_KS_L12 : 0.5986 ; youden_index: 0.697 ; aYI: 0 ; sensitivity: 0.9091 ; specificity: 0.7576 ; geometric_mean: 0.8299 ; fdr: 0.2105 ; mcc: 0.6745 ; auc: 0.9229 ; aauc: 0 ; corrclass: 0.8333 ; 
#> TP: 30 ; TN: 25 ; FP: 8 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.06353    0.02332 
#> Cross-validation time: 0.02136 ; Number of iterations: 10 
#> 
#> 
#> 
#> ----------------------> END OF THE CROSS-VALIDATION OF THE PYE METHOD <----------------- 
#> -------------> For the whoole Cross-validation it took: 4.284 minutes <------------

# 6. Print results and access optimal lambda/tau
cat("\nOptimal Lambda (based on CCR):", pye_cv_result$lambda_hat_ccr, "\n")
#> 
#> Optimal Lambda (based on CCR): 0.6082
if (c_function_of_covariates == TRUE) {
  cat("Optimal Tau (based on CCR):", pye_cv_result$tau_hat_ccr, "\n")
}
#> Optimal Tau (based on CCR): 0.07211

# You can access other results like:
pye_cv_result$auc # AUC values
#> $`lambda=0.6082201996`
#> $`lambda=0.6082201996`$train
#>        tau=0.15 tau=0.1040041912 tau=0.07211247852 tau=0.05
#> fold=1   0.9878           0.9878            0.9878   0.9878
#> fold=2   0.9916           0.9916            0.9916   0.9916
#> fold=3   0.9828           0.9828            0.9828   0.9828
#> 
#> $`lambda=0.6082201996`$test
#>        tau=0.15 tau=0.1040041912 tau=0.07211247852 tau=0.05
#> fold=1   0.9349           0.9349            0.9349   0.9349
#> fold=2   0.8913           0.8913            0.8913   0.8913
#> fold=3   0.9229           0.9229            0.9229   0.9229
pye_cv_result$n_betas # Number of non-zero betas for each lambda
#>        lambda=1.5 lambda=0.6082201996 lambda=0.2466212074 lambda=0.1
#> fold=1          6                  32                  57         37
#> fold=2          6                  30                  63         54
#> fold=3          5                  31                  36         96
pye_cv_result$n_gammas # Number of non-zero gammas for each tau
#> $`lambda=0.6082201996`
#>      tau=0.15 tau=0.1040041912 tau=0.07211247852 tau=0.05
#> [1,]        1                1                 3        3
#> [2,]        2                2                 2        3
#> [3,]        1                1                 1        2

# 7. Compute the performance over 50 simulations with the optimal lambda and tau
sim_result <- pye_KS_simulation_study(
  n = 5,
  df = df, 
  X = X, 
  y = y, 
  C = C,
  lambda = pye_cv_result$lambda_hat_ccr,
  tau = pye_cv_result$tau_hat_ccr,
  trace = 1,
  penalty = penalty, # Options: "L12", "L1", "EN", "SCAD", "MCP"
  penalty_g = penalty_g, # Options: "L12", "L1", "EN", "SCAD", "MCP"
  used_cores = 1,
  c_function_of_covariates = c_function_of_covariates,
  max_iter = max_iter, # Reduced for a quick example
  max_iter_g = 20 # Reduced for a quick example
)
#> ------------------------------------------------------------------
#> |         Starting simulation study with 5 simulations         |
#> ------------------------------------------------------------------
#> Running simulation in sequential mode (used_cores = 1).
#> 
#> --------------------> experiment n 1 of 5 <---------------------- 
#> lambda =  0.6082 ; weight: 0.5 ; penalty =  SCAD 
#> tau =  0.07211 ; weight_g: 0.5 ; penalty_g =  L12 
#> mmAPG converged because the maximum number of iteration has been reached. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 10 ; Backtraking iters: 1948 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3619 ; youden_index: 0.7507 ; sensitivity: 0.9718 ; specificity: 0.8986 ; geometric_mean: 0.9345 ; fdr: 0.09211 ; mcc: 0.8735 ; auc: 0.9839 ; corrclass: 0.9357 ; 
#> TP: 69 ; TN: 62 ; FP: 7 ; FN: 2 ; betas: 
#>     norm1     norm2     norm8    norm10    norm12    norm16    norm23    norm33 
#>  0.001209 -0.038129  0.001488 -0.002278 -0.020956  0.010696 -0.001369 -0.003117 
#>    norm50    norm51 
#> -0.007848  0.054271 
#>  [ reached 'max' / getOption("max.print") -- omitted 25 entries ]
#> Estimation time: 0.528 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 12 ; Backtraking iters: 398 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7758 ; youden_index: 0.8194 ; aYI: 0 ; sensitivity: 0.9859 ; specificity: 0.9275 ; geometric_mean: 0.9563 ; fdr: 0.06667 ; mcc: 0.9157 ; auc: 0.9839 ; aauc: 0 ; corrclass: 0.9571 ;
#> TP: 70 ; TN: 64 ; FP: 5 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov16 
#>   -0.05455    0.04707   -0.02379 
#> Estimation time: 0.0266 mins 
#> 
#> 
#> -> Results on the TEST SET 
#> -> algorithm: pye_KS_proximal_gradient_method ; simulation n. 1 of 5 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2618 ; youden_index: 0.4633 ; sensitivity: 0.9667 ; fdr: 0.1212 ; mcc: 0.8375 ; auc: 0.9633 ; corrclass: 0.9167  
#> TP: 29 ; TN: 26 ; FP: 4 ; FN: 1 ;  betas: 
#>      norm1      norm2      norm8     norm10     norm12     norm16     norm23 
#>  0.0012091 -0.0381289  0.0014884 -0.0022777 -0.0209560  0.0106959 -0.0013687 
#>     norm33     norm50     norm51     norm52     norm60     norm72     norm79 
#> -0.0031171 -0.0078483  0.0542708 -0.1294587  0.0136537 -0.0001288 -0.0009872 
#>     norm81     norm98    norm101    norm102    norm103    norm107    norm108 
#> -0.0229569  0.0117141  0.1163116 -0.0791257  0.0045781 -0.0338378  0.0046103 
#>    norm118    norm131    norm139    norm141    norm149    norm152    norm162 
#> -0.0081268  0.0098305 -0.0041641 -0.0064591 -0.0027599 -0.0123368  0.0017866 
#>    norm165    norm167    norm171    norm188    norm195    norm197          c 
#>  0.0103645 -0.0026192  0.0097248 -0.0041283 -0.0062523  0.0019291  0.0172448 
#> Estimation time: 0.528 ; Number of iterations: 10 
#> 
#> 
#> -> Results on the TEST SET
#> -> algorithm: covYI_KS_proximal_gradient_method ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.6812 ; youden_index: 0.8333 ; aYI: 0 ; sensitivity: 0.9667 ; specificity: 0.9333 ; geometric_mean: 0.9499 ; fdr: 0.06452 ; mcc: 0.9005 ; auc: 0.9633 ; aauc: 0 ; corrclass: 0.95  
#> TP: 29 ; TN: 28 ; FP: 2 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov16 
#>   -0.05455    0.04707   -0.02379 
#> Estimation time: 0.0266 ; Number of iterations: 12 
#> 
#> 
#> 
#> --------------------> experiment n 2 of 5 <---------------------- 
#> lambda =  0.6082 ; weight: 0.5 ; penalty =  SCAD 
#> tau =  0.07211 ; weight_g: 0.5 ; penalty_g =  L12 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 6 ; Backtraking iters: 623 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3673 ; youden_index: 0.7172 ; sensitivity: 0.9859 ; specificity: 0.8696 ; geometric_mean: 0.9259 ; fdr: 0.1139 ; mcc: 0.8626 ; auc: 0.9824 ; corrclass: 0.9286 ; 
#> TP: 70 ; TN: 60 ; FP: 9 ; FN: 1 ; betas: 
#>      norm2      norm8      norm9     norm12     norm33     norm35     norm36 
#> -0.0375633  0.0006549  0.0079897 -0.0068112 -0.0156184 -0.0005642  0.0056790 
#>     norm50     norm51     norm52 
#> -0.0032703  0.0776131 -0.1250317 
#>  [ reached 'max' / getOption("max.print") -- omitted 22 entries ]
#> Estimation time: 0.317 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 12 ; Backtraking iters: 382 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7456 ; youden_index: 0.7772 ; aYI: 0 ; sensitivity: 0.9859 ; specificity: 0.913 ; geometric_mean: 0.9488 ; fdr: 0.07895 ; mcc: 0.9022 ; auc: 0.9824 ; aauc: 0 ; corrclass: 0.95 ;
#> TP: 70 ; TN: 63 ; FP: 6 ; FN: 1 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.05164    0.04474 
#> Estimation time: 0.02619 mins 
#> 
#> 
#> -> Results on the TEST SET 
#> -> algorithm: pye_KS_proximal_gradient_method ; simulation n. 2 of 5 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3101 ; youden_index: 0.4778 ; sensitivity: 0.9667 ; fdr: 0.1714 ; mcc: 0.7775 ; auc: 0.9778 ; corrclass: 0.8833  
#> TP: 29 ; TN: 24 ; FP: 6 ; FN: 1 ;  betas: 
#>      norm2      norm8      norm9     norm12     norm33     norm35     norm36 
#> -3.756e-02  6.549e-04  7.990e-03 -6.811e-03 -1.562e-02 -5.642e-04  5.679e-03 
#>     norm50     norm51     norm52     norm60     norm72     norm98    norm101 
#> -3.270e-03  7.761e-02 -1.250e-01  3.509e-03 -9.589e-04  8.052e-03  1.023e-01 
#>    norm102    norm103    norm107    norm109    norm119    norm131    norm132 
#> -8.943e-02  6.659e-03 -3.394e-02  1.594e-03 -1.059e-02  6.024e-03 -1.181e-12 
#>    norm146    norm147    norm149    norm150    norm162    norm165    norm167 
#>  1.065e-03  2.288e-03 -7.748e-03 -2.460e-12  2.235e-03  9.052e-03 -1.040e-03 
#>    norm171    norm182    norm195          c 
#>  6.935e-05  2.032e-04 -7.612e-03  2.848e-03 
#> Estimation time: 0.317 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET
#> -> algorithm: covYI_KS_proximal_gradient_method ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7123 ; youden_index: 0.9333 ; aYI: 0 ; sensitivity: 0.9333 ; specificity: 0.9333 ; geometric_mean: 0.9333 ; fdr: 0.06667 ; mcc: 0.8667 ; auc: 0.9778 ; aauc: 0 ; corrclass: 0.9333  
#> TP: 28 ; TN: 28 ; FP: 2 ; FN: 2 ; gammas: 
#>  norm_cov6 norm_cov11 
#>   -0.05164    0.04474 
#> Estimation time: 0.02619 ; Number of iterations: 12 
#> 
#> 
#> 
#> --------------------> experiment n 3 of 5 <---------------------- 
#> lambda =  0.6082 ; weight: 0.5 ; penalty =  SCAD 
#> tau =  0.07211 ; weight_g: 0.5 ; penalty_g =  L12 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 6 ; Backtraking iters: 1054 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3643 ; youden_index: 0.7215 ; sensitivity: 0.9437 ; specificity: 0.942 ; geometric_mean: 0.9428 ; fdr: 0.05634 ; mcc: 0.8857 ; auc: 0.9824 ; corrclass: 0.9429 ; 
#> TP: 67 ; TN: 65 ; FP: 4 ; FN: 4 ; betas: 
#>      norm2      norm9     norm10     norm12     norm18     norm22     norm33 
#> -3.858e-02  5.095e-03 -1.742e-02 -1.475e-02 -3.994e-03 -2.842e-12 -6.076e-03 
#>     norm36     norm39     norm51 
#>  9.110e-03 -2.370e-03  7.990e-02 
#>  [ reached 'max' / getOption("max.print") -- omitted 23 entries ]
#> Estimation time: 0.4479 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 12 ; Backtraking iters: 348 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7515 ; youden_index: 0.7962 ; aYI: 0 ; sensitivity: 0.9577 ; specificity: 0.9565 ; geometric_mean: 0.9571 ; fdr: 0.04225 ; mcc: 0.9143 ; auc: 0.9824 ; aauc: 0 ; corrclass: 0.9571 ;
#> TP: 68 ; TN: 66 ; FP: 3 ; FN: 3 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov13 
#>   -0.04531    0.04576   -0.03765 
#> Estimation time: 0.02253 mins 
#> 
#> 
#> -> Results on the TEST SET 
#> -> algorithm: pye_KS_proximal_gradient_method ; simulation n. 3 of 5 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2898 ; youden_index: 0.4611 ; sensitivity: 0.8 ; fdr: 0.07692 ; mcc: 0.7399 ; auc: 0.9611 ; corrclass: 0.8667  
#> TP: 24 ; TN: 28 ; FP: 2 ; FN: 6 ;  betas: 
#>      norm2      norm9     norm10     norm12     norm18     norm22     norm33 
#> -3.858e-02  5.095e-03 -1.742e-02 -1.475e-02 -3.994e-03 -2.842e-12 -6.076e-03 
#>     norm36     norm39     norm51     norm52     norm64     norm71     norm79 
#>  9.110e-03 -2.370e-03  7.990e-02 -1.211e-01 -1.023e-03  5.925e-03 -1.137e-02 
#>     norm96     norm98     norm99    norm101    norm102    norm107    norm119 
#> -5.576e-03  1.358e-02 -7.360e-03  8.360e-02 -8.914e-02 -1.190e-02 -2.745e-03 
#>    norm131    norm139    norm142    norm147    norm148    norm149    norm152 
#>  9.464e-03 -3.841e-03 -9.452e-04  1.846e-02 -5.418e-12 -1.337e-03 -5.526e-03 
#>    norm171    norm188    norm192    norm193          c 
#>  3.057e-03 -1.079e-02  3.225e-03  1.213e-11  2.277e-02 
#> Estimation time: 0.4479 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET
#> -> algorithm: covYI_KS_proximal_gradient_method ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.6575 ; youden_index: 0.8 ; aYI: 0 ; sensitivity: 0.9333 ; specificity: 0.8667 ; geometric_mean: 0.8994 ; fdr: 0.125 ; mcc: 0.8018 ; auc: 0.9611 ; aauc: 0 ; corrclass: 0.9  
#> TP: 28 ; TN: 26 ; FP: 4 ; FN: 2 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov13 
#>   -0.04531    0.04576   -0.03765 
#> Estimation time: 0.02253 ; Number of iterations: 12 
#> 
#> 
#> 
#> --------------------> experiment n 4 of 5 <---------------------- 
#> lambda =  0.6082 ; weight: 0.5 ; penalty =  SCAD 
#> tau =  0.07211 ; weight_g: 0.5 ; penalty_g =  L12 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 6 ; Backtraking iters: 640 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3896 ; youden_index: 0.7653 ; sensitivity: 0.9577 ; specificity: 0.8986 ; geometric_mean: 0.9277 ; fdr: 0.09333 ; mcc: 0.8584 ; auc: 0.9845 ; corrclass: 0.9286 ; 
#> TP: 68 ; TN: 62 ; FP: 7 ; FN: 3 ; betas: 
#>      norm2      norm5      norm9     norm18     norm35     norm45     norm51 
#> -0.0413841 -0.0025221  0.0016441 -0.0043512 -0.0002928  0.0029710  0.0681066 
#>     norm52     norm55     norm72 
#> -0.1347239 -0.0049972 -0.0016372 
#>  [ reached 'max' / getOption("max.print") -- omitted 19 entries ]
#> Estimation time: 0.3128 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 16 ; Backtraking iters: 410 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7956 ; youden_index: 0.8359 ; aYI: 0 ; sensitivity: 0.9859 ; specificity: 0.971 ; geometric_mean: 0.9784 ; fdr: 0.02778 ; mcc: 0.9572 ; auc: 0.9845 ; aauc: 0 ; corrclass: 0.9786 ;
#> TP: 70 ; TN: 67 ; FP: 2 ; FN: 1 ; gammas: 
#>  norm_cov1  norm_cov6 norm_cov19 
#>    0.02419   -0.05397   -0.02924 
#> Estimation time: 0.03054 mins 
#> 
#> 
#> -> Results on the TEST SET 
#> -> algorithm: pye_KS_proximal_gradient_method ; simulation n. 4 of 5 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.1869 ; youden_index: 0.4067 ; sensitivity: 0.9 ; fdr: 0.2059 ; mcc: 0.6727 ; auc: 0.9067 ; corrclass: 0.8333  
#> TP: 27 ; TN: 23 ; FP: 7 ; FN: 3 ;  betas: 
#>      norm2      norm5      norm9     norm18     norm35     norm45     norm51 
#> -0.0413841 -0.0025221  0.0016441 -0.0043512 -0.0002928  0.0029710  0.0681066 
#>     norm52     norm55     norm72     norm74     norm78     norm79     norm98 
#> -0.1347239 -0.0049972 -0.0016372 -0.0001541 -0.0104261 -0.0269780  0.0333792 
#>    norm101    norm102    norm103    norm107    norm109    norm120    norm131 
#>  0.0764677 -0.0821419  0.0020298 -0.0315187  0.0180655  0.0001175  0.0393312 
#>    norm139    norm150    norm152    norm162    norm167    norm177    norm183 
#> -0.0197371 -0.0032835 -0.0026031  0.0051906 -0.0008973  0.0015815 -0.0012876 
#>          c 
#> -0.0014933 
#> Estimation time: 0.3128 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET
#> -> algorithm: covYI_KS_proximal_gradient_method ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.5096 ; youden_index: 0.7 ; aYI: 0 ; sensitivity: 0.9 ; specificity: 0.7667 ; geometric_mean: 0.8307 ; fdr: 0.2059 ; mcc: 0.6727 ; auc: 0.9067 ; aauc: 0 ; corrclass: 0.8333  
#> TP: 27 ; TN: 23 ; FP: 7 ; FN: 3 ; gammas: 
#>  norm_cov1  norm_cov6 norm_cov19 
#>    0.02419   -0.05397   -0.02924 
#> Estimation time: 0.03054 ; Number of iterations: 16 
#> 
#> 
#> 
#> --------------------> experiment n 5 of 5 <---------------------- 
#> lambda =  0.6082 ; weight: 0.5 ; penalty =  SCAD 
#> tau =  0.07211 ; weight_g: 0.5 ; penalty_g =  L12 
#> mmAPG converged because alpha is below the threshold min_alpha. 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 6 ; Backtraking iters: 653 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.3711 ; youden_index: 0.7315 ; sensitivity: 0.9577 ; specificity: 0.8986 ; geometric_mean: 0.9277 ; fdr: 0.09333 ; mcc: 0.8584 ; auc: 0.9722 ; corrclass: 0.9286 ; 
#> TP: 68 ; TN: 62 ; FP: 7 ; FN: 3 ; betas: 
#>      norm2     norm12     norm22     norm38     norm51     norm52     norm71 
#> -0.0300373 -0.0121602 -0.0001606  0.0013078  0.0562744 -0.1354793  0.0004489 
#>     norm78     norm81     norm84 
#> -0.0226522 -0.0043947 -0.0057761 
#>  [ reached 'max' / getOption("max.print") -- omitted 15 entries ]
#> Estimation time: 0.3214 mins 
#> 
#> 
#> mmAPG converged because the convergence error is below the threshold 
#> Final estimation: 
#> -> algorithm: Accelerated Proximal Gradient for Nonconvex Programming (APG), the monotone version ; 
#> total iters: 10 ; Backtraking iters: 224 ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.7505 ; youden_index: 0.7921 ; aYI: 0 ; sensitivity: 1 ; specificity: 0.9275 ; geometric_mean: 0.9631 ; fdr: 0.06579 ; mcc: 0.9309 ; auc: 0.9722 ; aauc: 0 ; corrclass: 0.9643 ;
#> TP: 71 ; TN: 64 ; FP: 5 ; FN: 0 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov13 
#>   -0.04460    0.03878   -0.02852 
#> Estimation time: 0.01947 mins 
#> 
#> 
#> -> Results on the TEST SET 
#> -> algorithm: pye_KS_proximal_gradient_method ; simulation n. 5 of 5 ; lambda: 0.6082 ; weight: 0.5 ; penalty: SCAD ; pye_KS: 0.2349 ; youden_index: 0.4322 ; sensitivity: 0.9 ; fdr: 0.129 ; mcc: 0.7671 ; auc: 0.9322 ; corrclass: 0.8833  
#> TP: 27 ; TN: 26 ; FP: 4 ; FN: 3 ;  betas: 
#>      norm2     norm12     norm22     norm38     norm51     norm52     norm71 
#> -0.0300373 -0.0121602 -0.0001606  0.0013078  0.0562744 -0.1354793  0.0004489 
#>     norm78     norm81     norm84     norm98    norm101    norm102    norm103 
#> -0.0226522 -0.0043947 -0.0057761  0.0173802  0.1497855 -0.1158011  0.0080422 
#>    norm107    norm118    norm139    norm173    norm181    norm182    norm188 
#> -0.0003115 -0.0071719 -0.0062219  0.0012471  0.0012946  0.0004397 -0.0049134 
#>    norm189    norm193    norm197          c 
#>  0.0003312  0.0084408  0.0024009  0.0132393 
#> Estimation time: 0.3214 ; Number of iterations: 6 
#> 
#> 
#> -> Results on the TEST SET
#> -> algorithm: covYI_KS_proximal_gradient_method ; tau: 0.07211 ; weight: 0.5 ; penalty: L12 ; covYI_KS: 0.6302 ; youden_index: 0.8 ; aYI: 0 ; sensitivity: 0.8667 ; specificity: 0.9 ; geometric_mean: 0.8832 ; fdr: 0.1034 ; mcc: 0.7671 ; auc: 0.9322 ; aauc: 0 ; corrclass: 0.8833  
#> TP: 26 ; TN: 27 ; FP: 3 ; FN: 4 ; gammas: 
#>  norm_cov6 norm_cov11 norm_cov13 
#>   -0.04460    0.03878   -0.02852 
#> Estimation time: 0.01947 ; Number of iterations: 10 
#> 
#> 
#> Total Simulation Time:  2.055 mins  mins.

# 8. View summary of simulation results
colMeans(sim_result$corrclass)
#>  train   test 
#> 0.9329 0.8767
colMeans(sim_result$corrclass_covYI)
#>  train   test 
#> 0.9614 0.9000

Interpretation

The estimated coefficients \(\hat{\beta}\) (typically element x1 in the output list) provide the optimal linear combination of features. Coefficients successfully shrunk to zero by the penalty are those deemed irrelevant and are effectively excluded from the final diagnostic model.

3. References

  1. The PYE estimation: Salaroli, C. J., & Pardo, M. C. (2023). PYE: A Penalized Youden Index Estimator for selecting and combining biomarkers in high-dimensional data. Chemometrics and Intelligent Laboratory Systems, 236, 104786. https://doi.org/10.1016/j.chemolab.2023.104786

  2. The covYI Estimation: Salaroli, C. J., & Pardo, M. C. (2026). covYI: A Covariate-Adjusted Penalized Youden Index Estimator for Selecting and Combining Covariates in High-Dimensional Data. Submitted for publication, currently under review.