cvVAR: Cross-Validated VAR Estimation using Elastic Net

View source: R/main_function.R

cvVARR Documentation

Cross-Validated VAR Estimation using Elastic Net

Description

This internal function performs cross validation for VAR estimation using the elastic net penalty. It prepares the data, calls the elastic net CV routine, reshapes the estimated coefficients, applies optional thresholding, computes residuals, and estimates the error covariance.

Usage

cvVAR(data, p, opt = NULL)

Arguments

data

A numeric matrix with time series data (observations in rows, variables in columns).

p

Integer. The order of the VAR model.

opt

List. A list of options (see fitVAR for details).

Value

A list with components:

mu

Vector of means of the original series.

A

List of VAR coefficient matrices (one for each lag).

fit

The complete elastic net CV fit (if requested).

lambda

The optimal lambda value chosen by CV.

mse

The minimum mean squared error from CV.

mse_sd

Standard deviation of the MSE.

time

Elapsed time for the ENET estimation.

series

The transformed series (after centering/scaling).

residuals

Residuals from the VAR model.

sigma

Estimated covariance matrix of the residuals.


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