0% found this document useful (0 votes)
41 views10 pages

State Space Models

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views10 pages

State Space Models

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Cambridge University Press

052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

Part I
State space models

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

1
Introduction to state space time series analysis
James Durbin
Department of Statistics, London School of Economics and Political Science

Abstract
The paper presents a broad general review of the state space approach to
time series analysis. It begins with an introduction to the linear Gaussian
state space model. Applications to problems in practical time series analysis
are considered. The state space approach is briefly compared with the Box–
Jenkins approach. The Kalman filter and smoother and the simulation
smoother are described. Missing observations, forecasting and initialisation
are considered. A representation of a multivariate series as a univariate series
is displayed. The construction and maximisation of the likelihood function
are discussed. An application to real data is presented. The treatment is
extended to non-Gaussian and nonlinear state space models. A simulation
technique based on importance sampling is described for analysing these
models. The use of antithetic variables in the simulation is considered.
Bayesian analysis of the models is developed based on an extension of the
importance sampling technique. Classical and Bayesian methods are applied
to a real time series.

State Space and Unobserved Component Models: Theory and Applications, eds. Andrew
C. Harvey, Siem Jan Koopman and Neil Shephard. Published by Cambridge University
Press. 
C Cambridge University Press 2004

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

4 James Durbin

1.1 Introduction to state space models


1.1.1 Basic ideas
The organisers have asked me to provide a broad, general introduction to
state space time series analysis. In the pursuit of this objective I will try
to make the exposition understandable for those who have relatively little
prior knowledge of the subject, while at the same time including some results
of recent research. My starting point is the claim that state space models
provide an effective basis for practical time series analysis in a wide range
of fields including statistics, econometrics and engineering.
I will base my exposition on the recent book by Durbin and Koopman
(2001), referred to from now on as the DK book, which provides a compre-
hensive treatment of the subject. Readers may wish to refer to the website
http://www.ssfpack.com/dkbook/ for further information about the book.
Other books that provide treatments of state space models and techniques
include Harvey (1989), West and Harrison (1997), Kitagawa and Gersch
(1996) and Kim and Nelson (1999). More general books on time series
analysis with substantial treatments of state space methods are, for example,
Brockwell and Davis (1987), Hamilton (1994) and Shumway and Stoffer
(2000).
I will begin with a particular example that I will use to introduce the
basic ideas that underlie state space time series analysis. This refers to
logged monthly numbers of car drivers who were killed or seriously injured
in road accidents in Great Britain, 1969–84. These data come from a study
by Andrew Harvey and me, undertaken on behalf of the British Department
of Transport, regarding the effect on road casualties of the seat belt law that
was introduced in February 1983; for details see Durbin and Harvey (1985)
and Harvey and Durbin (1986).
Inspection of Figure 1.1 reveals that the series is made up of a trend which
initially is increasing, then decreases and subsequently flattens out, plus a
seasonal effect which is high in the winter and low in the summer, together
with a sudden drop in early 1983 seemingly due to the introduction of the
seat belt law. Other features that could be present, though they are not
apparent from visual inspection, include cycles and regression effects due to
the influence of such factors as the price of petrol, weather variations and
traffic density. Thus we arrive at the following model:

yt = µt + γt + ct + rt + it + εt , (1.1)

where

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

Introduction to state space time series analysis 5

yt = observation (often logged, possibly a vector)


µt = trend (slow change in level)
γt = seasonal (pattern can change over time)
ct = cycle (of longer period than seasonal)
rt = regression component (coefficients can vary over time)
it = intervention effect (e.g. seat belt law)
εt = random error or disturbance or noise.

7.9
drivers
7.8

7.7

7.6
number (log)

7.5

7.4

7.3

7.2

7.1

70 75 80 85
year

Fig. 1.1. Monthly numbers (logged) of car drivers who were killed or seriously
injured in road accidents in Great Britain.

In the state space approach we construct submodels designed to model


