fitVAR {VARcpDetectOnline} | R Documentation |
Fit VAR Model with Elastic Net via Cross Validation
Description
Estimates a (possibly high-dimensional) VAR model using penalized least squares with an elastic net penalty and cross validation. This function is adapted from the sparsevar package (https://github.com/svazzole/sparsevar/tree/master), which is distributed under the GNU General Public License v2. The code has been modified to specifically implement the elastic net penalty (penalty = "ENET") and cross validation (method = "cv").
Usage
fitVAR(data, p = 1, ...)
Arguments
data |
A numeric matrix or data frame with time series data (observations in rows, variables in columns). |
p |
Integer. The order of the VAR model. |
... |
Additional options for estimation. Global options include:
|
Value
A list with the following components:
mu |
A vector of means for each variable. |
A |
A list (of length |
fit |
(Optional) The complete results of the penalized least squares estimation. |
lambda |
The chosen lambda value (by cross validation). |
mse |
The minimum mean squared error from cross validation. |
mse_sd |
The standard deviation of the mean squared error. |
time |
Elapsed time for the estimation. |
series |
The (possibly transformed) input time series. |
residuals |
The residuals of the VAR model. |
sigma |
The estimated variance/covariance matrix of the residuals. |
References
The original source code is adapted from the sparsevar package, which is distributed under the GNU General Public License v2.