Skip to contents

Introduction

Data

We illustrate the various methods using two sets of time series:

  • The retail data set contains monthly figures over US retail activity of various categories of goods and services from 1992 to 2010.
  • The ABS data set contains long monthly series over Australian retail trade.

Overview of the supported state space forms

Description of the state blocks

ar

Introduction

The auto-regressive block is defined by

Φ(B)yt=ϵt\Phi\left(B\right)y_t=\epsilon_t

where:

Φ(B)=1+φ1B++φpBp\Phi\left(B\right)=1+\varphi_1 B + \cdots + \varphi_p B^p

is an auto-regressive polynomial.

Let γi\gamma_i be the autocovariances of the process

Using those notations, the state-space block can be written as follows :

State block:

αt=(ytyt1ytp+1) \alpha_t= \begin{pmatrix} y_t \\ y_{t-1} \\ \vdots \\ y_{t-p+1} \end{pmatrix}
The state block can be extended with additional lags. That can be useful in complex (multi-variate) models

Dynamics

Tt=(φ1φp100010) T_t = \begin{pmatrix}-\varphi_1 & \cdots & \cdots & -\varphi_p \\ 1 & \cdots & \cdots & 0 \\ \vdots & \ddots & \ddots & \vdots\\ 0 & 0 & 1 & 0 \end{pmatrix}

St=σar(100) S_t = \sigma_{ar} \begin{pmatrix} 1 \\ 0 \\ \vdots\\ 0 \end{pmatrix}

Vt=SS V_t = S S'

Default loading

Zt=(100) Z_t = \begin{pmatrix} 1 & 0 & \cdots & 0\end{pmatrix}

Initialization

α1=(000) \alpha_{-1} = \begin{pmatrix}0 \\ 0 \\ \vdots\\ 0 \end{pmatrix}

P*=Ω P_{*} = \Omega Ω\Omega is the unconditional covariance of the state array; it can be easily derived using the MA representation. We have:

Ω(i,0)=γi \Omega\left(i,0\right) = \gamma_i

Ω(i,j)=Ω(i1,j1)ψiψj \Omega\left(i,j\right) = \Omega\left(i-1,j-1\right)-\psi_i \psi_j

b_ar<-ar("ar", c(-.2, .4, -.1), nlags=5)
knit_print(block_t(b_ar))
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,] -0.2  0.4 -0.1    0    0
#> [2,]  1.0  0.0  0.0    0    0
#> [3,]  0.0  1.0  0.0    0    0
#> [4,]  0.0  0.0  1.0    0    0
#> [5,]  0.0  0.0  0.0    1    0

ar2

Introduction

An alternative representation of the auto-regressive block will be very useful for the purposes of reflecting expectations. The process is defined as above:

Φ(B)yt=ϵt\Phi\left(B\right)y_t=\epsilon_t

where:

Φ(B)=1+φ1B++φpBp\Phi\left(B\right)=1+\varphi_1 B + \cdots + \varphi_p B^p

is an auto-regressive polynomial. However, modeling data that refers to expectations may require including conditional expectations in the state vector. Thus, the same type of representation that is used for the ARMA model will be considered here.

Let γi\gamma_i be the autocovariances of the model. We also define the size of our state vector as r0=max(p,h+1)r0=max(p,h+1), where hh is the forecast horizon desired by the user. If the user needs to use nlagsnlags lagged values, whose default value is zero. Then the size of the state vector will be r=r0+nlagsr=r0+nlags

Using those notations, the state-space model can be written as follows :

State block:

αt=(ytnlagsyt1ytyt+1|tyt+h|t) \alpha_t= \begin{pmatrix} y_{t-nlags} \\ \vdots \\ y_{t-1} \\ \hline y_{t} \\ y_{t+1|t} \\ \vdots \\ y_{t+h|t} \end{pmatrix}

where yt+i|ty_{t+i|t} is the orthogonal projection of yt+iy_{t+i} on the subspace generated by y(s):st{y\left(s\right):s \leq t}. Thus, it is the forecast function with respect to the semi-infinite sample. We also have that yt+i|t=j=iψjϵt+ijy_{t+i|t} = \sum_{j=i}^\infty {\psi_j \epsilon_{t+i-j}}

Dynamics

Tt=(010000100001φrφ1) T_t = \begin{pmatrix} 0 &1 & 0 & \cdots & 0 \\0& 0 & 1 & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & 0 & \cdots & 1\\ -\varphi_r & \cdots & \cdots & \cdots &-\varphi_1 \end{pmatrix}

with φj=0\varphi_{j}=0 for j>pj>p

St=σar(001ψ1ψs) S_t = \sigma_{ar} \begin{pmatrix} 0 \\ \vdots \\ 0\\ \hline 1 \\ \psi_1 \\ \vdots\\ \psi_s \end{pmatrix}