the behaviour of each component such as trend, seasonal, etc. separately
and we put these submodels together to form a single matrix model called a
state space model . The model used by Harvey and Durbin for the analysis of
the data of Figure 1.1 included all the components of (1.1) except ct ; some
of the results of their analysis will be presented later.

1.1.2 Special cases of the basic model


We consider the following two special cases.

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

6 James Durbin

1.1.2.1 The local level model


This is specified by

yt = µt + εt , εt ∼ N (0, σε2 ),
(1.2)
µt+1 = µt + ηt , ηt ∼ N (0, ση2 ),

for t = 1, . . . , n, where the εt s and ηt s are all mutually independent and are
also independent of µ1 .
The objective of this model is to represent a series with no trend or sea-
sonal whose level µt is allowed to vary over time. The second equation of
the model is a random walk ; random walks are basic elements in many state
space time series models. Although it is simple, the local level model is not
an artificial model and it provides the basis for the treatment of important
series in practice. It is employed to explain the ideas underlying state space
time series analysis in an elementary way in Chapter 2 of the DK book.
The properties of time series that are generated by a local level model are
studied in detail in Harvey (1989).

1.1.2.2 The local linear trend model


This is specified by

yt = µt + εt , εt ∼ N (0, σε2 ),
µt+1 = µt + νt + ξt , ξt ∼ N (0, σξ2 ), (1.3)
νt+1 = νt + ζt , ζt ∼ N (0, σζ2 ).

This extends the local level model to the case where there is a trend with a
slope νt where both level and slope are allowed to vary over time. It is worth
noting that when both ξt and ζt are zero, the model reduces to the classical
linear trend plus noise model, yt = α + βt + error. It is sometimes useful to
smooth the trend by putting ξt = 0 in (1.3). Details of the model and its
extensions to the general class of structural time series models are given in
the DK book Section 3.2 and in Harvey (1989).
The matrix form of the local linear trend model is
 
  µt
yt = 1 0 + εt ,
νt
      
µt+1 1 1 µt ξt
= + .
νt+1 0 1 νt ζt

By considering this and other special cases in matrix form we are led to the
following general model which provides the basis for much of our further
treatment of state space models.

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

Introduction to state space time series analysis 7

1.1.3 The linear Gaussian state space model


This has the form
yt = Zt αt + εt , εt ∼ N (0, Ht ),
αt+1 = Tt αt + Rt ηt , ηt ∼ N (0, Qt ), t = 1, . . . , n, (1.4)
α1 ∼ N (a1 , P1 ).

Matrices Zt , Ht , Tt , Rt and Qt are assumed known. Initially, a1 and P1 are


assumed known; we will consider later what to do when some elements of
them are unknown. The p × 1 vector yt is the observation. The unobserved
m×1 vector αt is called the state. The disturbances εt and ηt are independent
sequences of independent normal vectors. The matrix Rt , when it is not
the identity, is usually a selection matrix, that is, a matrix whose columns
are a subset of the columns of the identity matrix; it is needed when the
dimensionality of αt is greater than that of the disturbance vector ηt . The
first equation is called the observation equation and the second equation is
called the state equation.
The structure of model (1.4) is a natural one for representing the be-
haviour of many time series as a first approximation. The first equation is
a standard multivariate linear regression model whose coefficient vector αt
varies over time; the development over time of αt is determined by the first-
order vector autoregression given in the second equation. The Markovian
nature of the model accounts for many of its elegant properties.
In spite of the conceptual simplicity of this model it is highly flexible and
has a remarkably wide range of applications to problems in practical time
series analysis. I will mention just a few.

(i) Structural time series models. These are models of the basic form (1.1)
where the submodels for the components are chosen to be compatible
with the state space form (1.4). The local level model and the local
linear trend model are simple special cases. The models are sometimes
called dynamic linear models .
(ii) ARMA and Box–Jenkins (BJ) ARIMA models. These can be put in
state space form as described in the DK book, Section 3.3. This means
that ARIMA models can be treated as special cases of state space mod-
els. I will make a few remarks at this point on the relative merits of
the BJ approach and the state space approach for practical time series
analysis.

