cvVAR_ENET: Cross Validation for Elastic Net VAR Estimation

View source: R/main_function.R

cvVAR_ENETR Documentation

Cross Validation for Elastic Net VAR Estimation

Description

This internal function performs cross validation using elastic net (ENET) estimation via the glmnet package. It supports parallel processing if requested.

Usage

cvVAR_ENET(X, y, nvar, opt)

Arguments

X

A numeric matrix of predictors.

y

Numeric vector of responses.

nvar

Integer. The number of variables in the original VAR (number of columns in data).

opt

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.

Value

An object of class cv.glmnet as returned by glmnet::cv.glmnet.


VARcpDetectOnline documentation built on April 12, 2025, 1:44 a.m.