Skip to content

AR(I)MA Models

Jean Palate edited this page Jan 17, 2024 · 8 revisions

1. Definition and notations

1.1 Background

We define the backshift, foreshift operators $B,F$ by

$$ \begin{eqnarray*} B^k y_t & = & y_{t-k} \\ F^k y_t & = & y_{t+k} \end{eqnarray*} $$

Using that notation, an ARIMA process is then defined by

$$ \Delta \left(B \right) \Phi \left(B \right) y_t = \Theta \left(B \right) \epsilon_t $$

where

$$ \begin{eqnarray*} \Delta \left(B \right) & = & 1+ \delta_1 B \cdots + \delta_d B^d \\ \Phi \left(B \right) & = & 1+ \varphi_1 B \cdots + \phi_p B^p \\ \Theta \left(B \right) & = & 1+ \theta_1 B \cdots + \theta_q B^q \end{eqnarray*} $$

are respectively the differencing, auto-regressive and moving average polynomials.

We consider independent gaussian noises, i.e. $\epsilon_t \sim N(0, \sigma_\epsilon^2)$

The corresponding stationary ARMA model is defined by

$$ \Phi \left(B \right) y_t = \Theta \left(B \right) \epsilon_t $$

All the roots of $\Phi$ and $\Theta$ lie outside the unit circle

1.2 Implementation

Standard ARIMA models are implemented in the class jdplus.toolkit.base.core.arima.ArimaModel

BackFilter phi=new BackFilter(Polynomial.of(1, -0.5, -0.4));
BackFilter theta=new BackFilter(Polynomial.of(1, -0.6, 0, 0, 0, 0, 0, -0.4, 0.24));
ArimaModel arma=new ArimaModel(phi, BackFilter.ONE, theta, 12.5);
        
System.out.println(arma);

\\ output : AR = 1.00000 - 0.500000 B - 0.400000 B^2; MA = 1.00000 - 0.600000 B - 0.400000 B^7 + 0.240000 B^8; var =12.5

2. Properties of the ARMA model

2.1 Background

The Pi-weights are generated by

$$ \Pi \left(B\right) = \frac{\Phi \left(B \right)}{ \Theta \left(B \right)} $$

and the Psi-weights are generated by

$$ \Psi \left(B\right) = \frac{ \Theta \left(B \right)}{ \Phi \left(B \right)} $$

We have $\Pi \left(B \right) y_t = \epsilon_t$ and $y_t = \Psi \left(B \right) \epsilon_t$ (Wold representation)

The autocovariances of the process are generated by

$$ \Psi \left(B \right) \Psi \left(F \right) = \frac{\Theta \left(B \right) \Theta \left(F \right)}{\Phi \left(B \right) \Phi \left(F \right)}$$

2.2 The basic properties are provided for any ARMA model

\\ Example (cont.)

DoubleSeq pi=DoubleSeq.of(arma.getPiWeights().getWeights(10));
System.out.println(DoubleSeq.format(pi, "#.####"));
DoubleSeq psi=DoubleSeq.of(arma.getPsiWeights().getWeights(10));
System.out.println(DoubleSeq.format(psi, "#.####"));
DoubleSeq ac=DoubleSeq.of(arma.getAutoCovarianceFunction().values(20));
System.out.println(DoubleSeq.format(ac, "#.####"));

\\ output : 
\\ 1	-0.1	0.35	0.135	0.2075	0.1578	0.1619	-0.256	0.1768	-0.014
\\ 16.9431	-1.0095	5.9694	2.0166	3.3436	1.1334	3.4541	-3.1196	2.8219	0.1631	1.2103	0.6704	0.8193	0.6778	0.6666	0.6044	0.5689	0.5262	0.4907	0.4558

3. Advanced algorithms

3.1 From finite ACGF to MA polynomial

Given a finite ACGF defined by $\Theta(B)*\Theta(F)$ or, equivalently, by

$$ \gamma(0)+\sum_{i=1}^q{\gamma_i(z^i+z^{-i})} $$

we want to recover the original MA polynomial. This algorithm is central in the computation of the sum/difference of ARMA models

Several solutions are available. We describe below the solution used by default and the legacy solution implemented in SEATS.

3.1.1 Factorization by means of a "modified" companion matrix

The most robust algorithm to find the roots of the ACGF consists in using its "modified" companion matrix. The roots are derived from the eigen values of that matrix.

More exactly, considering that

$$z^2+z^{-2}+2=(z+z^{-1})^2 $$

and that

$$(z^i+z^{-i})+(z^{i-2}+z^{2-i}) = (z+z^{-1})(z^{i-1}+z^{1-i})$$

we have, for $z|(\Gamma(z) = 0)$:

$$ \begin{pmatrix} 0 & 1 & 0 & \cdots& \cdots & 0 \\ 2 & 0 & 1 & 0 & \cdots & 0\\ 0 & 1 & 0 & 1 & \cdots & 0 \\ \vdots & \ddots & \ddots & \ddots & \ddots & \vdots \\ 0 & \cdots & 0 & 1 & 0 & 1 \\ -\gamma_0/\gamma_q & \cdots & \cdots & \cdots& 1-\gamma_{q-2}/\gamma_q & -\gamma_{q-1}/\gamma_q \end{pmatrix} * \begin{pmatrix} 1 \\ z+z^{-1} \\ z^2+z^{-2} \\ z^3+z^{-3}\\ \vdots \\ z^{q-1}+z^{1-q} \end{pmatrix} =(z+z^{-1}) * \begin{pmatrix} 1 \\ z+z^{-1}\\ z^2+z^{-2} \\ z^3+z^{-3}\\ \vdots \\ z^{q-1}+z^{1-q} \end{pmatrix} $$

The eigen values of the matrix corresponds to $(u=z+z^{-1})$ and their associated eigen vectors are

$$\begin{pmatrix} 1 & z+z^{-1} & z^2+z^{-2} & \cdots & z^{q-1}+z^{1-q} \end{pmatrix}$$

or can be defined recursively from $u$

$$(v_0=1, v_1=u, v_2=u^2-2, v_k=u*v_{k-1}-v_{k-2})$$

The actual roots of $\Gamma$ are then easily derived:

$$ z+z^{-1}=u \iff z^2 -u*z + 1 =0 $$

Finally, it should be noted that a robust recovering of the MA polynomial needs

  • a preliminary identification of the unit roots, which are often multiple
  • a (Leja) re-ordering of the roots to avoid numerical instabilities.

That solution is implemented in internal.toolkit.base.core.math.linearfilters.EigenValuesDecomposer2 and is robust enough to treat long polynomials (for high-frequency series)

3.1.2 Factorization of the spectral representation (SEATS-legacy)

That solution is implemented in internal.toolkit.base.core.math.linearfilters.SymmetricFrequencyResponseDecomposer