Skip to content
Prev 13665 / 15274 Next

how to enter coefficient matrices of a VAR into dse::ARMA?

On 01/17/2016 10:48 AM, Degang WU wrote:
y_t = A_1 y_{t-1} + A_2 y_{t-2} + .. A_p y_{t-p} + e_t  (1)
The lag operator is strictly notational. Writing (1) in the dse 
convention would be

  y_t + A_1 y_{t-1} + A_2 y_{t-2} + .. A_p y_{t-p} = e_t  (2)

so you need to change the sign on all but the zero lag y coefficient 
when you convert from (1) to (2). Beware that one consequence of this is 
that roots are inverted relative to the unit circle, so stable models 
will be inside rather than outside.

[BTW, while (1) may be more widely used and intuitive to practitioners, 
(2) has a big advantage for theoretical work: A(L) is a standard matrix 
of polynomials, thus a ring, and some heavy mathematical machinery can 
be applied.]
You point out a technical mistake in the wording, but I doubt that is 
the source of your confusion. Technically, A is a pxp matrix, with 
elements that are polynomials. A polynomial of degree a-1 is represented 
by its a coefficients so A becomes an axpxp array in R.
You can print these out:

 >  AR <- array(c(1, .5, .3, 0, .2, .1, 0, .2, .05, 1, .5, .3)
           ,c(3,2,2))

 >  VAR  <- ARMA(A=AR, B=diag(1,2))

 > VAR

A(L) =
1+0.5L1+0.3L2    0+0.2L1+0.05L2
0+0.2L1+0.1L2    1+0.5L1+0.3L2

B(L) =
1    0
0    1


 > AR

, , 1

      [,1] [,2]
[1,]  1.0  0.0
[2,]  0.5  0.2
[3,]  0.3  0.1

, , 2

      [,1] [,2]
[1,] 0.00  1.0
[2,] 0.20  0.5
[3,] 0.05  0.3

 > AR[1,,]

      [,1] [,2]
[1,]    1    0
[2,]    0    1
If the above is not enough then I would suggest reading up a bit more on 
R. Once-upon-a-time I included an R/S tutorial in the dse documentation, 
but I removed that a long time ago because there are much better ones 
available.

HTH,
Paul