Estimation of vector autoregressive (VAR) process
Let's estimate the parameters for the following model.
sample =
RandomFunction[
ARProcess[{{{.2, -.4}, {-.2, 0}}}, {{.1, -0.05}, {-0.05, .15}}],
{1, 1000}]
Next, use the function EstimatedProcess
to perform the estimation:
α = {{α1, α2}, {α3, α4}};
Σ = {{σ11, σ12}, {σ21, σ22}};
EstimatedProcess[sample, ARProcess[{α}, Σ]]
Note that when you pass ARProcess
to EstimatedProcess
the matrix α
should be under curly brackets {α}
.
If you want to run a Restricted VAR, you only need to include the restricted parameters in the α matrix. For example, if you want to set
α2 = 0.5
and α3 = 0.03`, you can run
α = {{α1, 0.5}, {0.03, α4}};
Σ = {{σ11, σ12}, {σ21, σ22}};
EstimatedProcess[sample, ARProcess[{α}, Σ]]
As was mentioned in the comments above as of yet Mathematica is not able to estimate VAR processes.
So I've tried and implemented VAR estimation function. Actually I've directly translated Cesa-Bianchi's MATLAB code [1].
My code is available here: http://www.alexisakov.com/p/economica.html.
Here is a simple example:
<<Economica`
S = Import[FileNameJoin[{$UserBaseDirectory, "Applications", "Economica",
"Kernel", "TimeSeries", "VAR", "BQ_Data.xls"}], {"Data", 1}];
data = S[[3 ;;, {2, 3}]];
Then fit VAR:
VARout = VARModelFit[data, 8];
VARModelFit returns association with a number of results. Matrix of coefficient estimates is Ft:
coeffs=VARout["Ft"]
Other properties are fit residuals and variance-covariance matrix. Generally all the names are similar to those used by [1].
- Ambrogio Cesa-Bianchi, 2014. "VAR Toolbox", sites.google.com/site/ambropo/".
I prepared a small demonstration with a solution: demonstrations.wolfram.com/AModelOfVectorAutoregression