Vt=SS V_t = S S'

Default loading

Zt=(00|100) Z_t = \begin{pmatrix} 0 & \cdots &0 & | & 1 & 0 & \cdots & 0\end{pmatrix}

Initialization

α1=(00000) \alpha_{-1} = \begin{pmatrix} 0 \\ \vdots \\ 0\\ \hline 0 \\ 0 \\ \vdots\\ 0 \end{pmatrix}

P*=Ω P_{*} = \Omega

Ω\Omega is the unconditional covariance of the state array; it can be easily derived using the MA representation. We have:

Ω(i,0)=γi \Omega\left(i,0\right) = \gamma_i

Ω(i,j)=Ω(i1,j1)ψiψj \Omega\left(i,j\right) = \Omega\left(i-1,j-1\right)-\psi_i \psi_j

b_ar2<-ar2("ar2", c(-.2, .4, -.1), nlags=3, nfcasts=2)
knit_print(block_t(b_ar2))
#>      [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,]    0    1    0  0.0  0.0  0.0
#> [2,]    0    0    1  0.0  0.0  0.0
#> [3,]    0    0    0  1.0  0.0  0.0
#> [4,]    0    0    0  0.0  1.0  0.0
#> [5,]    0    0    0  0.0  0.0  1.0
#> [6,]    0    0    0 -0.1  0.4 -0.2

arma

Introduction

The arma block is defined by

Φ(B)yt=Θ(B)ϵt\Phi\left(B\right)y_t=\Theta\left(B\right)\epsilon_t

where:

Φ(B)=1+φ1B++φpBp\Phi\left(B\right)=1+\varphi_1 B + \cdots + \varphi_p B^p

Θ(B)=1+θ1B++θqBq\Theta\left(B\right)=1+\theta_1 B + \cdots + \theta_q B^q

are the auto-regressive and the moving average polynomials.

The MA representation of the process is yt=i=0ψiϵtiy_t=\sum_{i=0}^\infty {\psi_i \epsilon_{t-i}}. Let γi\gamma_i be the autocovariances of the model. We also define: r=max(p,q+1),s=r1r=\max\left(p, q+1\right), \quad s=r-1.

Using those notations, the state-space block can be written as follows :

State block:

αt=(ytyt+1|tyt+s|t) \alpha_t= \begin{pmatrix} y_t \\ y_{t+1|t} \\ \vdots \\ y_{t+s|t} \end{pmatrix}

where yt+i|ty_{t+i|t} is the orthogonal projection of yt+iy_{t+i} on the subspace generated by y(s):st{y\left(s\right):s \leq t}.Thus, it is the forecast function with respect to the semi-infinite sample. We also have that yt+i|t=j=iψjϵt+ijy_{t+i|t} = \sum_{j=i}^\infty {\psi_j \epsilon_{t+i-j}}

Dynamics

Tt=(010000100001φrφ1) T_t = \begin{pmatrix}0 &1 & 0 & \cdots & 0 \\0& 0 & 1 & \cdots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 0 & 0 & 0 & \cdots & 1\\ -\varphi_r & \cdots & \cdots & \cdots &-\varphi_1 \end{pmatrix}

with φj=0\varphi_{j}=0 for j>pj>p

St=(1ψ1ψs) S_t = \begin{pmatrix}1 \\ \psi_1 \\ \vdots\\ \psi_s \end{pmatrix}

Vt=SS V_t = S S'

Default loading

Zt=(100) Z_t = \begin{pmatrix} 1 & 0 & \cdots & 0\end{pmatrix}

Initialization

α1=(000) \alpha_{-1} = \begin{pmatrix}0 \\ 0 \\ \vdots\\ 0 \end{pmatrix}

P*=Ω P_{*} = \Omega

Ω\Omega is the unconditional covariance of the state array; it can be easily derived using the MA representation. We have:

Ω(i,0)=γi \Omega\left(i,0\right) = \gamma_i

Ω(i,j)=Ω(i1,j1)ψiψj \Omega\left(i,j\right) = \Omega\left(i-1,j-1\right)-\psi_i \psi_j

b_arma<-arma("arma", ar=c(-.2, .4, -.1), ma=c(.3, .6))
knit_print(block_t(b_arma))
#>      [,1] [,2] [,3]
#> [1,]  0.0  1.0  0.0
#> [2,]  0.0  0.0  1.0
#> [3,]  0.1 -0.4  0.2
knit_print(block_p0(b_arma))
#>           [,1]      [,2]      [,3]
#> [1,] 1.3501359 0.6394319 0.2517752
#> [2,] 0.6394319 0.3501359 0.1394319
#> [3,] 0.2517752 0.1394319 0.1001359

arima