Arguments

glmnet_fit: Object from glmnet fit

x: A matrix of the predictors, each row is an observation vector.

y A vector of response variable.

s Value of the penalty parameter "lambda" selected from the original cv.glmnet

nfolds Number of folds for cross validation as in cv.glmnet

B Number of bootsrap samples

cv_replicates Number of replicates for the cross-validation step

n_cores number of cores to use in parallel. Default detectCores()-1

Details

Main objective of a predictive model is to provide accurated predictions of a new observations. Unfortunately we don´t know how well the model performs. In addition, at the current era of omic data where p >> n is not reasonable applying internal validation using data-splitting. Under this background a good method to assessing model performance is applying internal bootstrap validation.
The followed approach is described in Harrel et al. (1996) and on the fantastic blog written by Jonathan Bartlett. The bootstrap validation procedure consists of the following steps.

Fit the model to original data, and estimate the measure of predictive accuracy A (for example AUC from the ROC curve in case of binary outcome or R^2 for numeric outcome). Denote this as A{orig}

Repeat this process almost B = 100 or 200 times

Make a bootstrap sample from the original data

Fit the model to the bootstrap sample, and estimate A using the fitted model on the bootstrap sample. Denote this as A_b

Estimate A by applying the fitted bootstrap model on the original dataset. Denote this as A{b,orig}