A CORRECTED ALGORITHM FOR COMPUTING THE THEORETICAL AUTOCOVARIANCE MATRICES OF A VECTOR ARMA MODEL José Alberto Mauricio Instituto Comlutense de Análisis Económico Universidad Comlutense de Madrid Camus de Somosaguas 28223 Madrid - SPAIN Abstract: The algorithm of Kohn and Ansley (1982) is reconsidered here, in order to correct several imlementation errors concerning the construction of the linear equations that must be solved for comuting the theoretical autocovariance matrices of a vector ARMA model. This note resents a concise descrition of the corrected algorithm. Resumen: En esta nota se corrigen algunos errores del algoritmo de Kohn y Ansley (1982), que tienen que ver con la construcción de un sistema de ecuaciones lineales ara calcular las matrices de autocovarianzas teóricas de un modelo ARMA multivariante. March 1995
1. INTRODUCTION Consider the stationary vector ARMA(,q) model: Φ(B) w t = Θ(B)a t, (1) where Φ(B) =I m Φ 1 B Φ 2 B 2 Φ B, Θ(B) =I m Θ 1 B Θ 2 B 2 Θ q B q, Φ i (i = 1,..., ) and Θ i (i = 1,..., q) are m m arameter matrices, I m is the identity matrix of order m, µ is the m 1 mean vector, w t = w t µ is the m 1 vector of mean-corrected observations at time t, B is the backshift oerator (B k z t = z t k ), and the a t 's are m 1 random vectors identically and indeendently distributed, with E[a t ]=0, E[a t a T t ]=Σ (symmetric and ositive definite) and E[a t at t+k ]=0 (k /= 0). The theoretical autocovariance matrices of the stationary rocess w t generated by (1) are defined by Γ k = E[ w t w T t+k ]=E[ w t k w T t ]=Γ T k, and can be shown to be given by the following exression (see, for examle, Jenkins and Alavi 1981): Γ k = Γ k 1 Φ T 1 + + Γ k Φ T + Λ k Λ k 1 Θ T 1 Λ k q Θ T q (k 0), (2) where Λ i = E[ w t a T t +i ]=E[ w t i at t ] is the theoretical cross-covariance matrix of order i between w t and a t. The comutational roblem arises in the calculation of the Γ k 's, since, although the Λ i 's need to be obtained too, their calculation is straightforward (see Section 2). 1
Both the theoretical autocovariance and cross-covariance matrices are needed, for examle, to comute the objective function during exact maximum likelihood estimation of (1) (see, among others, Hall and Nicholls 1980; Shea 1989; and Mauricio 1995). Other alications include the generation of indeendent realizations from a vector ARMA model (see, for examle, Shea 1988), which is articularly useful in Monte Carlo studies. Thus, as Kohn and Ansley (1982) oint out, it is imortant to have a fast method of obtaining those matrices, since they are recalculated many times during both estimation and simulation runs. The method of Kohn and Ansley (1982) rovides a fast means of comuting the autocovariance matrices. In articular, it is faster than the methods of Hall and Nicholls (1980) and Ansley (1980). However, the imlementation in the algorithmic section of Kohn and Ansley (1982,. 278-279) is incorrect. In articular, the guidelines on the construction of the linear equations, that must be solved in order to comute the first autocovariance matrices, are wrong. A corrected version of that algorithm, based on the theoretical background of Section 2, is resented in Section 3. The construction of both the matrix and the right-hand-side vector of the system of linear equations for the first autocovariance matrices, is described in detail. Some further comments in Section 4 comlete this note. 2. THEORETICAL BACKGROUND In order to motivate the algorithm of Section 3, a concise summary of the method roosed by Kohn and Ansley (1982), using the notation introduced in Section 1, is now given. First, ostmultilying (1) by a T t +i, taking exectations, and noting that E[ w t i a T t ]=E[a t at t +i ]=0 for i > 0, it is straightforward to show that Λ i = Θ i Σ i + Φ j Λ j i (i 1), (3) where Φ j = 0 if j >, Λ 0 = Σ, and Λ i = 0 for i > 0. Then, writing out (2) for k = 0 and for k 1: 2
where Γ 0 = Γ i Φ T i q + Λ 0 Λ j Θ T j, Γ k = W k + Γ k j Φ T j (k 1), q W k = Λ k j Θ T j (k 1). j=k (4) (5) (6) Noting that Γ i = Γ T i and using (5), with k = i, in (4), it turns out that where Γ 0 = W 0 + Φ i Γ i j Φ T j, W 0 = Σ (B + B T q )+ Θ j ΣΘ T j, B = q Φ i Λ i j Θ T j. j=i (7) (8) (9) Finally, since Γ k = Γ T k, it is clear that, when (5) and (6) are written for k = 1,..., 1, only Γ 0 through Γ 1 (unknown) and Λ 0 through Λ q+1 (known) aear in equations (5) through (9). Thus, the following system of linear equations may be secified in order to calculate the first unknown theoretical autocovariance matrices: Γ 0 Φ i Γ 0 Φ T i k 1 Γ k Γ i Φ T k i 1 k i [ Φ i+j Γ i Φ T j + Φ j Γ T i Φ T i+j ]=W 0 Γ T i Φ T k+i = W k i=0 (k = 1,..., 1) (10) (11) Together, exressions (10) and (11) form a system of m 2 linear equations with m 2 unknowns (the m 2 elements of each of the matrices Γ k, k = 0, 1,..., 1). But since Γ 0 is symmetric, it contains only m(m+1)/2 different elements. Thus, letting Γ 0 and W 0 be the diagonals and uer triangles of Γ 0 and W 0, resectively, the m(m+1)/2 + m 2 ( 1) unknowns in (10) and (11) are the (unique) solution x of the linear 3
system Ax = b, where x = vec( Γ 0, Γ 1,..., Γ 1 ), b = vec( W 0, W 1,..., W 1 ) and A is the matrix of coefficients, which is constructed as described in the next section. 3. THE CORRECTED ALGORITHM In order to concentrate on the more relevant asects of the algorithm (the construction of A and b), it is assumed that Λ 0 and Λ 1 through Λ q+1, as well as W 0, have already been comuted using (3), (8) and (9). Now, it is shown how to construct A and b row by row. First, initialize A and b to zero; then, execute the following two stes: Ste 1. Comute the first m(m+1)/2 rows: FOR j =1TOm FOR i =1TOj row = j( j 1)/2 + i Ste 1.1. Comute the first m(m+1)/2 columns within row: FOR l =1TOm FOR k =1TOl col = l(l 1)/2 + k IF k = l ELSE A(row,col) = Φ r (i,k)φ r ( j,l) r=1 A(row,col) = [ Φ r (i,k)φ r ( j,l) +Φ r (i,l)φ r ( j,k) ] r=1 4
Ste 1.2. Comute the remaining m 2 ( 1) columns within row: FOR s =1TO 1 FOR l =1TOm FOR k =1TOm col = m(m+1)/2 + m 2 (s 1) + m(l 1) + k s A(row,col) = [ Φ r+s (i,k)φ r ( j,l) +Φ r+s ( j,k)φ r (i,l) ] r=1 Ste 1.3. Set u diagonal of A and right-hand-side b: A(row,row) =1+A(row,row) b(row) = W 0 (i,j) Ste 2. Comute the remaining m 2 ( 1) rows: FOR s =1TO 1 FOR i =1TOm FOR j =1TOm row = m(m+1)/2 + m 2 (s 1) + m(i 1) + j Ste 2.1. Comute the first m(m+1)/2 columns within row: FOR l =1TOm IF l j col = j( j 1)/2 + l ELSE col = l(l 1)/2 + j A(row,col) = Φ s (i,l) 5
Ste 2.2. Comute the remaining m 2 ( 1) columns within row: FOR r =1TO 1 FOR l =1TOm col = m(m+1)/2 + m 2 (r 1) + m( j 1) + l IF r+s A(row,col) = Φ r+s (i,l) IF s > r col = m(m+1)/2 + m 2 (r 1) + m(l 1) + j A(row,col) =A(row,col) Φ s r (i,l) Ste 2.3. Set u diagonal of A and right-hand-side b: A(row,row) =1+A(row,row) FOR h = s TO q m b(row) =b(row) Λ s h ( j,k)θ h (i,k) k=1 END. Once A and b are constructed, the solution x = A 1 b may be obtained using standard numerical linear algebra routines (see, for examle, Moler 1972; and Press et al. 1992). Then, the elements of the theoretical autocovariance matrices can be extracted from x as follows: Γ 0 (i,j) x j( j 1)/2+i (i = 1,..., m; j = i,..., m) ; Γ k (i,j) x m(m+1)/2+m 2 (k 1)+m( j 1)+i (i = 1,..., m; j = 1,..., m ),k = 1,..., 1. For k, the autocovariances can be comuted recursively using (5), (6) and (3). 6
4. CONCLUDING REMARKS Note that, excet for the first m(m+1)/2 coefficients in each of the first m(m+1)/2 rows of A (ste 1.1 above), the imlementation resented here differs from that of Kohn and Ansley (1982), which is incorrect. To note this, comuter rograms were written by the author, following the imlementation in Kohn and Ansley (1982) and the one described in Section 3. The theoretical autocovariance matrices, calculated through the imlementation in Kohn and Ansley (1982) for a wide range of vector ARMA models, always showed substantial differences with the results obtained through the imlementation described here. Furthermore, the latter results always agreed with those obtained through standard rocedures, such as that of Hall and Nicholls (1980) as imlemented in Shea (1989). REFERENCES Ansley, C. F. (1980), Comutation of the Theoretical Autocovariance Function for a Vector ARMA Process, Journal of Statistical Comutation and Simulation, 12, 15-24. Hall, A. D. and Nicholls, D. F. (1980), The Evaluation of Exact Maximum Likelihood Estimates for VARMA Models, Journal of Statistical Comutation and Simulation, 10, 251-262. Jenkins, G. M. and Alavi, A. S. (1981), Some Asects of Modeling and Forecasting Multivariate Time Series, Journal of Time Series Analysis, 2, 1-47. Kohn, R. and Ansley, C. F. (1982), A Note on Obtaining the Theoretical Autocovariances of an ARMA Process, Journal of Statistical Comutation and Simulation, 15, 273-283. Mauricio, J. A. (1995), Exact Maximum Likelihood Estimation of Stationary Vector ARMA Models, Journal of the American Statistical Association, 90, 282-291. Moler, C. B. (1972), Algorithm 423: Linear Equation Solver, Communications of the Association for Comuting Machinery, 15, 274. 7
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery, B. P (1992), Numerical Recies in C (2nd edition), Cambridge: Cambridge University Press. Shea, B. L. (1988), A Note on the Generation of Indeendent Realizations of a Vector Autoregressive Moving-Average Process, Journal of Time Series Analysis, 9, 403-410. Shea, B. L. (1989), Algorithm AS 242: The Exact Likelihood of a Vector Autoregressive Moving-Average Model, Alied Statistics, 38, 161-204. 8