Part 5
Part 5
⊲ MATH11131
models
Part 5: State Space
Ioannis Papastathopoulos
School of Mathematics, University of Edinburgh
1 / 31
MATH11131 Part 5: State Space
models
2 / 31
Introduction
3 / 31
Basic Idea I
4 / 31
Basic Idea II
5 / 31
Multivariate normal distribution
Lemma 1. If X ∼ Nn (µ, Σ), Y1T = (X1 , . . . , Xq ) and Y2T = (Xq+1 , . . . , Xn ), and we write
Nile data
Forecast errors
Implications of (2)
State error recursion
State smoothing I
Y1 µ1 Σ11 Σ12
State smoothing II
X= ∼ Nn ,
Kalman filter and smoother
State smoothing III
Y2 µ2 Σ21 Σ22
Nile data
Missing values
Nile data then
Initialisation
General state space model
ARMA model
the marginal distribution of Y1 is Nq (µ1 , Σ11 )
Comparison with ARIMA models
Summary
the conditional distribution of Y1 given Y2 = y2 is
6 / 31
A useful lemma
7 / 31
Local trend model
8 / 31
Local trend model
0.0
Notation and basic identities
−0.5
Kalman filter
Kalman filter
mu
−1.0
Kalman filter
−1.5
Nile data
Nile data
0 20 40 60 80 100
Forecast errors
Time
Implications of (2)
State error recursion
State smoothing I
0.0
State smoothing II
−0.5
Nile data
−1.5
Missing values
Nile data 0 20 40 60 80 100
Initialisation Time
Summary
−0.5
−1.0
−1.5
0 20 40 60 80 100
Time
9 / 31
Filtering, prediction and smoothing
10 / 31
Notation and basic identities
11 / 31
Kalman filter
12 / 31
Kalman filter
13 / 31
Kalman filter
14 / 31
Nile data
1400
A useful lemma
Local trend model
Local trend model
1000
Filtering, prediction and smoothing
Nile
Notation and basic identities
Kalman filter
600
Kalman filter
Kalman filter
⊲ Nile data
1880 1900 1920 1940 1960
Nile data
Forecast errors Time
Implications of (2)
State error recursion
State smoothing I
State smoothing II
Kalman filter and smoother
2
Nile data
residuals
Missing values
0
Nile data
−3 −2 −1
Initialisation
General state space model
ARMA model
Comparison with ARIMA models 1880 1900 1920 1940 1960
Summary
Time
Measurements of the annual flow of the river Nile at Aswan (formerly Assuan), 1871-1970,
in 108 m3 .
15 / 31
Nile data
2
Local trend model
1
Local trend model
0
−3 −2 −1
Filtering, prediction and smoothing
Notation and basic identities
Kalman filter
1880 1900 1920 1940 1960
Kalman filter
Time
Kalman filter
Nile data ACF of Residuals
⊲ Nile data
1.0
Forecast errors
Implications of (2)
0.6
ACF
State smoothing I
State smoothing II
−0.2
Initialisation
General state space model
p value
ARMA model
Comparison with ARIMA models
Summary
2 4 6 8 10
lag
16 / 31
Forecast errors
0 ··· 0
Kalman filter and smoother
State smoothing III
1 0
Nile data
Missing values
k21 1 0 ··· 0
k.31 k.32 1 ·.· · 0.
Nile data
Initialisation
K=
.. .. . . ..
General state space model
ARMA model
Comparison with ARIMA models
Summary kn1 kn2 kn3 · · · 1
where ki,i−1 = −Ki−1 , kij = −(1 − Ki−1 )(1 − Ki−2 ) · · · (1 − Kj+1 )Kj ,
for i = 2, . . . , n and j = 1, . . . , i − 2.
17 / 31
Implications of (2)
KΣK T = diag(V1 , . . . , Vn ).
Basic Idea II
Multivariate normal distribution
A useful lemma
Local trend model
Local trend model
Filtering, prediction and smoothing
This suggests how to compute the likelihood from the data, as
Notation and basic identities
Kalman filter
n
Kalman filter Y
Kalman filter
Nile data
f (y1 , . . . , yn ; θ) = f (vt ; θ),
Nile data
Forecast errors
i=1
⊲ Implications of (2)
State error recursion
State smoothing I where vt ∼ N (0, Vt ), and the variances Vt depend on the parameters θ = (σ 2 , ση2 ); we
State smoothing II
Kalman filter and smoother assume that µ1|0 and Σ1|0 are known.
State smoothing III
Nile data
Missing values
For the river Nile, we find σ̂ 2 = 15098.577, σ̂η2 = 1469.147, so the changes in the state
Nile data
Initialisation
due to the ‘state innovation’ ηt are dwarfed by the ‘observation error’ εt .
General state space model
ARMA model
Comparison with ARIMA models
It is not uncommon to find variance estimates of zero, so care is needed.
Summary
Parameter estimation for many other time series is implemented analogously to this.
18 / 31
State error recursion
19 / 31
State smoothing I
20 / 31
State smoothing II
where qn = 0, and µt|t−1 , Σt|t−1 , and Lt = 1 − Kt are available from the forward pass of
the Kalman filter (1)
21 / 31
Kalman filter and smoother
22 / 31
State smoothing III
23 / 31
Nile data
1400
Local trend model
Filtering, prediction and smoothing
Notation and basic identities
1000
Kalman filter
Nile
Kalman filter
Kalman filter
600
Nile data
Nile data
Forecast errors
1880 1900 1920 1940 1960
Implications of (2)
State error recursion Time
State smoothing I
State smoothing II
Kalman filter and smoother
1400
Nile data
Nile
Initialisation
General state space model
ARMA model
600
Time
24 / 31
Missing values
25 / 31
Nile data
1400
Local trend model
Filtering, prediction and smoothing
Notation and basic identities
1000
Kalman filter
Nile
Kalman filter
Kalman filter
600
Nile data
Nile data
Forecast errors
1880 1900 1920 1940 1960
Implications of (2)
State error recursion Time
State smoothing I
State smoothing II
Kalman filter and smoother
1400
Initialisation
General state space model
ARMA model
600
Time
26 / 31
Initialisation
The Kalman filter is initialised by taking µ1 ∼ N (µ1|0 , Σ1|0 ). Now we discuss the choice
MATH11131 Part 5: State Space of µ1|0 and Σ1|0 .
models
If setting Σ1|0 = ∞ is problematic, one may need to estimate µ1 in the same way as the
other parameters.
27 / 31
General state space model
Essentially, all the previous computations go through again, but with a lot of linear
algebra—see, for example, Shumway and Stoffer: Time Series Analysis and Its
Applications: With R Examples (2006, Chapter 6)
28 / 31
ARMA model
Consider the ARMA(p, q) model written in the form
MATH11131 Part 5: State Space
models r−1
X r−1
X
State space models
Introduction yt = φj yt−j + εt + θj εt−j , t = 1, . . . , n,
Basic Idea I
Basic Idea II j=1 j=1
Multivariate normal distribution
A useful lemma
Local trend model where r = max(p, q + 1) and for which some of the coefficients are zero.
Local trend model
Filtering, prediction and smoothing We set
Notation and basic identities
Kalman filter
Kalman filter
Kalman filter Zt = (1 0 0 · · · 0),
Nile data
Nile data yt
Forecast errors
Implications of (2)
φ2 yt−1 + · · · + φr yt−r+1 + θ1 εt + · · · + θr−1 εt−r+2
State error recursion
29 / 31
Comparison with ARIMA models
30 / 31
Summary
31 / 31