View source: R/main_function.R
fitVAR | R Documentation |
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").
fitVAR(data, p = 1, ...)
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:
|
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. |
The original source code is adapted from the sparsevar package, which is distributed under the GNU General Public License v2.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.