how to enter coefficient matrices of a VAR into dse::ARMA?
On 01/17/2016 10:48 AM, Degang WU wrote:
Hi,
Suppose I have a VAR(p) process with known coefficient matrices
y_t = A_1 y_{t-1} + A_2 y_{t-2} + .. A_p y_{t-p} + e_t
y_t = A_1 y_{t-1} + A_2 y_{t-2} + .. A_p y_{t-p} + e_t (1)
where {y_i} are vectors, {A_i} are coefficient matrices and e_t is
white noise.
Now I want to enter the coefficient matrices into dse::ARMA.
However, dse::ARMA requires writing the process in the form of
A(L)y(t) = B(L)w(t) + C(L)u(t) + TREND(t),
where A(L)=I - \sum_i A_i L^i, where L is the lag operator.
I have no idea how to write the lag operator as a numerical matrix.
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.]
The documentation of dse::ARMA future states that A is a (axpxp) is the auto-regressive polynomial array. which is even more confusing.
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.
The example in the documentation is
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))
However, the example does not mention what the coefficient matrices
{A_i} look like in the first place, so it does not help at all.
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
So my question is, how to write the matrix A dse::ARMA requires in
terms of known coefficient matrices {A_i}?
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
Regards, Degang Wu [[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.