## Implementation of the Vector Autoregressive Model

5

2

I need to code/write a Vector Autoregressive Model VAR(p) as a function of the parameters. There is no estimation, nor Data involved, this is a "population" exercise:

Assume X and Y are univariate, scalar random variables. I need to write the two following time-series models:

[Model 1] $\quad X_{t} = \sum_{j=1}^{p}a_{j}X_{t-j} + u1_{t,}, \quad\quad\quad\quad\quad\quad$ where $\;\mathbb{E}[u1_{t}]=0, \; Var[u1_{t}]=\Sigma1$

[Model 2] $\quad X_{t} = \sum_{j=1}^{p}b_{j}X_{t-j} + \sum_{j=1}^{p}c_{j}Y_{t-j} + u2_{t}, \quad$ where $\; \mathbb{E}[u2_{t}]=0, \; Var[u2_{t}]=\Sigma2$

In the first model, X only depends only on it's own past, while in the second model X depends on both the past of X and the past of Y.

EXAMPLE: if $p=2$ these models become

[Model 1] $\quad X_{t} = a_{1}X_{t-1} + a_{2}X_{t-2}+ u1_{t,}$

[Model 2] $\quad X_{t} = b_{1}X_{t-1} + b_{2}X_{t-2} + c_{1}Y_{t-1} + c_{2}Y_{t-2} + u2_{t}$

I need to do this in symbolic terms so that I can compute a population measure of Granger Causality:

$C_{Y \to X} = \frac{1}{2}\; \log\frac{\det \Sigma_{1}}{\det \Sigma_{2}}$

$\quad\quad\;\, = \frac{1}{2}\; \log\frac{Var(X_{t}) - Cov(X_{t},Z_{t})Var(Z_{t})^{-1}Cov(Z_{t},X_{t})}{Var(X_{t}) - Cov(X_{t},\tilde{Z}_{t})Var(\tilde{Z}_{t})^{-1}Cov(\tilde{Z}_{t},X_{t})}$

where $\;\;Z_{t} := [X_{t-1},..., X_{t-p}]'$ (vector that has the past X's) and $\quad\quad\quad\tilde{Z}_{t}:= [X_{t-1},..., X_{t-p}, Y_{t-1},..., Y_{t-p} ]'$ (vector that has the past X's and Y's)

MY OBJECTIVE: code $C_{Y \to X}$ as a function of the parameters $p$ and $a,b,c$ so that I can show how it changes for different values of the parameters. (There is no data, no simulation of data either)

NOTE: for people familiar with OLS (Ordinary Least Squares), this is a similar idea to doing population OLS: $\beta = \frac{Cov(X,Y)}{Var(X)}$ where $Y = \alpha + \beta X + \epsilon$, no estimation involved.

Do you have ideas how to start ?

Hi ! Care to show us what you have done so far ? – Sektor – 2014-08-19T15:43:30.323

3ARProcess handles the vector case and works symbolically. Not sure if that will help you here or not. – Andy Ross – 2014-08-19T17:51:44.310

Hi Sektor, I'm completely new at Mathematica so I was hoping to get some help to start coding (I've been watching tutorials and reading for only a couple of days). To start with, how should I write the subindex t? I wrote: $X[t] := \sum_{j=1}^{p}a1[j] X[t - 1] + u1[t]$ – DDSY – 2014-08-19T22:50:30.860

Hi Andy, I looked into the ARProcess but I couldn't figure it out how to use it symbolically :( Any example? Thanks! – DDSY – 2014-08-19T22:52:05.343