(a) BJ is a ‘black box’ approach in which the model is determined


purely by the data without regard to the structure underlying the

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

8 James Durbin

data, whereas state space fits the data to the structure of the
system which generated the data.
(b) BJ eliminates trend and seasonal by differencing. However, in
many cases these components have intrinsic interest and in state
space they can be estimated directly. While in BJ estimates can be
‘recovered’ from the differenced series by maximising the residual
mean square, this seems an artificial procedure.
(c) The BJ identification procedure need not lead to a unique model;
in some cases several apparently quite different models can appear
to fit the data equally well.
(d) In BJ it is difficult to handle regression effects, missing observa-
tions, calendar effects, multivariate observations and changes in
coefficients over time; these are all straightforward in state space.
A fuller discussion of the relative merits of state space and BJ is given
in the DK book, Section 3.5. The comparison is strongly in favour of
state space.
(iii) Model (1.4) handles time-varying regression and regression with auto-
correlated errors straightforwardly.
(iv) State space models can deal with problems in spline smoothing in
discrete and continuos time on a proper modelling basis in which pa-
rameters can be estimated by standard methods, as compared with
customary ad hoc methods.

1.2 Basic theory for state space analysis


1.2.1 Introduction
In this section we consider the main elements of the methodology required
for time series analysis based on the linear Gaussian model (1.4). Let Yt =
{y1 , . . . , yt }, t = 1, . . . , n. We will focus on the following items:

• Kalman filter. This recursively computes at+1 = E(αt+1 |Yt ) and Pt+1 =
V ar(αt+1|Yt ) for t = 1, . . . , n. Since distributions are normal, these quan-
tities specify the distribution of αt+1 given data up to time t.
• State smoother. This estimates α̂t = E(αt | Yn ) and Vt = Var(αt | Yn )
and hence the conditional distribution of αt given all the observations for
t = 1, . . . , n.
• Simulation smoother. An algorithm for generating draws from

p(α1 , . . . , αn |Yn ).

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

Introduction to state space time series analysis 9

This is an essential element in the analysis of non-Gaussian and nonlinear


models as described in Section 1.4.
• Missing observations. We show that the treatment of missing observations
is particularly simple in the state space approach.
• Forecasting is simply treated as a special case of missing observations.
• Initialisation. This deals with the case where some elements of a1 = E(α1 )
and V1 = Var(α1 ) are unknown.
• Univariate treatment of multivariate series. This puts a multivariate model
into univariate form, which can simplify substantially the treatment of
large complex models.
• Parameter estimation. We show that the likelihood function is easily con-
structed using the Kalman filter.

1.2.2 Kalman filter


We calculate

at+1 = E(αt+1|Yt ), Pt+1 = V ar(αt+1|Yt ),

by the recursion
vt = yt − Zt at ,
Ft = Zt Pt Zt + Ht ,
Kt = Tt Pt Zt Ft−1 ,
(1.5)
Lt = Tt − Kt Zt ,
at+1 = Tt at + Kt vt ,
Pt+1 = Tt Pt Lt + Rt Qt Rt t = 1, . . . , n,
with a1 and P1 as the mean vector and the variance matrix of α1 .

1.2.3 State smoother


We calculate

α̂t = E(αt | Yn ), Vt = V ar(αt | Yn ),

by the backwards recursion


rt−1 = Zt Ft−1 vt + Lt rt ,
Nt−1 = Zt Ft−1 Zt + Lt Nt Lt ,
(1.6)
α̂t = at + Pt rt−1 ,
Vt = Pt − Pt Nt−1 Pt t = n, . . . , 1,

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

10 James Durbin

with rn = 0 and Nn = 0. The recursive nature of formulae (1.5) and (1.6),


which arises from the Markovian nature of model (1.4), implies that calcu-
lations based on them are very fast on modern computers.
The proofs of these and many related results in state space theory can
be derived very simply by the use of the following elementary lemma in
multivariate normal regression theory. Suppose that x, y and z are random
vectors of arbitrary orders that are jointly normally distributed with means
µp and covariance matrices

