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.
cvVAR(data, p, opt = NULL)
A list with components:
Vector of means of the original series.
List of VAR coefficient matrices (one for each lag).
The complete elastic net CV fit (if requested).
The optimal lambda value chosen by CV.
The minimum mean squared error from CV.
Standard deviation of the MSE.
Elapsed time for the ENET estimation.
The transformed series (after centering/scaling).
Residuals from the VAR model.
Estimated covariance matrix of the residuals.
A numeric matrix with time series data (observations in rows, variables in columns).
Integer. The order of the VAR model.
List. A list of options (see fitVAR
for details).