# An Algorithm for the Fisher Information Matrix of a VARMAX Process
## 3 New Algorithm and Comparison with Other Algorithms  
We propose an algorithm based on the method in the previous section and an implementation as a notebook for Mathematica. To make use of exact computations, the coefficients of the VARMAX model as well as \(\Sigma\) and \(R_{x}\) are entered as fractions, if possible. The algorithm is provided in Figure 1 using some notations that are detailed here. The arguments \((z)\) are written [z] for the polynomials. Given the polynomial matrices \(A(z)\), \(B(z)\), and \(C(z)\) (hence denoted A[z], B[z], and C[z], respectively, in Figure 1), the vectors \(u_{p}(z)\), \(u_{q}(z)\), and \(u_{r}(z)\) (denoted up[z], uq[z], and ur[z], respectively), the zero matrices \(O_{rm\times n}\) and \(O_{qn\times m}\) (denoted Orm8n and Oqn8m, respectively), the identity matrices \(I_{n}\) and \(I_{m}\) (denoted In and Imm, respectively, noting that Im is a locked symbol), plus \(\Sigma(z)\) (denoted Sigma[z]) and \(R_{x}(z)\) (denoted Rx[z]). Then, the block matrices \(\mathcal{G}(z)\) (Gcal[z]) and \(\mathcal{K}(z)\) (Kcal[z]), are computed using the ArrayFlatten command of Mathematica, plus KroneckerProduct and Inverse, then \(\sigma(z)\) (sigma[z]), \(\mathcal{P}(z)\) (Pcal[z]), and \(\mathcal{Q}(z)\) (Qcal[z]) using also the Transpose function. Since Mathematica does not treat well circular integrals, we transform them into line integrals between \(0\) and \(2\pi\) by using the change of variable \(z=e^{if}\), \(0\leq f\leq 2\pi\), hence \(dz/z=idf\). We compute the two transformed integrals of matrices using the command Integrate and sum them up. Contrary to the computations in (Appendix B, [7]), where individual formulas (taken from [18]) were used for each element and computed using the Cauchy rule, here the (two) integrals of the whole matrices are computed symbolically. To simplify the expressions as much as possible as rational functions of \(z\), we use several times the commands Together and also Simplify. The algorithm is shown in Figure 1 as a Mathematica notebook. The example is related to a VARMAX model used by [31] and also used by [32]. The model is defined by:  
\[(1-1.5z+0.7z^{2})y_{t}=(1+0.5z)x_{t}+(1-z+0.2z^{2})\epsilon_{t}. \tag{10}\]  
* **Pcal[z_] = Together[Gcal[z].Sigma.Transpose[Gcal[1/z]]]**  
Figure 3: Partial snapshot of the Mathematica notebook to treat the example in (10). Pcal[z] is \(\mathcal{P}(z)\) and Qcal[z] \(\mathcal{Q}(z)\), both defined in (8). To save space, only the first two elements of the first integrand in (9) are shown. Figure 2: Partial snapshot of the Mathematica notebook to treat the example in (10). Gcal[z] is \(\mathcal{G}(z)\) and Kcal[z] is \(\mathcal{G}(z)\), both defined in (7). The first algorithm was due to [PERSON] (1966) for VARMA models. It is based on ([PERSON], 1963) who expressed the information matrix by a trigonometric integral involving the derivatives of the spectral density matrix of the process with respect to the parameters. The spectral density at frequency \(f\), \(f\in[-\pi,\pi]\), of a VARMAX process, e.g., (1) without the term \(\sum_{j=0}^{r-1}C_{j}x_{t-j}\), is given by \((1/2\pi)A^{-1}(e^{j})B(e^{j})\Sigma B^{*}(e^{j})A^{*-1}(e^{j})\). [PERSON] (1966) does not indicate how to evaluate these matrix integrals that he obtained. It can be seen that the integrand of each element of these matrix integrals is a rational function of \(e^{jf}\). Furthermore, the condition of stationarity implies that the denominator has a factor with zeroes in the unit circle and zeroes outside of it. [PERSON] and [PERSON] (2009) have proposed an algorithm for evaluating circular integrals of a rational function around the unit circle and ([PERSON], 2010) has proposed an implementation that consists of a series of reduction in the degrees of the involved polynomials. That method was used by ([PERSON], 1963) for the evaluation of the Fisher information matrix of ARMA models. A completely different early and effective method but restricted to ARMA models was proposed by [PERSON] and [PERSON] (2007).