Σpq = E[(p − µp )(q − µq ) ]

for p, q = x, y and z with µz = 0 and Σyz = 0. The symbols x, y, z, p and q


are employed for convenience and their use here is unrelated to their use in
other parts of the paper.
Lemma

E(x|y, z) = E(x|y) + Σxz Σ−1


zz z,
Var(x|y, z) = Var(x|y) − Σxz Σ−1 
zz Σxz .

The proof of this familiar lemma can be obtained straightforwardly from


elementary multivariate normal regression theory; see, for example, the DK
book Section 2.13 for details. Proofs of the Kalman filter and smoother
are given in the DK book, Sections 4.2 and 4.3. The elementary nature of
this lemma drives home the point that the theoretical basis of state space
analysis is very simple.

1.2.4 Simulation smoothing


A simulation smoother in Gaussian state space time series analysis draws
samples from the Gaussian conditional distribution of state or disturbance
vectors given the observations. This has proved important in practice for
the analysis of non-Gaussian models and for carrying out Bayesian infer-
ence. Recently a new technique for implementing this has been proposed
by Durbin and Koopman 2002 which is both simple and computationally
efficient and which we now describe.
The construction of a simulation smoother for the state vector αt is
relatively simple given the lemma in Section 1.2.3. Since the state space
model (1.4) is linear and Gaussian, the density p(α1 , . . . , αn |Yn ) is multi-
variate normal. Its variance matrix has the important property that it does
not depend upon Yn ; this follows immediately from the general result that
in a multivariate normal distribution the conditional variance matrix of a

© Cambridge University Press www.cambridge.org


Cambridge University Press
052183595X - State Space and Unobserved Component Models: Theory and Applications - Edited by
Andrew Harvey, Siem Jan Koopman and Neil Shephard
Excerpt
More information

Introduction to state space time series analysis 11

vector given that a second vector is fixed does not depend on the second vec-
tor. These observations lead to a straightforward derivation of the following
algorithm for drawing random vectors α̃t from p(α|Yn ):
Step 1. Obtain random draws ε+ t and ηt from densities N (0, Ht ) and
+

N (0, Qt ), respectively, for t = 1, . . . , n. Generate αt+ and yt+ by


means of recursion (1.4) with εt , ηt replaced by ε+ t , ηt where the
+

recursion is initialised by the draw α1 ∼ N (a1 , P1 ).


+

Step 2. Compute α̂t = E(αt |Yn ) and α̂t+ = E(αt |Yn+ ) where
Yn+ = {y1+ , . . . , yn+ } by means of standard filtering and smoothing
using (1.5) forwards and (1.6) backwards.
Step 3. Take
α̃t = α̂t − α̂t+ + αt+ ,
for t = 1, . . . , n.
This algorithm for generating α̃t only requires standard Kalman filtering
and state smoothing applied to the constructed series y1+ , . . . , yn+ and is
therefore easy to incorporate in new software; special algorithms for simula-
tion smoothing such as the ones developed by Frühwirth-Schnatter (1994c),
Carter and Kohn (1994) and de Jong and Shephard (1995) are not required.
The algorithm and similar ones for the disturbances are intended to replace
those given in Section 4.7 of the DK book.

1.2.5 Missing observations


These are easy to handle in state space analysis. If observation yj is missing
for any j from 2 to n − 1, all we have to do is put vj = 0 and Kj = 0 in
equations (1.5) and (1.6). The proof is given in Section 4.8 of the DK book.

1.2.6 Forecasting
This also is very easy in state space analysis. Suppose we want to forecast
yn+1 , . . . , yn+k given y1 , . . . , yn and calculate mean square forecast errors.
We merely treat yn+1 , . . . , yn+k as missing observations and proceed using
(1.5) as in Section 1.2.5. We use
Zn+1 an+1 , . . . , Zn+k an+k
as the forecasts and use
Vn+1 , . . . , Vn+k
to provide mean square errors; for details see the DK book, Section 4.9.

© Cambridge University Press www.cambridge.org

You might also like