View source: R/main_function.R
cvVAR | R Documentation |
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)
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 |
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. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.