This internal function performs cross validation using elastic net (ENET)
estimation via the glmnet
package. It supports parallel processing if requested.
cvVAR_ENET(X, y, nvar, opt)
An object of class cv.glmnet
as returned by glmnet::cv.glmnet
.
A numeric matrix of predictors.
Numeric vector of responses.
Integer. The number of variables in the original VAR (number of columns in data).
List. A list of options including:
alpha
: The elastic net mixing parameter (default = 1).
nlambda
: Number of lambda values (default = 100).
type.measure
: Error measure for CV (default = "mse").
nfolds
: Number of folds for CV (default = 10).
parallel
: Logical. Whether to use parallel processing (default = FALSE).
ncores
: Number of cores for parallel processing (default = 1).
lambdas_list
: Optionally, a user-specified list of lambdas.
folds_ids
: Optionally, user-specified fold IDs for CV.