Hidden Markov Models: Ramon Van Handel
Hidden Markov Models: Ramon Van Handel
Hidden Markov Models: Ramon Van Handel
X
0
, . . . , X
k2
__
= E
_
f
0
(X
0
) f
k2
(X
k2
)
_
f
k1
(x
k1
) f
k
(x
k
) P(x
k1
, dx
k
) P(X
k2
, dx
k1
)
_
= E
_
f
0
(X
0
)
_
f
1
(x
1
) f
k
(x
k
) P(x
k1
, dx
k
) P(X
0
, dx
1
)
_
=
_
f
0
(x
0
) f
k
(x
k
) P(x
k1
, dx
k
) P(x
0
, dx
1
) (dx
0
).
The proof is complete. .
4 1 Hidden Markov Models
Let us introduce some common notation. For any bounded measurable
function f : E R, we dene the function Pf : E R by setting
Pf(x) =
_
f(z) P(x, dz), x E.
Note that for a Markov process (X
k
)
k0
with transition kernel P, we have
E(f(X
k+1
)[X
0
, . . . , X
k
) = Pf(X
k
).
Now dene recursively, for n 1, the functions P
n
f = PP
n1
f (P
0
f = f).
By repeated conditioning, it follows easily that
E(f(X
k+n
)[X
0
, . . . , X
k
) = E(E(f(X
k+n
)[X
0
, . . . , X
k+n1
)[X
0
, . . . , X
k
)
= E(Pf(X
k+n1
)[X
0
, . . . , X
k
)
= E(E(Pf(X
k+n1
)[X
0
, . . . , X
k+n2
)[X
0
, . . . , X
k
)
= E(P
2
f(X
k+n2
)[X
0
, . . . , X
k
) ( )
= E(P
n
f(X
k
)[X
0
, . . . , X
k
)
= P
n
f(X
k
).
Similarly, let be a measure on E. Dene the measure P on E as
P(A) =
_
P(x, A) (dx), A E,
and, for n 1, the measures P
n
= P
n1
P (P
0
= ). Then for a Markov
process (X
k
)
k0
with transition kernel P and initial measure , lemma 1.5
shows that P(X
k
A) = P
k
(A) for all A E, i.e., P
k
is the law of X
k
.
Finally, we will frequently use the following fact: for any function f
_
f(x) P(dx) =
_
Pf(x) (dx),
i.e., the maps P and f Pf are dual to each other.
1.2 Hidden Markov Models
In the broadest sense of the word, a hidden Markov model is a Markov process
that is split into two components: an observable component and an unobserv-
able or hidden component. That is, a hidden Markov model is a Markov
process (X
k
, Y
k
)
k0
on the state space E F, where we presume that we
have a means of observing Y
k
, but not X
k
. Adopting terminology from signal
processing, we will typically refer to the unobserved component X
k
as the
signal process and E as the signal state space, while the observed component
Y
k
is called the observation process and F is the observation state space.
1.2 Hidden Markov Models 5
Hidden Markov models appear in a wide variety of applications. To x
some ideas one might distinguish between two main classes of applications,
though many applications fall somewhere in between.
On the one hand, hidden Markov models naturally describe a setting where
a stochastic system is observed through noisy measurements. For example, in
communications theory, one might think of X
k
as a (random) signal to be
transmitted through a communications channel. As the channel is noisy, the
receiver observes a corrupted version Y
k
of the original signal, and he might
want to reconstruct as well as is possible the original signal from the noisy
observations. This is the origin of the signal/observation process terminology.
On the other hand, it may be the process Y
k
which is ultimately of interest,
while the X
k
represents the inuence on Y
k
of certain unobservable external
factors. For example, one might think of Y
k
as the market price of stock, where
X
k
is an unobserved economic factor process which inuences the uctuations
of the stock price. We are ultimately interested in modeling the observed stock
price uctuations, not in the unobservable factor process, but by including the
latter one might well be able to build a model which more faithfully reects
the statistical properties of the observed stock prices. It should be noted that
even though (X
k
, Y
k
)
k0
is Markov, typically the observed component (Y
k
)
k0
will not be Markov itself. Hidden Markov models can thus be used to model
non-Markov behavior (e.g., of the stock price), while retaining many of the
mathematical and computational advantages of the Markov setting.
This course is an introduction to some of the basic mathematical, statis-
tical and computational methods for hidden Markov models. To set the stage
for the rest of the course, we will describe in the next two sections a num-
ber of representative examples of hidden Markov models in applications taken
from a variety of elds, and we will introduce the basic questions that will be
tackled in the remainder of the course. Before we do this, however, we must
give a precise denition of the class of models which we will be considering.
Denition and elementary properties
The broadest notion of a hidden Markov model, as outlined above, is a little
too general to lead to a fruitful theory. Throughout this course, and in much
of the literature, the term hidden Markov model is used to denote a Markov
process (X
k
, Y
k
)
k0
with two essential restrictions:
the signal (X
k
)
k0
is itself a Markov process; and
the observation Y
k
is a noisy functional of X
k
only (in a sense to be made
precise shortly).
As we will see in the next section, there is a wide variety of applications that
t within this framework.
Denition 1.6. A stochastic process (X
k
, Y
k
)
k0
on the product state space
(EF, EF) is called a hidden Markov model if there exist transition kernels
P : E E [0, 1] and : E F [0, 1] such that
6 1 Hidden Markov Models
E(g(X
k+1
, Y
k+1
)[X
0
, Y
0
, . . . , X
k
, Y
k
) =
_
g(x, y) (x, dy) P(X
k
, dx),
and a probability measure on E such that
E(g(X
0
, Y
0
)) =
_
g(x, y) (x, dy) (dx),
for every bounded measurable function g : E F R. In this setting
is called the initial measure, P the transition kernel, and the observation
kernel of the hidden Markov model (X
k
, Y
k
)
k0
.
Comparing with denition 1.3, it is immediately clear that (X
k
, Y
k
)
k0
and (X
k
)
k0
are both (homogeneous) Markov processes. To illustrate the
structure of the observations (Y
k
)
k0
, we consider a canonical example.
Example 1.7. Let
k
, k 1 and
k
, k 0 be independent i.i.d. sequences of
real-valued random variables with laws and , respectively. Dene
X
0
= z,
Y
0
= h(X
0
,
0
),
X
k
= f(X
k1
,
k
),
Y
k
= h(X
k
,
k
)
(k 1),
where f : ER E and h : ER F are measurable functions and z E.
Then (X
k
, Y
k
)
k0
is a hidden Markov model with transition kernel
P(x, A) =
_
I
A
(f(x, z)) (dz),
observation kernel
(x, B) =
_
I
B
(h(x, z)) (dz),
and initial measure
z
. Indeed, as
k+1
is independent of X
0,...,k+1
and Y
0,...,k
,
E(g(X
k+1
, Y
k+1
)[X
0
, Y
0
, . . . , X
k
, Y
k
)
= E(g(X
k+1
, h(X
k+1
,
k+1
))[X
0
, Y
0
, . . . , X
k
, Y
k
)
= E(E(g(X
k+1
, h(X
k+1
,
k+1
))[X
0,...,k+1
, Y
0,...,k
)[X
0
, Y
0
, . . . , X
k
, Y
k
)
= E(E(g(x, h(x,
k+1
)))[
x=X
k+1
[X
0
, Y
0
, . . . , X
k
, Y
k
)
= E
__
g(X
k+1
, y) (X
k+1
, dy)
X
0
, Y
0
, . . . , X
k
, Y
k
_
=
_
g(x, y) (x, dy) P(X
k
, dx).
The corresponding expression for E(g(X
0
, Y
0
)) follows similarly.
In this example, it is immediately clear in which sense Y
k
is a noisy func-
tional of X
k
only: indeed, Y
k
is a function of X
k
and a noise variable
k
which
is independent of the noise corrupting the remaining observations Y
, ,= k.
If the observation (Y
k
)
k0
represents a signal (X
k
)
k0
transmitted through
a noisy communications channel, this basic property corresponds to the idea
that the communications channel is memoryless. A more formal expression of
the elementary properties of our hidden Markov models is given as follows.
1.2 Hidden Markov Models 7
Lemma 1.8. Let (X
k
, Y
k
)
k0
be a hidden Markov model on (E F, E F)
with transition kernel P, observation kernel , and initial measure . Then
1. (X
k
, Y
k
)
k0
is a Markov process;
2. (X
k
)
k0
is Markov with transition kernel P and initial measure ; and
3. Y
0
, . . . , Y
k
are conditionally independent given X
0
, . . . , X
k
:
P(Y
0
A
0
, . . . , Y
k
A
k
[X
0
, . . . , X
k
) = (X
0
, A
0
) (X
k
, A
k
).
Moreover, the nite dimensional distributions of (X
k
, Y
k
)
k0
are given by
E(f(X
0
, Y
0
, . . . , X
k
, Y
k
)) =
_
f(x
0
, y
0
, . . . , x
k
, y
k
)
(x
k
, dy
k
) P(x
k1
, dx
k
) (x
1
, dy
1
) P(x
0
, dx
1
) (x
0
, dy
0
) (dx
0
).
Proof. This can be read o directly from denition 1.6 and lemma 1.5. .
Nondegeneracy
In addition to the general requirements of denition 1.6, we will frequently
impose a stronger assumption on the structure of the observations (Y
k
)
k0
.
Denition 1.9. Let (X
k
, Y
k
)
k0
be a hidden Markov model on (EF, EF)
with observation kernel . The model is said to have nondegenerate observa-
tions if the observation kernel is of the form
(x, B) =
_
I
B
(z) (x, z) (dz), x E, B F,
where : E F ]0, [ is a strictly positive measurable function and is
a probability measure on F. The function is called the observation density.
Let us attempt to explain the relevance of this assumption. Much of this
course is concerned with problems where we try to infer something about
the unobserved process (X
k
)
k0
from observations of the observed process
(Y
k
)
k0
. We will therefore develop techniques which take as input an obser-
vation time series y
0
, . . . , y
k
and which output certain conclusions about the
unobserved process. We would like these techniques to be nondegenerate in
the sense that they can be applied even if the input time series y
0
, . . . , y
k
does
not precisely match the mathematical model that we have assumed. If this is
not the case, there would be little hope that such techniques could be applied
to real-world data. Without additional assumptions, however, the general def-
inition 1.6 can lead to models where inference becomes problematic. To make
this point, let us consider a particularly extreme example.
Example 1.10. Let E = F = R. Let
k
, k 0 be an i.i.d. sequence of random
variables whose law is supported on the integers Z, and let
k
, k 0 be
8 1 Hidden Markov Models
an i.i.d. sequence of random variables whose law is supported on the positive
integers N. We now dene (X
k
, Y
k
)
k0
recursively as
X
0
= Y
0
= 0, X
k
= X
k1
+
k
/
k
, Y
k
= X
k
(k 1).
This clearly denes a hidden Markov model in the sense of denition 1.6.
Now suppose that we observe a sequence of observations y
0
, . . . , y
k
that
are generated by this model. Then it must be the case that the dierences
y
n
y
n1
are rational numbers for every n, as this is true with probability
one by construction. However, if in practice the signal X
n
is perturbed by
even the slightest amount, then a real-world sample of the observation time
series y
0
, . . . , y
k
would no longer satisfy this property. An inference procedure
based on our hidden Markov model would be at a loss as to how to deal with
this observation sequenceafter all, according to our model, what we have
observed is technically impossible. We therefore run into trouble, as even the
smallest of modeling errors can give rise to observation time series for which
our inference techniques do not make mathematical sense.
This example is, of course, highly contrived. However, it highlights the fact
that applying denition 1.6 without further assumptions can lead to models
which are problematic to deal with. Indeed, most of the techniques that we
will develop in the following chapters can not be applied to this model.
As it turns out, the nondegeneracy assumption eectively rules out this
problem. The reason is that when the observation kernel satises denition
1.9, any property of a nite number of observations Y
0
, . . . , Y
k
which holds
with unit probability must do so for every choice of transition kernel P and
initial measure (problem 1.4). As a consequence, if y
0
, . . . , y
k
is a valid
observation sample path for some model for the signal (X
k
)
k0
, then this
observed path is valid for any signal model. This does not mean, of course,
that our inference procedures will not be sensitive to (even small) modeling
errors; however, denition 1.9 guarantees enough nondegeneracy so that our
inference procedures will be at least mathematically well dened.
A typical example which does satisfy the nondegeneracy assumption is:
Example 1.11. Let F = R, and consider an observation model of the form
Y
k
= h(X
k
) +
k
(k 0),
where h : E R is measurable and
k
, k 0 are i.i.d. N(0, 1). Then
(x, B) =
_
I
B
(z)
e
(zh(x))
2
/2
2
dz,
which certainly satises the requirement of denition 1.9.
The above discussion was intended to provide some intuition for the nonde-
generacy assumption. Its mathematical consequences will be obvious, however,
when we start developing the basic theory in the following chapter.
1.3 Examples 9
On our assumptions
Throughout most of this course, we will develop techniques which apply to
hidden Markov models in the sense of denition 1.6 that satisfy the nonde-
generacy assumption of denition 1.9. That is not to say that models in which
some of our assumptions do not hold are not encountered in applications, nor
that such models are necessarily intractable. In many cases more general mod-
els can be treated, either by modifying the techniques which we will develop
here or through other methods that we will not cover.
Fortunately, our assumptions are general enough to cover a wide range
of applications, which can all be treated using a common set of techniques
to be developed in the following chapters. For conceptual, mathematical and
notational simplicity, and as one can only cover so much in one semester, we
will from now on stay within this framework without further apology.
1.3 Examples
To motivate our mathematical denitions, we will now describe briey some
sample applications taken from various elds. Note that
all examples are hidden Markov models in the sense of denition 1.6; and
all examples satisfy the nondegeneracy assumption of denition 1.9.
These examples are not the most sophisticated possible, but they show that
many interesting models t within our framework. As we progress throughout
the course, you may want to go back on occasion and think about how the
various techniques apply to the examples in this section.
Example 1.12 (Financial time series). The simplest model of nancial time
series S
k
, such as the market price of stock, is of the Black-Scholes form
S
k
= exp(
2
/2 +
k
) S
k1
,
where
k
N(0, 1) are i.i.d., R is the volatility, and R is the rate of
return (indeed, note that E(S
k
/S
k1
) = e
k
, k 0 be a sequence of i.i.d. random variables, and set
X
k
= (B
k
, W
k
), W
k
= f(W
k1
,
k
), Y
k
= W
k
B
k
+
k
.
A channel model of this type is called a fading channel.
Ultimately, the goal of the receiver is to infer the original message B
k
from
the noisy observations Y
k
. If we were to transmit a real-valued (analog) signal
S
k
through a noisy channel, instead of the digital signal B
k
, this becomes a
signal processing task of denoising the corrupted signal.
Example 1.16 (Target tracking). In various applications one is interested in
tracking a moving object using noisy sensor data. Consider an object that is
moving randomly in the plane: its two position components might evolve as
X
1
k
= X
1
k1
+
1
k
+
1
(U
k
), X
2
k
= X
2
k1
+
2
k
+
2
(U
k
),
where (U
k
) is the base velocity of the target (possibly controlled by some
external process U
k
), while
k
, k 1 are i.i.d. and correspond to random
velocity perturbations. By choosing U
k
to be, e.g., a nite state Markov pro-
cess, one can model a target which tries to confuse us by randomly switching
its velocity in dierent preset directions (think of tracking the position of a
ghter jet). The case = 0 could be used to model a large molecule which is
1.3 Examples 13
moving around diusively in a thin layer of liquid (single molecule tracking
for biological or polymer dynamics studies).
The noisy observations of the object to be tracked typically take the form
Y
k
= h(X
k
) +
k
,
where
k
, k 0 are i.i.d. and h is the observation function. The function h
can be quite nonlinear. For example, if we track the location of a jet from
a xed position on the ground, one might imagine a situation where we can
only observe the direction of the line of sight between the sensor and the jet,
and not the distance between the sensor and the jet. In this setting, called
bearings-only tracking, one would have h(X
1
k
, X
2
k
) = arctan(X
2
k
/X
1
k
). The
goal is then to track as well as possible the position of the object given any
prior knowledge of its position and the observed sensor data.
There are many variations on this problem in applications such as position-
ing, navigation, robotics, etc. The problem obtains an additional dimension if
we introduce control into the picture: e.g., the sensor might be itself mounted
on another jet plane, and we might want to develop a pursuit strategy so that
our trajectory intersects as closely as possible the trajectory of the other plane
at a xed time in the future. As our strategy can only depend on the observed
sensor data, it is not surprising that tracking plays an important role.
Example 1.17 (Speech recognition). One of the oldest applications of hidden
Markov models is automatic speech recognition. This approach turns out to be
extremely successful, and almost all modern speech recoginition systems are
based on hidden Markov model techniques. Let us briey discuss the simplest
type of speech recognition: the problem of isolated word recognition. In this
setting our goal is to determine, on the basis of an audio recording of a human
voice, which of a nite set of allowed words was spoken.
The basic idea is to use maximum likelihood estimation to solve this prob-
lem; in principle this has nothing to do with hidden Markov models. To ac-
count for the variability of human speech, the audio signal corresponding to
each word is modeled as a stochastic process. Denote by P
i
the law of the au-
dio signal Y
0
, . . . , Y
N
corresponding to the ith word, and let us suppose that P
i
is absolutely continuous with respect to some reference measure Q for every i.
Once we are given an actual recorded signal y
0
, . . . , y
N
, the most likely spoken
word is given by the maximum likelihood estimate argmax
i
dP
i
dQ
(y
1
, . . . , y
N
).
The problem is, of course, what model one should use for the laws P
i
. It
is here that hidden Markov models enter the picture. The audio signal of a
given word is represented as the observed component Y
k
of a hidden Markov
model. The unobserved component X
k
is a nite state Markov process, where
each state corresponds to a consecutive sound in the word of interest (e.g., for
the word quick one could choose E = k1, w, i, k2). The idea is that each
sound will give rise to an audio sequence with roughly i.i.d. spectral content,
but that the length of each sound within the word will vary from recording to
recording. Typically (Y
k
)
k0
does not represent the raw audio data (which is
14 1 Hidden Markov Models
highly oscillatory and not well suited for direct use); instead, the raw audio
is chopped into xed size frames ( 50 ms each), and each Y
k
represents the
dominant spectral components of the corresponding frame.
Speech recognition now proceeds as follows. First, the system is trained: a
speaker provides voice samples for each allowed word, and these are used to
estimate the transition and observation kernels P and for the corresponding
hidden Markov model. Once the training is complete, speech recognition can
be performed using the maximum likelihood approach. In all cases prepro-
cessing of the raw audio (feature analysis) is rst performed to extract the
spectral information that is modeled by the hidden Markov models.
1.4 What Is This Course About?
This is not a course about stochastic modeling; it is our purpose to develop in
the following chapters the basic mathematical and statistical techniques that
are fudamental to the theory of hidden Markov models. Before we embark on
this journey in earnest, let us give a brief overview of coming attractions. The
examples in the previous section will serve as motivation.
Estimation
Suppose that we have somehow managed to obtain a hidden Markov model
(i.e., the kernels P and are given). As only the observations (Y
k
)
k0
are
observable in the real world, an important problem is to develop techniques
which estimate the unobserved signal component (X
k
)
k0
on the basis of an
observed trajectory y
0
, y
1
, . . . of the observation process.
There are three elementary estimation problems. In the rst problem, we
observe a nite number of observations Y
0
, . . . , Y
N
, and we wish to estimate
the corresponding signal trajectory X
1
, . . . , X
N
. To this end, we will show
how to compute the conditional expectations
E(f(X
k
)[Y
0
, . . . , Y
N
), 0 k N,
for any function f. This is called the smoothing problem. For example, one
might apply this method to decode a (digital or analog) message transmitted
through a noisy communication channel, or to segment a DNA strand into
coding and non-coding regions on the basis of a given base pair sequence.
Still xing the observation sequence Y
0
, . . . , Y
N
, we sometimes wish to
estimate also the future evolution of the signal
E(f(X
k
)[Y
0
, . . . , Y
N
), k N.
This is known as the prediction problem. For example, one might try to apply
this technique to the pursuit problem, where we must decide what action to
1.4 What Is This Course About? 15
take presently on the basis of the available observations in order to intercept
a moving target at some predetermined future time.
The most common scenario is one where we wish to estimate the present
value of the signal, given all available observations to date. In other words, in
this case the observation sequence is not xed, but we obtain an new obser-
vation in every time step. The computation of the conditional expectations
E(f(X
k
)[Y
0
, . . . , Y
k
), k 0
is called the ltering problem. This is precisely what is of interest, e.g., in the
target tracking problem. In a sense, it turns out that the ltering problem
is particularly fundamental: its solution is a necessary step in many of the
techniques that we will discuss, including smoothing and prediction.
Our solutions of the ltering, smoothing and prediction problems will be
recursive in nature. In particular, the solution of the ltering problem is such
that the ltered estimates at time k + 1 can be computed from the ltered
estimates at time k and the new observation Y
k
only. This is of course a man-
ifestation of the Markov nature of our models, and is computationally very
convenient. In certain casesparticularly when the signal state space E is a
nite setthese recursions can be implemented directly as a computer algo-
rithm. In more complicated cases this will no longer be tractable; however,
we will develop an ecient and computationally tractable Monte Carlo algo-
rithm to approximate the conditional estimates, and we will prove theorems
that quantify the resulting approximation error.
Inference
In the above estimation problems, we presumed that the underlying hidden
Markov model is already known. However, in many applications it is initially
far from clear how to design the transition and observation kernels P and
and the initial measure . This is particularly true in applications such as
nancial time series models, DNA sequence segmentation and speech recog-
nition, where the design of a hidden Markov model for which the observation
process possesses the desired statistical properties is an important component
of the problem. It is therefore essential to develop statistical inference tech-
niques which allow us to design and calibrate our hidden Markov model to
match observed real-world data.
It should be noted that in this setting we may not have much, if any, a
priori knowledge of the structure of the unobserved process. In particular,
the unobserved process can typically not be observed in real life even for
modeling purposes. This distinguishes what we are trying to achieve from,
e.g., supervised learning problems, where estimators are constructed on the
basis of a training set in which both the observed and unobserved components
are available. In our setting, the only data on which inference may be based are
given time series of the observation process. (Of course, even if the structure
16 1 Hidden Markov Models
of the unobserved process is fairly well known, the calibration of parameter
values on the basis of observed time series is often of interest).
In statistical inference problems we will typically consider a parametrized
family of transition and observation kernels P
,
where the parameter takes values in some class of models . Our goal is
to select a suitable
X
n
=
p
k=1
a
k
X
nk
+
n
(n p)
with the initial condition
X
0
= =
X
p1
= 0, where a
k
are real-valued
coecients and
k
are i.i.d. random variables.
(a) An AR(p) process is not Markov. Show that it can nonetheless be rep-
resented as a Markov process by enlarging the state space. (Hint: prove that
the process X
n
= (
X
n
, . . . ,
X
n+p1
), n 0 is Markov.)
A dierent time series model, which is popular in econometric applications,
is the nonlinear ARCH(p) model dened as
X
n
= a
0
+
p
k=1
a
k
Z
2
nk
,
Z
n
=
_
X
n
n
(n p)
where a
k
are nonnegative constants and
k
are i.i.d. random variables.
(b) Repeat part (a) for the ARCH(p) model.
1.3. DNA Sequence Alignment I ([Kro98])
DNA sequences encode genetic information in four letters A, C, G, T. DNA
code is much more sloppy than human language, however, and the manner in
which the same feature is encoded in dierent species or individuals can vary
signicantly. For example, the following ve strings might encode the same
feature: ACAATG, AGAATC, ACACAGC, ACCGATC, TCAATGATC.
To exhibit their common pattern, let us align them (by hand) as follows:
l1 l2 l3 li li li l4 l5 l6
A C A A T G
A G A A T C
A C A C A G C
A C C G A T C
T C A A T G A T C
18 1 Hidden Markov Models
Evidently the base pattern ACAATC varies in two ways: individual pattern
symbols l1l6 may be mutated in a fraction of the instances, and arbitrary
extra symbols li may be inserted in the middle of the pattern.
(a) Model the above pattern as a hidden Markov model. Hint: as in speech
recognition, use F = A, C, G, T and E = l1, . . . , l6, li, le where le is
the terminal state P(l6, le) = P(le, le) = 1. You may assume that
(le, y) = 1/4 for all y F, i.e., the pattern is followed a random sequence
of symbols. Read o the remaining probabilities P(x, x
be two
transition kernels and let and
, transition kernel P
(Y ))
2
). As it turns out,
this is precisely the conditional expectation.
Lemma 2.1. Suppose that E(X
2
) < . Then g(Y ) = E(X[Y ) satises
g = argmin
g
E((X g
(Y ))
2
).
22 2 Filtering, Smoothing, Prediction
Proof. By construction E(X[Y ) is a function of Y , and E((XE(X[Y ))
2
)
2 E(X
2
) < . It remains to prove that for any other function g
(Y ) we have
E((X E(X[Y ))
2
) E((X g
(Y ))
2
).
Let us write G = E(X[Y ) and G
= g
(Y ). Note that
E((X G)
2
) = E((X G
+G
G)
2
)
= E((X G
)
2
) +E((G
G)
2
) + 2 E((X G
)(G
G))
= E((X G
)
2
) +E((G
G)
2
) + 2 E(E((X G
)(G
G)[Y ))
= E((X G
)
2
) E((G
G)
2
)
E((X G
)
2
).
The proof is complete. .
By computing the conditional expectation, we therefore nd the least mean
square estimate of the unobserved variable X given the observed variable Y .
However, what if we are interested in nding an estimator with a dierent
error criterion? For example, we might wish to minimize E([X g
(Y )[) or,
more generally, E(H(X g
,
where B
B satises P(Y B
(Y ))).
Proof. Note that by construction
_
H(x g(Y )) P
X|Y
(Y, dx)
_
H(x g
(Y )) P
X|Y
(Y, dx) a.s.
for any measurable function g
. Therefore
E(H(X g(Y ))) = E
__
H(x g(Y )) P
X|Y
(Y, dx)
_
E
__
H(x g
(Y )) P
X|Y
(Y, dx)
_
= E(H(X g
(Y ))).
Setting g
) I
C
(Y ) (x
, Y )
X
(dx
)
_
(x
, Y )
X
(dx
)
_
=
_
_
I
A
(x
) I
C
(y) (x
, y)
X
(dx
)
_
(x
, y)
X
(dx
)
(x, y)
X
(dx)
Y
(dy)
=
_
I
A
(x
) I
C
(y) (x
, y)
X
(dx
)
Y
(dy)
= E(I
A
(X) I
C
(Y )).
The proof is complete. .
2.2 Filtering, Smoothing, and Prediction Recursions
Throughout this section, let (X
k
, Y
k
)
k0
be a hidden Markov model with
signal state space (E, E), observation state space (F, F), transition kernel P,
observation kernel , and initial measure (denition 1.6). We also presume
that the observations are nondegenerate, i.e., that possesses an observation
density with respect to a reference measure (denition 1.9).
Our goal is to compute the conditional distributions
2.2 Filtering, Smoothing, and Prediction Recursions 25
k|n
= P
X
k
|Y
0
,...,Y
n
, k, n 0.
We distinguish between three cases. The goal of the ltering problem is to
compute
k|k
for k 0; for notational simplicity, we dene the ltering distri-
butions
k
=
k|k
. Similarly, the goal of the smoothing problem is to compute
the smoothing distributions
k|n
for k < n, while the goal of the prediction
problem is to compute prediction distributions
k|n
for k > n. As we will see,
a key feature of our computations is that they can be performed recursively.
Filtering
Using lemma 1.8, we easily nd the nite dimensional distributions
E(f(X
0
, Y
0
, . . . , X
k
, Y
k
)) =
_
f(x
0
, y
0
, . . . , x
k
, y
k
) (x
0
, y
0
) (x
k
, y
k
)
(dy
0
) (dy
k
) P(x
k1
, dx
k
) P(x
0
, dx
1
) (dx
0
)
of our hidden Markov model. To compute the ltering distributions, we will
combine this expression with the Bayes formula.
Denition 2.8. For every time k 0, the unnormalized ltering distribution
k
is the kernel
k
: F
k+1
E R
+
dened as
k
(y
0
, . . . , y
k
, A) =
_
I
A
(x
k
) (x
0
, y
0
) (x
k
, y
k
) P(x
k1
, dx
k
) P(x
0
, dx
1
) (dx
0
)
for all y
0
, . . . , y
k
F and A E.
Note that the kernel
k
is not necessarily a transition kernel, i.e., it is typi-
cally the case that
k
(y
0
, . . . , y
k
, E) ,= 1. However, its normalization coincides
precisely with the ltering distribution
k
.
Theorem 2.9 (Unnormalized ltering recursion). The ltering distri-
bution
k
can be computed as
k
(y
0
, . . . , y
k
, A) =
k
(y
0
, . . . , y
k
, A)
k
(y
0
, . . . , y
k
, E)
for every A E and y
0
, . . . , y
k
F. Moreover, the unnormalized ltering
distributions
k
can be computed recursively according to
k
(y
0
, . . . , y
k
, A) =
_
I
A
(x) (x, y
k
) P(x
, dx)
k1
(y
0
, . . . , y
k1
, dx
)
with the initial condition
0
(y
0
, A) =
_
I
A
(x) (x, y
0
) (dx).
26 2 Filtering, Smoothing, Prediction
Proof. Dene the probability measure
Y
on F
k+1
as the product measure
Y
(dy
0
, . . . , dy
k
) = (dy
0
) (dy
k
).
Similarly, we dene the probability measure
X
on E
k+1
as
X
(dx
0
, . . . , dx
k
) = P(x
k1
, dx
k
) P(x
0
, dx
1
) (dx
0
),
and we dene the function
(x
0
, . . . , x
k
, y
0
, . . . , y
k
) = (x
0
, y
0
) (x
k
, y
k
).
Then by the Bayes formula (theorem 2.7), we have
_
f(x
0
, . . . , x
k
) P
X
0
,...,X
k
|Y
0
,...,Y
k
(y
0
, . . . , y
k
, dx
0
, . . . , dx
k
) =
_
f(x
0
, . . . , x
k
) (x
0
, . . . , x
k
, y
0
, . . . , y
k
)
X
(dx
0
, . . . , dx
k
)
_
(x
0
, . . . , x
k
, y
0
, . . . , y
k
)
X
(dx
0
, . . . , dx
k
)
.
Therefore, the rst statement follows from the fact that
_
f(x)
k
(y
0
, . . . , y
k
, dx) =
_
f(x
k
) P
X
k
|Y
0
,...,Y
k
(y
0
, . . . , y
k
, dx
k
)
=
_
f(x
k
) P
X
0
,...,X
k
|Y
0
,...,Y
k
(y
0
, . . . , y
k
, dx
0
, . . . , dx
k
)
=
_
f(x
k
) (x
0
, . . . , x
k
, y
0
, . . . , y
k
)
X
(dx
0
, . . . , dx
k
)
_
(x
0
, . . . , x
k
, y
0
, . . . , y
k
)
X
(dx
0
, . . . , dx
k
)
=
_
f(x
k
)
k
(y
0
, . . . , y
k
, dx
k
)
_
k
(y
0
, . . . , y
k
, dx
k
)
.
The recursion for
k
is easily veried by inspection. .
Rather than computing
k
recursively, and subsequently normalizing to
obtain
k
, we may compute the ltering distributions
k
directly.
Corollary 2.10 (Filtering recursion). The ltering distributions
k
can be
computed recursively according to
k
(y
0
, . . . , y
k
, A) =
_
I
A
(x) (x, y
k
) P(x
, dx)
k1
(y
0
, . . . , y
k1
, dx
)
_
(x, y
k
) P(x
, dx)
k1
(y
0
, . . . , y
k1
, dx
)
with the initial condition
0
(y
0
, A) =
_
I
A
(x) (x, y
0
) (dx)
_
(x, y
0
) (dx)
.
Proof. This follows immediately from the previous theorem. .
The recursive nature of the ltering problem is computationally very con-
venient: to compute the ltered estimate
k
, we only need to know the ltered
estimate in the previous time step
k1
and the new observation y
k
obtained
in the present time step. In particular, we do not need to remember the entire
observation history y
0
, . . . , y
k1
as long as we are interested in the lter only.
2.2 Filtering, Smoothing, and Prediction Recursions 27
Smoothing
To nd the smoothing distributions
k|n
(k < n), we once again appeal to
the Bayes formula. We will see that the computation splits into two parts: the
observations Y
0
, . . . , Y
k
and Y
k+1
, . . . , Y
n
enter the problem in a dierent way.
Denition 2.11. For every 0 k < n, the unnormalized smoothing density
k|n
is the function
k|n
: E F
nk
]0, [ dened as
k|n
(x
k
, y
k+1
, . . . , y
n
) =
_
(x
k+1
, y
k+1
) (x
n
, y
n
) P(x
n1
, dx
n
) P(x
k
, dx
k+1
)
for all y
k+1
, . . . , y
n
F and x
k
E.
The Bayes formula allows us to prove the following.
Theorem 2.12 (Unnormalized smoothing recursion). The smoothing
distribution
k|n
(k < n) can be computed as
k|n
(y
0
, . . . , y
n
, A) =
_
I
A
(x)
k|n
(x, y
k+1
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx)
_
k|n
(x, y
k+1
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx)
for every A E and y
0
, . . . , y
n
F. Moreover, the unnormalized smoothing
densities
k|n
can be computed by the backward recursion
k|n
(x, y
k+1
, . . . , y
n
) =
_
k+1|n
(x
, y
k+2
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
with the terminal condition
n|n
= 1.
Proof. Using the same notation as in the proof of theorem 2.9
_
f(x)
k|n
(y
0
, . . . , y
n
, dx) =
_
f(x
k
) P
X
k
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx
k
)
=
_
f(x
k
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx
0
, . . . , dx
n
)
=
_
f(x
k
) (x
0
, . . . , x
n
, y
0
, . . . , y
n
)
X
(dx
0
, . . . , dx
n
)
_
(x
0
, . . . , x
n
, y
0
, . . . , y
n
)
X
(dx
0
, . . . , dx
n
)
=
_
f(x
k
)
k|n
(x
k
, y
k+1
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx
k
)
_
k|n
(x
k
, y
k+1
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx
k
)
.
The recursion for
k|n
is easily veried by inspection. .
As in the ltering problem, we can also obtain a normalized version of
the backward smoothing recursion. This is sometimes computationally more
conveninent. Note, however, that the ltering distributions appear in the nor-
malized smoothing recursion: in order to use it, we must rst make a forward
(in time) pass through the observation data to compute the ltering distribu-
tions, and then a backward pass to compute the smoothing densities. This is
sometimes called the forward-backward algorithm.
28 2 Filtering, Smoothing, Prediction
Corollary 2.13 (Smoothing recursion). Dene for k < n the function
k|n
: E F
n+1
]0, [ through the backward recursion
k|n
(x, y
0
, . . . , y
n
) =
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
_
(x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx)
with terminal condition
n|n
= 1. Then for any k < n
k|n
(y
0
, . . . , y
n
, A) =
_
I
A
(x)
k|n
(x, y
0
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx)
for every A E and y
0
, . . . , y
n
F.
Proof. From the unnormalized smoothing recursion, we can read o that
k|n
(x, y
0
, . . . , y
n
) =
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx)
with
n|n
= 1. It therefore suces to prove that for k < n
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx) =
_
(x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx).
But using the normalized ltering recursion (corollary 2.10), we nd
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx)
_
(x
, y
k+1
) P(x, dx
)
k
(y
0
, . . . , y
k
, dx)
=
_
k+1|n
(x
, y
0
, . . . , y
n
)
k+1
(y
0
, . . . , y
k+1
, dx
) = 1
by construction. This completes the proof. .
Prediction
Prediction, i.e., the computation of
k|n
for k > n, is the simplest of our
estimation problems. The following theorem can be proved using the Bayes
formula, but a direct proof is simple and illuminating.
Theorem 2.14 (Prediction recursion). The prediction distribution
k|n
(k > n) can be computed recursively as
k|n
(y
0
, . . . , y
n
, A) =
_
I
A
(x) P(x
, dx)
k1|n
(y
0
, . . . , y
n
, dx
)
for every A E and y
0
, . . . , y
n
F, with the initial condition
n|n
=
n
.
2.3 Implementation 29
Proof. By the tower property of the conditional expectation, we have
E(f(X
k
)[Y
0
, . . . , Y
n
) = E(E(f(X
k
)[X
0
, Y
0
, . . . , X
n
, Y
n
)[Y
0
, . . . , Y
n
)
for k > n. But using the Markov property of the signal, we have
E(f(X
k
)[X
0
, Y
0
, . . . , X
n
, Y
n
) = P
kn
f(X
n
).
Therefore E(f(X
k
)[Y
0
, . . . , Y
n
) = E(P
kn
f(X
n
)[Y
0
, . . . , Y
n
) or, equivalently,
_
f(x)
k|n
(y
0
, . . . , y
n
, dx) =
_
P
kn
f(x)
n
(y
0
, . . . , y
n
, dx).
for every bounded measurable function f. The recursion for
k|n
can now be
read o directly from this expression. .
We now make a simple observation: by corollary 2.10, the lter
k+1
can
be naturally expressed in terms of the one step predictor
k+1|k
:
k+1
(y
0
, . . . , y
k+1
, A) =
_
I
A
(x) (x, y
k+1
)
k+1|k
(y
0
, . . . , y
k
, dx)
_
(x, y
k+1
)
k+1|k
(y
0
, . . . , y
k
, dx)
.
The lter recursion is therefore frequently interpreted as a two step procedure:
k
prediction
k+1|k
correction
k+1
.
We will see this idea again in the chapter 4.
2.3 Implementation
In principle, the ltering, smoothing and prediction recursions obtained in the
previous section provide a complete solution to these problems. However, in
practice, these results may not be of immediate use. Indeed, these are recur-
sions for probability measures and functions on the signal state space E: such
objects are typically innite dimensional, in which case one can not in general
perform these computations on a computer without further approximation.
The question then becomes how to apply these mathematical techniques, ei-
ther exactly or approximately, to real-world problems.
Considering rst the problem of approximate implementation, one might
try the standard numerical technique of approximating continuous objects by
their values on a discrete grid. Though this approach is sometimes success-
ful in low dimensional problems, it suers from the same problem that was
famously formulated by Bellman many decades ago: the curse of dimensional-
ity. The problem is that in the signal state space E = R
p
, the computational
complexity of a grid method that achieves a xed approximation error is typ-
ically of order e
p
for some > 0, i.e., the computational complexity of the
30 2 Filtering, Smoothing, Prediction
algorithm grows very rapidly with the state space dimension. Such techniques
are therefore typically intractable in dimensions higher than p = 2 or 3. A
more detailed analysis of this phenomenon can be found in remark 4.6. To
mitigate the problem, we will develop in chapter 4 an approximate ltering
algorithm which uses random sampling rather than gridding to discretize the
problem. This technique is exible and easily implemented, and it manages
to avoid many (but not all) the problems of grid based algorithms.
Particularly in complex models, approximate implementation of the lter
is the best one can hope for. However, there are two cases where the recursions
obtained in this chapter can be implemented exactly.
The rst is the case where the signal state space is a nite set, say E =
1, . . . , n, so that measures and functions on E can be represented as n-
dimensional vectors (problem 1.1). This means that the recursions obtained
in this chapter can be expressed in terms matrix multiplication, which is
easily implemented exactly as a computer algorithm. Though this setting is
a special case of our general theory, it plays a particularly important role in
applications: on the one hand there are may applications which can reasonably
be modeled on a nite signal state space (see, e.g., the examples in section
1.3); on the other hand, the estimation theory for this class of models can
be implemented exactly as a computer algorithm, which leads to tractable
and powerful techniques that can be applied successfully to real data. We
will develop this special setting in detail in chapter 3, including several new
techniques that are of specic interest in a nite state space.
The other special case where exact computation is possible is the class of
linear Gaussian state space models where E = R
p
, F = R
q
, and
X
k
= a +AX
k1
+B
k
, Y
k
= c +CX
k
+D
k
.
We must assume, moreover, that
k
, k 1 are i.i.d. N(0, Id
p
),
k
, k 0 are
i.i.d. N(0, Id
q
), and X
0
N(
0
, P
0
). As the signal state space is continu-
ous, the ltering, smoothing and prediction recursions will in fact be innite
dimensional. However, what happens in this special case is that as all the
noise is Gaussian and all the operations are linear, every conditional distribu-
tion in this model is also Gaussian (problem 2.5). But the family of Gaussian
distributions on R
p
is a nite dimensional subset of the space of all prob-
ability measures on R
p
: a Gaussian distribution is completely characterized
by its mean vector and covariance matrix. Therefore the ltering, smoothing
and prediction recursions are really nite dimensional recursions in disguise,
which can again be implemented eciently as a computer algorithm. For the
ltering problem, this leads to the famous Kalman lter.
Linear Gaussian models are ubiquitous in the engineering literature, at
least partly due to their tractability. They exhibit rather special structure
and properties, however, and the techniques which are introduced for general
hidden Markov models are not always the best or most natural methods to deal
with linear systems (this is in contrast to the theory for nite state models,
which bears much resemblance to the general theory of hidden Markov models
2.3 Implementation 31
and provides a host of excellent examples for the latter). For this reason,
though they will make an occasional appearance, we will not spend much
time on linear systems in this course. Of course, many of the techniques which
will be discussed in this course can be applied to linear systems; for example,
problem 2.5 below asks you to derive the Kalman ltering recursion from the
general theory in the previous section. For a thorough introduction to linear
estimation theory we refer, however, to the textbook [KSH00].
Remark 2.15. In the linear Gaussian case, what evidently happens is that the
innite dimensional recursions have nite dimensional invariant sets, so that
the recursion can be represented in nite dimensional form. One might won-
der whether there are other ltering models which have this highly desirable
property. Unfortunately, it turns out that linear Gaussian models are rather
special in this regard: typically nite dimensional invariant sets do not exist
[Saw81]. Though one can construct examples of nonlinear ltering problems
which have a nite-dimensional realization, these are almost always ad-hoc
and appear rarely if ever in applications. In nonlinear continuous models,
exact computations are therefore essentially always hopeless.
However, if the nonlinear model is linear to good approximation, then
applying techniques for linear systems can be successful in practice. A common
ad-hoc approach in engineering is to linearize nonlinear dynamics so that the
Kalman lter can be applied locally; this is known as the extended Kalman
lter. Unfortunately, the performance of this method is often poor, and it is
very dicult to prove anything about it (but see [Pic91]). In any case, as we
are interested in general hidden Markov models, such methods are out of place
in this course and we will not go any further in this direction.
Problems
2.1. Best Linear Estimate
Let X, Y be real-valued random variables with nite mean and variance. Recall
that the conditional expectation E(X[Y ) is the optimal least squares estimate.
(a) Suppose that are are only interested in linear estimates, i.e., we seek an
estimate of X of the form
X = aY + b for some (non-random) constants
a, b R. Assume that Y has nonzero variance var(Y ) > 0. Show that
X = E(X) +
cov(X, Y )
var(Y )
(Y E(Y ))
minimizes E((X
X)
2
) over the class of all linear estimates.
X is called the
best linear estimate of X given Y .
(b) Provide an example where E((X E(X[Y ))
2
) < E((X
X)
2
). Evidently
nonlinear estimates do indeed (typically) perform better than linear estimates.
32 2 Filtering, Smoothing, Prediction
2.2. Prove that the quantity
_
k|n
(x, y
k+1
, . . . , y
n
)
k
(y
0
, . . . , y
k
, dx),
which appears in the denominator of the expression in theorem 2.12, does not
depend on k (and therefore equals
n
(y
0
, . . . , y
n
, E)).
2.3. Delayed Observations
Suppose that the observations Y
k
are dened with one time step delay: Y
0
= 0
and Y
k
= H(X
k1
,
k
) for k 1. The resulting model is strictly speaking not
a hidden Markov model in the sense of chapter 1 (where Y
k
= H(X
k
,
k
)),
but the resulting theory is almost identical. Modify the ltering, smoothing
and prediction recursions developed in this chapter to this setting.
2.4. Path Estimation
In this problem, we investigate the conditional distribution P
X
0
,...,X
n
|Y
0
,...,Y
n
of the entire signal path X
0
, . . . , X
n
given the observations Y
0
, . . . , Y
n
.
(a) Show that the signal (X
k
)
0kn
is a nonhomogeneous Markov process
under the conditional distribution P
X
0
,...,X
n
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, ).
(b) The initial measure is obviously
0|n
. Give an explicit expression for the
transition kernels of this nonhomogeneous Markov process using theorem 2.12.
2.5. Linear Gaussian Models
If the signal state space E is not nite, the ltering recursion can typically
not be computed in a nite dimensional form. One of the very few exceptions
is the linear Gaussian case. In this setting E = R
p
, F = R
q
, and
X
k
= a +AX
k1
+B
k
, Y
k
= c +CX
k
+D
k
,
where A and B are pp matrices, C is a q p matrix, D is a q q matrix, and
a R
p
, c R
q
. Moreover, we assume that
k
, k 1 are i.i.d. N(0, Id
p
), that
k
, k 0 are i.i.d. N(0, Id
q
), and that X
0
N(
0
, P
0
). In order to ensure the
nondegeneracy assumption, we will assume that D is invertible.
(a) Show that the conditional distributions
n|k
are Gaussian for every n, k.
(b) Denote by
X
k
and
P
k
the mean vector and covariance matrix of the
lter conditional distribution
k
. Find a recursion for (
X
k
,
P
k
) in terms of
(
X
k1
,
P
k1
) and Y
k
using the general ltering recursion in theorem 2.9. You
may use the following matrix identity (assuming all inverses exist):
(
1
+C
(DD
)
1
C)
1
= C
(DD
+CC
)
1
C.
The recursion for (
X
k
,
P
k
) is called the Kalman lter.
(c) Find prediction and smoothing counterparts of the recursion in part (b).
2.3 Implementation 33
Notes
The contents of this chapter are very well known. The ltering, smoothing
and prediction problems have their origin in the work of Wiener, who was in-
terested in stationary processes. In the more general setting of hidden Markov
models, many of these ideas date back to the seminal work of Stratonovich,
Kalman, Shiryaev, Baum, Petrie and others in the early 1960s.
When the signal state space is not nite and the hidden Markov model
is not of the linear-Gaussian type, the ltering, smoothing and prediction
recursions developed in this chapter can typically only be implemented in
an approximate sense. Many such approximation have been suggested in the
literature. One of the most succesful approximation methods, the Monte Carlo
interacting particle lters, is discussed in chapter 4. What follows is a (highly
incomplete) list of references to various other methods.
Extended Kalman lters are based on local linearization of the hidden
Markov model, after which the Kalman lter is applied; there are also
other variations on this theme. See, e.g., [Jaz70, BLK01].
Truncated lters: in certain problems the exact lter is a mixture of a nite
number of simple distributions, but the number of distributions in the
mixture increases in every time step. In this case, the exact lter may be
approximated by culling the least likely elements of the mixture in every
time step to obtain a mixture of xed size. See [BBS88, BLK01, GC03].
Projection lters: here the exact ltering algorithm is constrained to re-
main in a xed parametric family of distributions by projecting the lter
dynamics. See [BHL99, BP03].
Markov chain approximation: here a nite grid is xed in the signal state
space, and the true signal process is approximated by a nite state Markov
chain on this grid. The exact lter is then approximated by the lter
corresponding to this nite state Markov chain. See [KD01]. How to choose
a good grid is an interesting problem in itself; see [PP05].
Basis function expansions: here the lter distribution is expanded in a
suitable basis, and the number of basis elements is truncated in each time
step. See, e.g., [Jaz70, LMR97].
Small noise approximations: when the signal to noise ratio of the observa-
tions is very high, certain simple algorithms can be shown to be approxi-
mately optimal. See [Pic86] (and [Pic91] for related results).
Note that some of these papers deal with the continuous time setting.
Though the Kalman lter falls within our framework, the theory of linear
estimation has a lot of special structure and is best studied as a separate topic.
As a starting point, see the textbook by Kailath, Sayed and Hassibi [KSH00].
3
Finite State Space
3.1 Finite State Filtering, Smoothing, Prediction
In the previous chapter we worked out the ltering, smoothing and prediction
recursions for a general hidden Markov model. In this chapter we will specialize
and extend these results to an important special case: the setting where the
signal state space E is a nite set. On the one hand, such models appear in
many applications and therefore merit some additional attention; on the other
hand, this setting is particularly convenient as the techniques developed in the
previous chapter are computationally tractable without approximation.
Throughout this chapter, we consider a hidden Markov model (X
k
, Y
k
)
k0
on the state space E F, where the signal state space E is a nite set of
cardinality d < . Without loss of generality, we will label the elements of
E as E = 1, . . . , d. The transition kernel, observation kernel and initial
measure are denoted P, , and , as usual. We also presume that the obser-
vations are nondegenerate, i.e., that possesses a positive observation density
: E F ]0, [ with respect to a reference probability measure on F.
In the nite state setting, it is convenient to think of functions and mea-
sures as vectors and of kernels as matrices (recall problem 1.1). To see this,
note that a function f : E R is completely determined by the vector
f = (f(1), . . . , f(d))
R
d
(v
, M
R
d
: indeed,
_
f(x) (dx) =
d
i=1
f(i) (i) =
f = f
for any f : E R.
The transition kernel P is naturally represented by a matrix P with matrix
elements P
ij
= P(i, j). To see this, note that
Pf(i) =
d
j=1
P(i, j) f(j) = (Pf)
i
,
36 3 Finite State Space
while
P(j) =
d
i=1
(i) P(i, j) = (
P)
j
= (P
)
j
.
Finally, we will represent the observation density as follows: for every y F,
we dene the diagonal matrix (y) with nonzero elements ((y))
ii
= (i, y).
The convenience of this denition will become evident presently.
With our new vector-matrix notation in hand, we can proceed to reformu-
late the results of the previous chapter. Note that we are doing nothing other
than rewriting these results in a new notation: nonetheless, the vector-matrix
notation leads immediately to a computational algorithm.
Remark 3.1. In the following, we will x an observation sequence (y
k
)
k0
;
we can therefore drop the dependence of
k
,
k|n
, etc., on the observation
sequence, which will considerably simplify our notation. For example: rather
than writing
k
(y
0
, . . . , y
k
, dx), we will simply write
k
(dx).
Let us begin by reformulating the unnormalized ltering recursion. As
with any measure, we can represent the unnormalized lter by a vector
k
=
(
k
(1), . . . ,
k
(d))
0
= (y
0
),
k
= (y
k
)P
k1
(k 1).
Denote by 1 R
d
the vector of ones (1, . . . , 1)
k
. However, by corollary 2.10, the normalized
lter can also be computed directly through the normalized recursion
0
=
(y
0
)
1
(y
0
)
,
k
=
(y
k
)P
k1
1
(y
k
)P
k1
(k 1).
Let us now turn to the smoothing problem. Dropping again the dependence
on the observations, the unnormalized smoothing densities
k|n
can be repre-
sented as vectors
k|n
= (
k|n
(1), . . . ,
k|n
(d))
. By theorem 2.12,
n|n
= 1,
k|n
= P(y
k+1
)
k+1|n
(k < n).
The smoothing distributions can then be computed in various ways:
k|n
=
diag(
k|n
)
k
k|n
k
=
diag(
k|n
)
k
k|n
k
=
diag(
k|n
)
k
1
n
,
where the second equality is trivial and the third equality follows from prob-
lem 2.2. On the other hand, we may also compute the normalized smoothing
densities
k|n
, represented as vectors
k|n
, as
n|n
= 1,
k|n
=
P(y
k+1
)
k+1|n
1
(y
k+1
)P
k
(k < n),
3.2 Transition Counting and Occupation Times 37
Algorithm 3.1: Forward-Backward Algorithm
0
(y
0
)/1
(y
0
);
for k=1,. . . ,n do
k
(y
k
)P
k1
;
c
k
1
k
;
k
k
/c
k
;
end
n|n
1;
for k=1,. . . ,n do
nk|n
P(y
nk+1
)
nk+1|n
/c
nk+1
;
nk|n
diag(
nk|n
)
nk
;
end
in which case we simply obtain
k|n
= diag(
k|n
)
k
. Finally, the vector form
of the prediction recursion follows immediately from theorem 2.14:
n|n
=
n
,
k+1|n
= P
k|n
(k n).
Each of these recursions can be implemented eciently on a computer. For
example, an ecient way to compute the ltering and smoothing distributions
is the forward-backward algorithm 3.1 which makes two passes through the
observation data: a forward pass to compute the ltering distributions, and a
backward pass to compute the smoothing densities.
We have obtained various forms of the ltering and smoothing recursions
both normalized and unnormalized. Which form should we use? For computa-
tional purposes, the normalized recursions are typically preferable. The reason
is that in the unnormalized recursions, the normalization has the tendency to
grow or shrink very rapidly in time. This will get us into big trouble when,
sometimes after only a few time steps, the elements of the unnormalized l-
tering/smoothing quantities come close to or exceed machine precision. The
normalized recursions keep the various computed quantities in a reasonable
range, so that this problem is generally avoided.
3.2 Transition Counting and Occupation Times
In this section we are going to discuss some new estimation problems in the
the nite state setting. The rst problem is that of estimating the occupation
time of each state i = 1, . . . , d, i.e., we wish to estimate the number of times
that the signal was in the state i before time n:
i
n
(Y
0
, . . . , Y
n
) = E(# < n : X
= i[Y
0
, . . . , Y
n
).
The second problem that we will consider is estimation of the transition count
between each pair of states (i, j), i.e., we wish to estimate the number of times
that the signal jumped from state i to state j before time n:
38 3 Finite State Space
ij
n
(Y
0
, . . . , Y
n
) = E(# < n : X
= i and X
+1
= j[Y
0
, . . . , Y
n
).
Though one could come up with similar problems in more general hidden
Markov models, these problems are particularly natural in the nite state set-
ting; solving them is good practice in working with the theory of the previous
chapter. More importantly, however, it turns out that these two quantities
are of central importance in the statistical inference problem of learning the
transition probabilities P from training data, as we will see in chapter 6. We
had therefore better make sure that we are able to compute them.
Forward-Backward approach
Let us begin by considering the expected occupations times
i
n
. To compute
this quantity, let us express the occupation time of state i as follows:
# < n : X
= i =
n1
=0
I
i
(X
).
By the linearity of the conditional expectation, we obtain
i
n
(Y
0
, . . . , Y
n
) =
n1
=0
P(X
= i[Y
0
, . . . , Y
n
) =
n1
=0
|n
(Y
0
, . . . , Y
n
, i).
To compute this quantity, we can therefore simply apply the forward-backward
algorithm 3.1 of the previous section: once
k|n
have been computed for k =
0, . . . , n 1, we obtain directly
i
n
= (
0|n
+ +
n1|n
)
i
.
The expected transition counts
ij
n
are a little more involved. We begin,
in analogy with our approach to the occupation times, by noting that
# < n : X
= i and X
+1
= j =
n1
=0
I
i
(X
)I
j
(X
+1
).
We therefore nd that
ij
n
(Y
0
, . . . , Y
n
) =
n1
=0
P(X
= i and X
+1
= j[Y
0
, . . . , Y
n
).
In order to compute this quantity, we need to nd a way to compute the
bivariate smoothing distributions
,+1|n
= P
X
,X
+1
|Y
0
,...,Y
n
.
Theorem 3.2 (Bivariate smoothing recursion). The bivariate smoothing
distributions
,+1|n
( n 1) can be computed as
,+1|n
(AB) =
_
I
A
(x
) I
B
(x
+1
)
+1|n
(x
+1
) (x
+1
, y
+1
) P(x
, dx
+1
)
(dx
)
_
+1|n
(x
+1
)
+1
(dx
+1
)
,
3.2 Transition Counting and Occupation Times 39
where we have dropped the dependence on y
0
, . . . , y
n
for notational conve-
nience. Moreover, if we dene recursively
k|n
(x, y
0
, . . . , y
n
) =
_
k+1|n
(x
, y
0
, . . . , y
n
) (x
, y
k+1
) P(x, dx
)
_
(x
, y
k
) P(x, dx
)
k1
(y
0
, . . . , y
k1
, dx)
with the terminal condition
n|n
(x, y
0
, . . . , y
n
) =
1
_
(x
, y
n
) P(x, dx
)
n1
(y
0
, . . . , y
n1
, dx)
,
then we can write the bivariate smoothing distribution in normalized form
,+1|n
(AB) =
_
I
A
(x
) I
B
(x
+1
)
+1|n
(x
+1
) (x
+1
, y
+1
) P(x
, dx
+1
)
(dx
).
Proof. Up to you: Problem 3.1. .
Returning to the nite state setting, let us represent the bivariate smooth-
ing distribution
,+1|n
as a matrix
,+1|n
with matrix elements dened as
(
,+1|n
)
ij
=
,+1|n
(i j). Note that, by construction,
(
|n
)
i
=
d
j=1
(
,+1|n
)
ij
=
,+1|n
1 =
d
j=1
(
1,|n
)
ji
=
1,|n
1.
Using problem 3.1(b), we may compute the bivariate smoothing distributions
using the forward-backward algorithm 3.1. However, theorem 3.2 suggests that
when we are interested in the bivariate distributions, it is convenient to modify
the algorithm so that it computes the renormalized smoothing densities
k|n
rather than the smoothing densities
k|n
of corollary 2.13. This gives the
Baum-Welch algorithm, which is summarized as algorithm 3.2.
Finally, once we have run the Baum-Welch algorithm, we may evidently
compute immediately the occupation times and transition counts:
i
n
=
n
=0
(
|n
)
i
,
ij
n
=
n1
=0
(
,+1|n
)
ij
.
Alternatively, note that
i
n
=
d
j=1
ij
n
, so we need not even compute
|n
.
Recursive approach
The Baum-Welch algorithm is of the forward-backward type: rst, a forward
pass is made through the observations to compute the ltering distributions;
then, a backward pass is used to compute the bivariate smoothing distribu-
tions. Once the latter have been obtained, we may compute the transition
40 3 Finite State Space
Algorithm 3.2: Baum-Welch Algorithm
c
0
1
(y
0
);
0
(y
0
)/c
0
;
for k=1,. . . ,n do
k
(y
k
)P
k1
;
c
k
1
k
;
k
k
/c
k
;
end
n|n
1/c
n
;
for k=1,. . . ,n do
nk|n
P(y
nk+1
)
nk+1|n
/c
nk
;
nk,nk+1|n
diag(
nk
)P(y
nk+1
)diag(
nk+1|n
);
nk|n
nk,nk+1|n
1;
end
counts and occupation times by summing the smoothing distributions, as ex-
plained above. Note that the backward pass requires us to store both the entire
observation history y
0
, . . . , y
n
and lter history
0
, . . . ,
n
in memory; this is
usually not a problem in o-line data analysis, but can become prohibitive if
we have very long time series or if the estimation is performed on-line.
We are now going to develop a dierent method to compute the tran-
sition counts and occupation times which requires only a forward pass and
no backward pass. This can have signicant advantages; in particular, we do
not need to store the observation history and lter history in memory, but
instead the estimates are updated recursively in each time step using the new
observation only (as in the ltering recursion). This approach also has some
signicant drawbacks, however. A brief discussion of the dierence between
the two approaches can be found at the end of the section.
Let us concentrate on the transition counts
ij
n
; as noted above, we may
obtain the occupation times
i
n
by summing
ij
n
over j. The idea is to introduce
an auxiliary estimator of the following form:
(
ij
n
(Y
0
, . . . , Y
n
))
r
= E(I
r
(X
n
) # < n : X
= i and X
+1
= j[Y
0
, . . . , Y
n
).
Given
ij
n
, we can clearly compute the transition counts as
ij
n
= 1
ij
n
. The
key point is that unlike
ij
n
, the auxiliary estimator
ij
n
can be computed
recursively: this eliminates the need for a backward pass.
Theorem 3.3 (Transition count recursion). The auxiliary estimator
ij
n
(n 0) can be recursively computed as follows:
ij
0
= 0,
ij
k
=
(y
k
)P
ij
k1
+I
j
(y
k
)P
I
i
k1
1
(y
k
)P
k1
(k 1),
where I
i
is the diagonal matrix whose single nonzero entry is (I
i
)
ii
= 1, and
0 is the origin in R
d
(0
i
= 0 for i = 1, . . . , d).
3.2 Transition Counting and Occupation Times 41
Proof. We begin by writing
I
r
(X
k
) # < k : X
= i and X
+1
= j = I
r
(X
k
)
k1
=0
I
i
(X
)I
j
(X
+1
)
= I
r
(X
k
)
k2
=0
I
i
(X
)I
j
(X
+1
) +
jr
I
i
(X
k1
)I
j
(X
k
).
It follows directly from theorem 3.2 that
jr
E(I
i
(X
k1
)I
j
(X
k
)[Y
0
, . . . , Y
k
) =
(I
j
(y
k
)P
I
i
k1
)
r
1
(y
k
)P
k1
.
It remains to deal with the rst term. To this end, we return to the Bayes
formula in the previous chapter, which states that
_
I
r
(x
k
)
k2
=0
I
i
(x
)I
j
(x
+1
) P
X
0
,...,X
k
|Y
0
,...,Y
k
(dx
0
, . . . , dx
k
) =
_
I
r
(x
k
)
k2
=0
I
i
(x
)I
j
(x
+1
)
k
(x
0
, . . . , x
k
)
k
(dx
0
, . . . , dx
k
)
_
k
(x
0
, . . . , x
k
)
k
(dx
0
, . . . , dx
k
)
,
where we have dened the functions
k
(x
0
, . . . , x
k
) = (x
0
, y
0
) (x
k
, y
k
)
and
k
(dx
0
, . . . , dx
k
) = P(x
k1
, dx
k
) P(x
0
, dx
1
)(dx
0
). Dene
A
r
(x
k1
) =
_
I
r
(x
k
) (x
k
, y
k
) P(x
k1
, dx
k
).
Then we evidently have
_
I
r
(x
k
)
k2
=0
I
i
(x
)I
j
(x
+1
) P
X
0
,...,X
k
|Y
0
,...,Y
k
(dx
0
, . . . , dx
k
) =
_
A
r
(x
k1
)
k2
=0
I
i
(x
)I
j
(x
+1
) P
X
0
,...,X
k1
|Y
0
,...,Y
k1
(dx
0
, . . . , dx
k1
)
_
k1
(x
0
, . . . , x
k1
)
k1
(dx
0
, . . . , dx
k1
)
_
k
(x
0
, . . . , x
k
)
k
(dx
0
, . . . , dx
k
)
=
((y
k
)P
ij
k1
)
r
1
(y
k
)P
k1
.
Adding the expressions for the two terms completes the proof. .
Using this result, we can now obtain a forward algorithm which computes
the transition counts and occuptaion times recursively using only a forward
pass. This algorithm is summarized as algorithm 3.3.
Remark 3.4. Note that from theorem 3.3, we nd immediately that the quan-
tity
i
k
=
d
j=1
ij
k
can be computed recursively without computing
ij
k
. As
i
k
= 1
i
k
, we obtain a computationally cheaper forward algorithm for com-
puting the occupation times. However, if the transition counts are computed
anyway, there is clearly no need to perform this extra recursion.
42 3 Finite State Space
Algorithm 3.3: Forward Algorithm
0
(y
0
)/1
(y
0
);
ij
0
0, i, j = 1, . . . , d;
for k=1,. . . ,n do
k
(y
k
)P
k1
;
c
k
1
k
;
k
k
/c
k
;
ij
k
((y
k
)P
ij
k1
+I
j
(y
k
)P
I
i
k1
)/c
k
, i, j = 1, . . . , d;
end
ij
n
1
ij
n
, i, j = 1, . . . , d;
i
n
d
j=1
ij
n
, i = 1, . . . , d;
We now have two approaches to compute the transition counts and oc-
cupation times. Which one is preferable in practice? There is no universal
answer to this question. If enough memory is available to store the observa-
tion and lter history, and if the time horizon n is xed, the Baum-Welch
algorithm may be computationally cheaper as its cost is of order d
3
n oper-
ations (each matrix multiplication is of order d
3
and there are n time steps;
the fact that there are two passes only contributes a constant factor). In con-
trast, the forward algorithm has a computational cost of order d
5
n (as there
are of order d
2
recursions
ij
k
, i, j = 1, . . . , d being computed simultaneously).
Another advantage of the Baum-Welch algorithm is that it allows us to com-
pute arbitrary smoothed estimates, while the forward algorithm is specic to
the computation of transition counts; the forward algorithm is therefore only
suitable if we are interested exclusively in the latter.
On the other hand, the Baum-Welch algorithm assumes that the time
horizon is xed. If we wanted to compute
ij
k
for all k = 0, . . . , n using the
Baum-Welch algorithm, we would have to repeat the algorithm for every time
horizon k separately so that the total computational cost is of order d
3
n
2
. This
may be prohibitive when n is large, while the forward algorithm (with cost
d
5
n) may do better in this setting. Another advantage of the forward algorithm
is that its memory requirements do not depend on the time horizon n, unlike
in the Baum-Welch algorithm. Particularly for long time series and for on-line
computation, the forward algorithm may then turn out to be preferable.
3.3 The Viterbi Algorithm
Up to this point, we have discussed how to implement the generic ltering,
smoothing and prediction problems for nite state signals; these techniques
can be applied in a wide variety of applications for various dierent purposes
(see, e.g., section 1.3). We also discussed two special estimation problems
transition counting and occupation time estimationwhich we will need later
on to solve the important problem of statistical inference (chapter 6).
3.3 The Viterbi Algorithm 43
In this section, we turn to a more specic type of problem: the estima-
tion, or decoding, of a a nite state signal path x
0
, . . . , x
n
from observed data
y
0
, . . . , y
n
. Consider, for example, a nite alphabet message that is encoded
and transmitted through a noisy channel; the signal state space E then rep-
resents the signal alphabet, the signal (X
k
)
0kn
is the message, and the
observation sequence (Y
k
)
0kn
is the encoded and corrupted message as it
is received after transmission through the channel. We would like to infer as
best we can the transmitted message from the observation sequence: i.e., we
are seeking to construct the random variables
X
0
, . . . ,
X
n
, each of which is a
function of the observed sequence
X
k
= f
k
(Y
0
, . . . , Y
0
), such that the estimate
(
X
k
)
0kn
is as close as possible to the true signal (X
k
)
0kn
. The solution
of this problem depends, however, on what we mean by as close as possible.
Let us rst consider the following problem:
Choose (
X
k
)
kn
such that E(#k n : X
k
=
X
k
) is maximized.
In words, we would like to design the estimate so that as many as possible
individual symbols in the message are decoded correctly. First, note that
#k n : X
k
=
X
k
=
n
k=0
I
0
(X
k
X
k
).
Therefore, by lemma 2.4, we must choose the functions f
k
such that
(f
0
(y
0
, . . . , y
n
), . . . , f
n
(y
0
, . . . , y
n
)) =
argmax
( x
0
,..., x
n
)
_
n
k=0
I
0
(x
k
x
k
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx
0
, . . . , dx
n
).
However, due to the elementary fact that the maximum distributes over a sum
(i.e., max
z
0
,...,z
n
(g
0
(z
0
) + +g
n
(z
n
)) = max
z
0
g
0
(z
0
) + + max
z
n
g
n
(z
n
)),
we may compute each f
k
independently:
f
k
(y
0
, . . . , y
n
) = argmax
x
_
I
0
(x x) P
X
k
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx)
= argmax
i
k|n
(y
0
, . . . , y
n
, i) = argmax
i
(
k|n
)
i
.
Evidently the optimal estimate, in the sense of maximum number of correctly
decoded symbols, is obtained by choosing
X
k
to be the MAP estimate of X
k
given Y
0
, . . . , Y
n
(see example 2.6). Computationally, we already know how
to obtain this estimate: using either the forward-backward algorithm 3.1 or
the Baum-Welch algorithm 3.2 to compute the smoothing distributions
k|n
,
the signal estimate is obtained by selecting for each time k the symbol whose
smoothing probability (
k|n
)
i
is maximal.
The above approach to decoding the signal has an important drawback,
however. The problem is most easily illustrated using a trivial example.
44 3 Finite State Space
Example 3.5. For simplicity, we consider an example where there are no obser-
vations. The signal state space is E = 0, 1, and the transition probabilities
are such that P(0, 1) = P(1, 0) = 1. We also choose the initial measure
(0) = (1) = 1/2. As there are no observations (e.g., Y
k
= 0 for all k),
we simply have
k|n
(i) = P(X
k
= i) = 1/2 for every i, k, n.
We now seek to estimate the signal. As all individual probabilities are 1/2,
the above discussion shows that any choice of estimate
X
k
, k = 0, . . . , n has
the same expected number of correctly decoded symbols. We may therefore
choose an optimal estimator in this sense by setting
X
k
= 0 for all k. However,
the signal path X
k
= 0 for all k has probability zero, as P(0, 0) = 0!
Evidently an estimate of the signal path which maximizes the number of
correctly decoded individual symbols need not maximize the probability that
the entire path is decoded without errors; in particularly bad cases the former
technique can even give rise to an estimate which is not actually a valid signal
path. The problem is that by maximizing the probability of each symbol indi-
vidually, we are not necessarily constrained to respect the possible transitions
between adjacent symbols. In problems where the latter is important, it may
be preferable to solve the following alternative estimation problem:
Choose (
X
k
)
kn
such that P(X
k
=
X
k
for all k n) is maximized.
In general the two estimation problems will have dierent solutions.
We now consider how to compute the maximum probability path estimate.
The bad news is that as the event X
k
=
X
k
for all k n can not be written
as a disjoint union of events for each time k individually, we can not use the
above technique to reduce the problem to the forward-backward or Baum-
Welch algorithms. The good news is, however, that we may still compute the
maximum probability path estimate using a recursive algorithm, called the
Viterbi algorithm, which we will develop presently. The Viterbi algorithm is
widely used in communications engineering applicationsmost likely your cell
phone incorporates it in some form or another.
To compute the maximum probability path estimate we must choose, by
lemma 2.4, the estimate functions f
k
such that
(f
0
(y
0
, . . . , y
n
), . . . , f
n
(y
0
, . . . , y
n
)) =
argmax
( x
0
,..., x
n
)
_
n
k=0
I
0
(x
k
x
k
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx
0
, . . . , dx
n
).
Using the Bayes formula, we can evaluate explicitly
_
n
k=0
I
0
(x
k
x
k
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(y
0
, . . . , y
n
, dx
0
, . . . , dx
n
) =
( x
0
, y
0
) ( x
n
, y
n
) P( x
n1
, x
n
) P( x
0
, x
1
) ( x
0
)
_
(x
0
, y
0
) (x
n
, y
n
) P(x
n1
, dx
n
) P(x
0
, dx
1
) (dx
0
)
.
3.3 The Viterbi Algorithm 45
The denominator does not depend on x
0
, . . . , x
n
, however, so evidently
(f
0
(y
0
, . . . , y
n
), . . . , f
n
(y
0
, . . . , y
n
)) =
argmax
( x
0
,..., x
n
)
( x
0
, y
0
) ( x
n
, y
n
) P( x
n1
, x
n
) P( x
0
, x
1
) ( x
0
),
or, even more conveniently,
(f
0
(y
0
, . . . , y
n
), . . . , f
n
(y
0
, . . . , y
n
)) =
argmax
( x
0
,..., x
n
)
_
log(( x
0
)( x
0
, y
0
)) +
n
k=1
(log P( x
k1
, x
k
) + log ( x
k
, y
k
))
_
(we have used that as log x is increasing, argmax
x
f(x) = argmax
x
log f(x)).
The idea behind the Viterbi algorithm is to introduce the functions
v
( x
) =
max
x
0
,..., x
1
_
log(( x
0
)( x
0
, y
0
)) +
k=1
(log P( x
k1
, x
k
) + log ( x
k
, y
k
))
_
.
The key property of these functions is that they can be computed recursively.
Theorem 3.6 (Viterbi recursion). The functions v
( x
) = max
x
1
v
1
( x
1
) + log P( x
1
, x
) + log ( x
, y
)
with the initial condition v
0
( x
0
) = log(( x
0
)( x
0
, y
0
)). Moreover, the es-
timating functions f
(y
0
, . . . , y
n
), = 1, . . . , n for the maximum probability
path estimate given Y
0
, . . . , Y
n
satisfy the backward recursion
f
= argmax
x
( x
) + log P( x
, f
+1
)
with the terminal condition f
n
= argmax
x
n
v
n
( x
n
).
Proof. The result can be read o immediately from the denition of the func-
tions v
. .
The Viterbi algorithm can be implemented directly as a computer al-
gorithm; we have summarized it as algorithm 3.4. Note that the algorithm
consists of a forward pass and a backward pass, which is reminiscent of the
smoothing algorithms earlier in the chapter. However, there is an important
dierence: the backward pass in the Viterbi algorithm does not explicitly use
the observation sequence y
0
, . . . , y
k
. Therefore the observation history does
not need to be stored in memory (but we do need to store at least all v
(i)).
46 3 Finite State Space
Algorithm 3.4: Viterbi Algorithm
v
0
(i) log
i
+ log (i, y
0
), i = 1, . . . , d;
for k=1,. . . ,n do
b
k
(i) argmax
j=1,...,d
{v
k1
(j) + log P
ji
}, i = 1, . . . , d;
v
k
(i) v
k1
(b
k
(i)) + log P
b
k
(i)i
+ log (i, y
k
), i = 1, . . . , d;
end
f
n
argmax
j=1,...,d
v
n
(j);
for k=1,. . . ,n do
f
nk
b
nk+1
(f
nk+1
);
end
Remark 3.7. The Viterbi algorithm succeeds in splitting up a global optimiza-
tion problem so that the optimum can be computed recursively: in each step
we maximize over one variable only, rather than maximizing over all n vari-
ables simultaneously. The general underlying idea that allows one to solve
optimization problems in this manner is Bellmans dynamic programming
principle; the Viterbi algorithm is an excellent example of this principle in
action. We will encounter dynamic programming again repeatedly in chapter
9, where it will be used to solve optimal control problems.
A numerical example
To round o this chapter on a more concrete note, let us briey work out a
simple example. This example is inspired by a problem in biophysics [MJH06],
though we will make up some parameters for sake of example. A dierent
example is given as problem 3.5, where you will work through a practical
application in communications theory.
The problem in the present example is the following. Recall that the DNA
moleculethe carrier of genetic informationconsists of two strands that are
twisted around one another. In order to regulate the readout of DNA, it is
possible for proteins to bind to various parts of the DNA strand; this can
either suppress or enhance the expression of a gene. To understand this mech-
anism more fully, biophysicists are interested in measuring experimentally the
dynamics of the binding and dissociation of proteins to the DNA molecule.
One way to do this is to attach to each strand of a DNA molecule a
uorescent dye of a dierent color: one red and one green, say. We then excite
the red dye with a red laser. If the distance between the two dyes is short,
then some of the energy can be transfered from the red dye to the green
dye, in which case we observe that some green light is emitted. However,
the amount of energy transfer depends strongly on the distance between the
dyes. The trick is that when a protein binds to the DNA molecule, it wedges
itself between the dyes so that their distance is increased. Therefore, when a
protein binds, we expect to see a reduction in the amount of emitted green
light. If another protein binds, we expect to see a further reduction, etc. By
3.3 The Viterbi Algorithm 47
0
1
2
3
0 10 20 30 40 50 60 70 80 90
0
20
40
60
Fig. 3.1. A typical run of the FRET example. The bottom plot shows the photon
count in each time bin. The top plot shows the true number of bound proteins (blue
circles), the Baum-Welch (red squares) and Viterbi (green diamonds) estimates.
monitoring the green light emitted from the experiment, we can therefore try
to estimate when protein binding or dissociation events occur. This is known
as a FRET (uorescence resonance energy transfer) experiment.
Using modern technology, one can easily perform FRET experiments at
the single molecule level, so that one can really observe the individual bind-
ing and dissociation events. However, there is only so much signal that can
be obtained from a single molecule; in particular, in each time interval one
only observes a relatively small number of green photons. The observations
in such an experiment are therefore subject to Poissonian photon counting
statistics. Hidden Markov models provide a tool to decode the individual
binding/dissociation events from the noisy photon count data.
For sake of illustration, we make up an example with contrived numerical
parameters. Let us assume that at most three proteins reasonably bind to
DNA at once. The signal process X
k
is the number of proteins bound in the
time interval k: it is therefore modeled in the signal state space E = 0, 1, 2, 3.
For our example, we will presume that
P =
_
_
.94 .05 .01 .00
.03 .94 .02 .01
.05 .14 .80 .01
.05 .15 .30 .50
_
_
, =
_
_
1
0
0
0
_
_
.
For the observations, we presume that Y
k
is Poisson distributed (as is betting
for photon counts) with rate parameter 50 10 X
k
. In particular, F = Z
+
and we can dene the reference measure and observation density
(j) =
e
1
j!
(j Z
+
), (x, y) = (50 10 x)
y
e
49+10 x
.
This is all we need to use the algorithms in this chapter. A typical numerical
trajectory is shown in gure 3.1, together with the Baum-Welch and Viterbi
48 3 Finite State Space
estimates of the signal (the transition counts and occupation times can of
course also be computed, if one is interested).
In a real application one obviously does not wish to impose an arbitrary
model as we did here; instead, one would like to infer the various parameters
from experimental data. This problem will be treated in detail in chapter 6.
Problems
3.1. Bivariate Smoothing Distributions
(a) Prove theorem 3.2 for general hidden Markov models.
(b) What is the relation between
k|n
(corollary 2.13) and
k|n
?
3.2. Emission Counting
Suppose that E = 1, . . . , d and F = 1, . . . , d
= i and Y
= j[Y
0
, . . . , Y
n
).
3.3. Smoothing Functionals
We have seen that transition counts and occupation times can be computed
in a recursive manner. By the previous problem, this is true also for emission
counts. In fact, as is pointed out in [CMR05, section 4.1.2], there is a gen-
eral class of smoothing functionals which can be computed recursively in this
manner. Consider a function t
n
(X
0
, . . . , X
n
) which is dened iteratively by
t
n+1
(X
0
, . . . , X
n+1
) = m
n
(X
n
, X
n+1
) t
n
(X
0
, . . . , X
n
) +s
n
(X
n
, X
n+1
),
where t
0
: E R and m
n
, s
n
: E E R are given functions. Show that
E(t
n
(X
0
, . . . , X
n
)[Y
0
, . . . , Y
n
) can be computed recursively in a similar manner
as transition counts, occupation times and emission counts. Show also that
the latter are special cases of this general framework.
3.4. DNA Sequence Alignment II
In problem 1.3 we investigated a technique for DNA sequence recognition
and alignment. In that problem, we approached the required computations by
brute force. In this particularly simple example this approach is still tractable,
but in more realistic settings with longer strings and patterns the computa-
tional complexity becomes prohibitive. Fortunately, we now have the tools to
perform the computations in a very ecient manner.
(a) Prove that the following holds:
score(y
0
, . . . , y
k
) =
k
(y
0
, . . . , y
k
, E) = 1
k
,
provided that we choose the reference measure (see denition 1.9) to be the
uniform distribution on F = A, C, G, T.
(b) Reimplement the computations in problem 1.3 using the ltering recursion
and the Viterbi algorithm, and verify that everything works as expected.
3.3 The Viterbi Algorithm 49
B
k
B
k-1
f (
.
)
. . .
B
k-m
message
H
k
.
.
.
1
H
k
n
H
k
2
Y
k
.
.
.
1
Y
k
n
Y
k
2
shift register
channel
Fig. 3.2. A shift-register encoding model of length m and rate n
1
.
3.5. Channel Coding and Decoding
In digital communications one is faced with the basic problem if transmitting a
digital message through a noisy channel. The message is modeled as a sequence
B
k
, k 0 of i.i.d. bits (P(B
k
= 0) = P(B
k
= 1) = 1/2) and the channel
transmits a single bit correctly with probability p ]0, 1[ and ips the bit
with probability 1 p (see example 1.15). Clearly if we were to transmit each
message bit directly through the channel, we would lose a fraction 1 p of
our message. This performance is generally unacceptable.
To circumvent the problem, one must introduce some redundancy into the
message to increase the probability of correct decoding after transmission. If
n bits are transmitted through the channel for every message bit, the encoder
is said to have rate n
1
. A general encoding architecture is the shift-register
model of length m and rate n
1
; this means that when message bit B
k
arrives,
n bits H
k
= (H
1
k
, . . . , H
n
k
) 0, 1
n
are transmitted through the channel
which are computed as a function of the m previous message bits:
H
k
= f(B
k
, B
k1
, . . . , B
km
), f : 0, 1
m+1
0, 1
n
(see gure 3.2). The function f determines the encoding strategy.
(a) Model the shift-register model as a hidden Markov model. The state X
k
should contain the m+1 bits in the shift register, while the output Y
k
consists
of the n output bits at time k after transmission through the channel.
A specic example of an encoder is a rate 1/2, length 2 convolutional code.
The function f is dened through H
1
k
= B
k
B
k2
and H
2
k
= B
k
B
k1
B
k2
(a parity check function; here denotes addition modulo 2).
(b) Implement a computer simulation of the tranmission of a message through
a noisy channel, and use the Viterbi algorithm to reconstruct the message from
the channel output. Experiment with the parameter p and compare the error
frequency obtained with this encoding scheme to the error frequency without
encoding. Note: to implement the Viterbi algorithm we must assume a message
model (i.e., that the message bits are i.i.d.) However, you might nd it fun to
experiment with transmitting actual messages (e.g., a text message) through
your simulated model (e.g., by converting it to ASCII code).
50 3 Finite State Space
Remark 3.8. A communications device that uses the Viterbi algorithm to de-
code an encoded message is known as a Viterbi decoder. The convolutional
encoding/Viterbi decoding approach is implemented in billions of cell phones.
We have discussed a particularly simple example of a rate 1/2 length 2 code,
but slightly longer convolutional codes are indeed in very widespread use.
Notes
The nite state setting is the simplest (and oldest) one in which the recursions
of the previous chapter can be developed. Nonetheless, a large fraction of the
applications of hidden Markov models falls within this setting. On the one
hand, the nite state setting is both computationally and theoretically much
less demanding than the continuous setting, making it eminently suitable for
implementation. On the other hand, surprisingly many applications can be
modeled at least approximately as nite state processes, particularly in the
area of digital communications. In other applications, regime switching models
are common and can successfully capture the statistics of many time series.
There are many variants of the forward-backward algorithm. The original
forward-backward algorithm is often attributed to Baum et al. [BPSW70],
but a forward-backward type algorithm already appears a decade earlier in
the paper of Stratonovich [Str60] (the use of such an algorithm for parameter
inference is due to Baum et al., however). The recursive transition and occu-
pation count lters are due to Zeitouni and Dembo [ZD88], see also [EAM95].
The Viterbi algorithm is due to Viterbi [Vit67]. A nice discussion of the Viterbi
algorithm together with various applications in communication theory can be
found in the tutorial by Forney [For73].
4
Monte Carlo Methods: Interacting Particles
In chapter 2 we completely solved, at least in principle, the ltering problem
for any nondegenerate hidden Markov model. However, we also saw that the
ltering recursion is innite dimensional, so that we run into formidable com-
putational diculties when we wish to apply this technique in practice. With
the exception of one special (but important) casethe nite state case of
chapter 3nonlinear lters typically suer from the curse of dimensionality.
Therefore simple approximation methods, such as state space discretization,
become rapidly intractable in all but the simplest cases.
There is one approximation method, however, that has turned out to be
very successfulthe use of Monte Carlo or random sampling methods to
approximate the ltering recursion. Though such algorithms do not manage
to entirely avoid the curse of dimensionality, they are exible, easily imple-
mentable and typically lead to good performance even in complicated models.
In this chapter we will introduce the Monte Carlo technique in its basic form
and prove its convergence to the exact lter in the appropriate limit.
Remark 4.1. We will restrict ourselves to Monte Carlo algorithms for ltering;
prediction is trivially incorporated, while Monte Carlo smoothing requires a
little more work. Various Monte Carlo algorithms for smoothing can be found
in the literature, though these may not be recursive in nature; see [CMR05,
ch. 68]. A sequential Monte Carlo smoother can be found, e.g., in [DGA00].
4.1 SIS: A Naive Particle Filter
The basic idea behind Monte Carlo approximations is extremely simple, and
can be explained in a few lines. We will develop in this section a naive Monte
Carlo algorithm based on this idea. However, as we will see, the performance of
the naive algorithm is not yet satisfactory, and we will introduce an additional
ingredient in the next section in order to obtain a useful algorithm.
52 4 Monte Carlo Methods: Interacting Particles
Let us begin by noting that by denition 2.8, the unnormalized ltering
distribution
k
evidently satises
_
f(x)
k
(y
0
, . . . , y
k
, dx) = E(f(X
k
) (X
0
, y
0
) (X
k
, y
k
))
for every bounded measurable function f. Now suppose that we have the abil-
ity to simulate the signal process, i.e., to produce i.i.d. samples from the joint
distribution
X
of the signal values (X
0
, . . . , X
k
). Then we can approximate
the unnormalized lter
k
using the law of large numbers:
_
f(x)
k
(y
0
, . . . , y
k
, dx)
1
N
N
i=1
f(x
(i)
k
) (x
(i)
0
, y
0
) (x
(i)
k
, y
k
),
where x
(i)
= (x
(i)
0
, . . . , x
(i)
k
) E
k+1
, i = 1, . . . , N are i.i.d. samples from the
signal distribution
X
. In particular, we can approximate
_
f(x)
k
(y
0
, . . . , y
k
, dx)
N
i=1
f(x
(i)
k
) (x
(i)
0
, y
0
) (x
(i)
k
, y
k
)
N
i=1
(x
(i)
0
, y
0
) (x
(i)
k
, y
k
)
.
The strong law of large numbers immediately guarantees that the right hand
side of the expression converges to the left hand side as we increase the number
of samples N for any bounded (or even just integrable) measurable
function f. Thus, for large N, this Monte Carlo approach does indeed give
rise to an approximation of the ltering distribution.
Note that the above expression can be written as
_
f(x)
k
(y
0
, . . . , y
k
, dx)
N
i=1
w
(i)
k
f(x
(i)
k
),
where we have dened the weights w
(i)
k
as
w
(i)
k
=
(x
(i)
0
, y
0
) (x
(i)
k
, y
k
)
N
i=1
(x
(i)
0
, y
0
) (x
(i)
k
, y
k
)
.
These weights w
(i)
k
, i = 1, . . . , N are positive and sum to one. They can there-
fore be intepreted as probabilities. Note, in particular, that under the signal
measure
X
each sample path i is equally likely by construction (each has
probability 1/N). However, in computing the approximate lter, we reweight
each sample path by the corresponding (observation-dependent) weight. The
observations therefore enter the picture by modifying the relative importance
of each of our simulated sample paths. The Monte Carlo approach can thus
be seen as a variant of importance sampling.
We now make the key observation that the samples x
(i)
k
and weights w
(i)
k
can be generated recursively, just like the exact lter can be computed re-
cursively. This idea allows us to turn the importance sampling technique into
4.1 SIS: A Naive Particle Filter 53
Algorithm 4.1: Sequential Importance Sampling (SIS)
Sample x
(i)
0
, i = 1, . . . , N from the initial distribution ;
Compute w
(i)
0
= (x
(i)
0
, y
0
)/
N
i=1
(x
(i)
0
, y
0
), i = 1, . . . , N;
for k=1,. . . ,n do
Sample x
(i)
k
from P(x
(i)
k1
, ), i = 1, . . . , N;
Compute w
(i)
k
= w
(i)
k1
(x
(i)
k
, y
k
)/
N
i=1
w
(i)
k1
(x
(i)
k
, y
k
), i = 1, . . . , N;
end
Compute approximate lter
f(x)
n
(y
0
, . . . , y
n
, dx)
N
i=1
w
(i)
n
f(x
(i)
n
);
algorithm 4.1, called sequential importance sampling (SIS) for obvious reasons.
It is a simple exercise to verify by induction that the samples and weights gen-
erated by this algorithm coincide with the above expressions. Moreover, the
SIS algorithm is easily implemented on a computer.
Remark 4.2. Sampling from the conditional distribution P(x, ) is particularly
ecient when the signal is modeled as a recursion
X
k
= F(X
k1
,
k
) (k 1),
where
k
, k 1 are i.i.d. random variables whose distribution can be
eciently sampled (e.g., = Unif[0, 1] or = N(0, 1)). Indeed, in this case
we may sample x
k
P(x
k1
, ) simply by sampling
k
and computing
x
k
= F(x
k1
,
k
). Similarly, evaluation of the observation density can be
done eciently when the observation process Y
k
has a convenient form. For
example, consider the common setting where F = R
p
and
Y
k
= H(X
k
) +
k
(k 0),
where H : E R
p
is a given observation function and
k
, k 0 are i.i.d. ran-
dom variables whose distribution has density f
k
to be sharply concentrated around the true location of the signal X
k
= x
k
.
However, in the SIS algorithm, the samples x
(i)
k
are chosen according to
the unconditioned signal distribution
X
; in particular, if we sample from
X
at random, only a small fraction of the samples will be close to any xed
location x
k
. What will then happen in the SIS algorithm is that after only a
few iterations all but one of the Monte Carlo samples will be assigned near-
zero weights, so that the eective Monte Carlo approximation consists of only
one sample rather than N samples. As a consequence, the approximation error
54 4 Monte Carlo Methods: Interacting Particles
E
_
_
_
_
f(x)
k
(y
0
, . . . , y
k
, dx)
N
i=1
w
(i)
k
f(x
(i)
k
)
_
2
_
_
will typically grow very rapidly as we increase number of iterations k (while
keeping the number of samples N xed), thus rendering the algorithm eec-
tively useless. The problem is, of course, that reweighting a nite number of
samples obtained from one distribution to approximate another distribution
does not work well if the two distributions are too far apart. To make the
SIS algorithm eective, we have to change our sampling strategy so that the
distribution of our samples is closer to the ltering distribution
k
.
4.2 SIS-R: Interacting Particles
The idea to resolve the problems of the naive SIS algorithm is surprisingly
simple. Recall that the ltering recursion can be seen as a two step procedure:
k
prediction
k+1|k
correction
k+1
.
Let us suppose, for the moment, that we have some way of doing the following:
Sample x
(i)
k
, i = 1, . . . , N from the ltering distribution
k
(y
0
, . . . , y
k
, dx).
Proceeding as in the SIS algorithm, we can
Sample x
(i)
k+1|k
from P(x
(i)
k
, ) for every i = 1, . . . , N.
Then x
(i)
k+1|k
, i = 1, . . . , N are clearly i.i.d. samples from the one step predictive
distribution
k+1|k
(y
0
, . . . , y
k
, dx). Let us now compute the weights
w
(i)
k+1
=
(x
(i)
k+1|k
, y
k+1
)
N
i=1
(x
(i)
k+1|k
, y
k+1
)
.
Then, by the ltering recursion and the law of large numbers,
_
f(x)
k+1
(y
0
, . . . , y
k+1
, dx)
N
i=1
w
(i)
k+1
f(x
(i)
k+1|k
)
for any bounded measurable function f. In particular, we have approximated
the ltering measure by an empirical measure:
k+1
(y
0
, . . . , y
k+1
, dx)
N
i=1
w
(i)
k+1
x
(i)
k+1|k
(dx).
4.2 SIS-R: Interacting Particles 55
Algorithm 4.2: Sequential Importance Sampling/Resampling (SIS-R)
Sample x
(i)
0
, i = 1, . . . , N from the initial distribution ;
Compute w
(i)
0
= ( x
(i)
0
, y
0
)/
N
i=1
( x
(i)
0
, y
0
), i = 1, . . . , N;
Sample x
(i)
0
, i = 1, . . . , N from the distribution Prob( x
(j)
0
) = w
(j)
0
;
for k=1,. . . ,n do
Sample x
(i)
k
from P(x
(i)
k1
, ), i = 1, . . . , N;
Compute w
(i)
k
= ( x
(i)
k
, y
k
)/
N
i=1
( x
(i)
k
, y
k
), i = 1, . . . , N;
Sample x
(i)
k
, i = 1, . . . , N from the distribution Prob( x
(j)
k
) = w
(j)
k
;
end
Compute approximate lter
f(x)
n
(y
0
, . . . , y
n
, dx)
1
N
N
i=1
f(x
(i)
n
);
In the SIS algorithm, we would now apply the prediction step again to x
(i)
k+1|k
and update the weights. However, recall that we started the present iteration
by sampling from the lter
k
. As we have now obtained an approximation
of the ltering distribution
k+1
, we can begin a new iteration with:
Sample x
(i)
k+1
, i = 1, . . . , N from the approximate lter
N
i=1
w
(i)
k+1
x
(i)
k+1|k
(dx).
Instead of repeatedly updating the weights as in the SIS algorithm, this resam-
pling step essentially resets all the weights to 1/N at the end of every iteration.
The resulting algorithm, which is called sequential importance sampling with
resampling (SIS-R) or the bootstrap lter, is summarized as algorithm 4.2.
What is actually going when we resample? If a sample has a small weight,
it will be less likely to be selected in the resampling step. Therefore, some of
the samples with small weights will disappear when we resample. On the other
hand, as the number of samples N is xed, some of the samples with large
weights will be sampled more than once in the resampling step. Resampling
thus has the eect that the samples with low likelihood given the observations
die while the samples with high likelihood given the observations give birth
to ospring, thus resolving the basic problem of the naive SIS algorithm. This
idea is characteristic of a class of algorithms called evolutionary or genetic al-
gorithms, which propagate a collection of particles by rst applying a mutation
step, where each of the particles moves (mutates) at random, and a selection
step, where the less desirable particles die and more desirable particles give
birth to ospring (survival of the ttest).
Beside its obvious advantages, however, the SIS-R algorithm introduces an
additional diculty. Recall that in the SIS algorithm, the paths (x
(i)
0
, . . . , x
(i)
k
)
were independent for dierent i = 1, . . . , N. Therefore convergence of the ap-
proximate lter to the exact lter as N was immediate from the law of
large numbers. However, in the SIS-R algorithm, the resampling step kills or
duplicates each sample according the observation weights of all the samples.
Therefore, the dierent samples are no longer independent, as they interact
56 4 Monte Carlo Methods: Interacting Particles
with each other in the resampling step. Such models are known as interacting
particle systems. The law of large numbers does not apply to dependent sam-
ples, however, and proving convergence as N now becomes a problem of
its own. We will prove convergence of the SIS-R algorithm in the next section.
Remark 4.3. There are many variants of the basis SIS-R algorithm, which can
lead to improvements in certain settings. For example, standard Monte Carlo
sampling techniques suggest a number of variations on the way sampling or
resampling is performed. Another variation is to not resample in every time
step, but only when the number of samples with negligible weights becomes
too large (this can be computationally advantageous as resampling is expen-
sive). When the signal to noise ratio is very high, the SIS-R algorithm can
suer from the same problem as the SIS algorithm (in this case the weights
might become negligible after a single time step, in which case resamping does
not help); in this case, some form of regularization might be required to make
the algorithm work. A good entry point in the extensive literature on this
topic is [DDG01]. In this course, we are more than happy to stick with the
basic SIS-R algorithm, which is already surprisingly eective in many cases.
A numerical example
As a simple numerical illustration of the SIS-R method, let us work out a
stochastic volatility model for nancial time series in the spirit of example 1.12.
We consider a single stock whose price we observe in discrete time intervals
of length . The price in the kth time step is given by
S
k
= exp((r X
2
k
/2) +X
k
k
) S
k1
(k 0),
where
k
are i.i.d. N(0, 1) random variables and r is the interest rate. The
volatility X
k
satises the mean-reverting linear model
X
k
= X
k1
(X
k1
u) +
k
(k 1),
where
k
are i.i.d. N(0, 1) and u, are constants. For sake of example, we
have chosen the following parameters: = 0.01, r = 0.1, u = = 0.5,
S
1
= 20, X
0
N(0.5, 0.25). This model is a standard hidden Markov model
if we choose as our observations the log-returns Y
k
= log(S
k
/S
k1
), k 0.
The SIS-R algorithm is now easily implemented using the approach outlined
in remark 4.2. Indeed, sampling from P(x, ) is simply a matter of applying
the recursion for X
k
, while you may easily verify that we can set
(x, y) = [x[
1
exp(y (r x
2
/2)
2
/2x
2
).
In gure 4.1, we have plotted a typical trajectory of this model. What is shown
is the absolute volatility [X
k
[, as well as its conditional mean and standard
deviation as estimated using the SIS-R algorithm with 500 particles.
4.3 Convergence of SIS-R 57
0
0.5
1
v
o
l
a
t
i
l
i
t
y
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
10
20
30
40
s
t
o
c
k
p
r
i
c
e
0
1
2
3
4
0
0.25
0.5
0.75
1
0
50
100
150
Fig. 4.1. A typical run of the stochastic volatility example. The top plot shows
the true volatility (orange) and the lter conditional mean (blue) computed using
the SIS-R algorithm from the stock prices, which are shown in the bottom plot.
The shaded blue region is the conditional 66% condence interval computed by the
SIS-R algorithm. The plot on the right shows histograms of the SIS-R samples for
ten time slices. The SIS-R algorithm was run with 500 particles.
Remark 4.4. Note that in gure 4.1, even though the lter occasionally strays a
bit from the true volatility, these little errors correct themselves rather quickly.
This would be true even if we had run the simulation for a much longer time
interval. It is not, however, entirely obvious why this should be the case
particularly when we make approximations (such as the SIS-R algorithm used
here), one might expect that such little errors would accumulate over time and
eventually ruin our estimates completely on the long run. We will gain some
insight into why this does not happen in the next chapter.
4.3 Convergence of SIS-R
The above discussion strongly suggests that the SIS-R algorithm is a signi-
cant improvement over the SIS algorithm. Nonetheless, we have yet to show
that the SIS-R algorithm even converges to the exact lter as the number of
samples increases N ; unlike in the SIS algorithm, this is not trivial as
the SIS-R samples are not independent. The purpose of this section is to ll
this gap in our discussion. To be precise, we will prove the following.
Theorem 4.5. Suppose that the following assumption holds:
sup
xE
(x, y
k
) < , k = 1, . . . , n.
Let x
(i)
n
, i = 1, . . . , N be the random samples generated by the SIS-R algorithm
for the observation sequence y
0
, . . . , y
n
. Then
sup
f
1
_
_
_
_
_
_
f(x)
n
(y
0
, . . . , y
n
, dx)
1
N
N
i=1
f(x
(i)
n
)
_
_
_
_
_
2
C
n
N
,
58 4 Monte Carlo Methods: Interacting Particles
where |X|
2
=
_
E(X
2
) and the constant C
n
does not depend on N (but it
does typically depend on n and y
0
, . . . , y
n
).
Note in particular that the rate of convergence is of order N
1/2
, which is
characteristic of Monte Carlo algorithms in general. The assumption on the
observation density is mild and is satised in most cases.
Remark 4.6. Instead of employing a Monte Carlo method, suppose that we
approximate the lter by restricting computations to a xed grid of spacing
. Then the approximation error would typically be of order
for some
> 0. In particular, as the number of points in a grid of spacing is of order
N (1/)
p
where p is the state space dimension, this non-random algorithm
typically has an approximation error of order N
/p
. The fact that the error
converges very slowly for large p is known as the curse of dimensionality. In
contrast, in our Monte Carlo algorithm the lter is still approximated by N
points, but the approximation error is of order N
1/2
where the exponent
does not depend on the state space dimension. The Monte Carlo approach is
therefore often claimed to beat the curse of dimensionality.
However, this claim should be interpreted with a heavy dose of skepti-
cism. Even though the exponent of the error C
n
N
1/2
does not depend on
dimension, the constant C
n
may well be very large in high dimensional mod-
els. Suppose that C
n
e
p
for some > 0; then in order to achieve a xed
approximation error , we would have to choose a number of samples of order
N
2
e
2p
, which rapidly becomes intractable in high dimensional models.
Though it is not immediately clear how the constant C
n
actually depends on
dimension, numerical and some theoretical evidence strongly suggest that also
Monte Carlo lter approximations perform poorly in high dimensional state
spaces; see [BLB08] and the references therein.
On the other hand, unlike grid methods which can not even be imple-
mented in practice in models whose dimension is higher than 2 or 3, Monte
Carlo ltering algorithms are at least computationally tractable. In a sense
they can be viewed as stochastic grid algorithms where the locations of the
grid points adapt automatically to the problem at hand, even if the number of
points required for good approximation may be large. Presently, Monte Carlo
ltering appears to be the only approach that can be applied to a general
class of higher dimensional problems (in the absence of special structure; if
the model is almost linear, some variant of the Kalman lter can be applied).
In practice the technique usually works well in concrete problems once the
number of particles and the details of the algorithm are ne tuned.
In the following, we presume that the observation sequence y
0
, . . . , y
n
is
xed. For notational simplicity, we will not explicitly denote the dependence
of
k
on y
0
, . . . , y
k
(as we already did for the SIS-R samples and weights).
Let us analyze the steps within one iteration of the SIS-R algorithm. Dene
the SIS-R empirical measure in step k as (see algorithm 4.2 for notation)
4.3 Convergence of SIS-R 59
k
(dx) =
1
N
N
i=1
x
(i)
k
(dx).
The SIS-R iteration proceeds as follows:
k1
prediction
k|k1
correction
0
k
resampling
k
,
where we have dened the empirical measures
k|k1
(dx) =
1
N
N
i=1
x
(i)
k
(dx),
0
k
(dx) =
N
i=1
w
(i)
k
x
(i)
k
(dx).
To prove theorem 4.5, we will bound each of these steps. We will need the
following elementary lemma from Monte Carlo theory.
Lemma 4.7. Let x
(1)
, . . . , x
(N)
be i.i.d. samples from a (possibly random)
probability distribution . Then
sup
f
1
_
_
_
_
_
_
f(x) (dx)
1
N
N
i=1
f(x
(i)
)
_
_
_
_
_
2
N
.
Proof. As x
(i)
, i = 1, . . . , N are independent given , we have
E
_
_
_
_
f(x) (dx)
1
N
N
i=1
f(x
(i)
)
_
2
_
_
=
1
N
2
N
i,j=1
E(f(x
(i)
)f(x
(j)
)[)
__
f(x) (dx)
_
2
=
1
N
_
f(x)
2
(dx) +
_
N
2
N
N
2
1
___
f(x) (dx)
_
2
=
1
N
_
_
f(x)
2
(dx)
__
f(x) (dx)
_
2
_
|f|
2
N
.
Taking the expectation of this expression, the claim is easily established. .
We can now proceed to the proof of theorem 4.5.
Proof (Theorem 4.5).
Step 1 (resampling error). From lemma 4.7, we nd directly that
sup
f
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
0
k
(dx)
_
_
_
_
2
N
.
Therefore, the triangle inequality gives
60 4 Monte Carlo Methods: Interacting Particles
sup
f
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
k
(dx)
_
_
_
_
2
N
+ sup
f
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
0
k
(dx)
_
_
_
_
2
.
Step 2 (correction error). By corollary 2.10 and algorithm 4.2
k
(dx) =
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
,
0
k
(dx) =
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
,
where we have dened
k
(x) = (x, y
k
). We now obtain some simple esti-
mates; the following string of inequalities should speak for itself.
_
f(x)
k
(dx)
_
f(x)
0
k
(dx)
_
f(x)
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
_
f(x)
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
[
_
f(x)
k
(x)
k|k1
(dx)
_
f(x)
k
(x)
k|k1
(dx)[
_
k
(x)
k|k1
(dx)
+
_
f(x)
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
_
f(x)
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)
=
[
_
f(x)
k
(x)
k|k1
(dx)
_
f(x)
k
(x)
k|k1
(dx)[
_
k
(x)
k|k1
(dx)
+
[
_
f(x)
k
(x)
k|k1
(dx)[
_
k
(x)
k|k1
(dx)
[
_
k
(x)
k|k1
(dx)
_
k
(x)
k|k1
(dx)[
_
k
(x)
k|k1
(dx)
|f|
|
k
|
_
k
(x)
k|k1
(dx)
_
f
1
(x)
k|k1
(dx)
_
f
1
(x)
k|k1
(dx)
+
|f|
|
k
|
_
k
(x)
k|k1
(dx)
_
f
2
(x)
k|k1
(dx)
_
f
2
(x)
k|k1
(dx)
,
where f
1
(x) = f(x)
k
(x)/|f
k
|
and f
2
(x) =
k
(x)/|
k
|
1 and |f
2
|
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
0
k
(dx)
_
_
_
_
2
2 |
k
|
_
k
(x)
k|k1
(dx)
sup
f
1
_
_
_
_
_
f(x)
k|k1
(dx)
_
f(x)
k|k1
(dx)
_
_
_
_
2
.
Step 3 (prediction error). From lemma 4.7, we nd directly that
sup
f
1
_
_
_
_
_
f(x)
k|k1
(dx)
_
f(x)
k1
P(dx)
_
_
_
_
2
N
.
4.3 Convergence of SIS-R 61
Therefore, the triangle inequality gives
sup
f
1
_
_
_
_
_
f(x)
k|k1
(dx)
_
f(x)
k|k1
(dx)
_
_
_
_
2
N
+ sup
f
1
_
_
_
_
_
f(x)
k1
P(dx)
_
f(x)
k1
P(dx)
_
_
_
_
2
N
+ sup
f
1
_
_
_
_
_
f(x)
k1
(dx)
_
f(x)
k1
(dx)
_
_
_
_
2
,
where the latter inequality holds as |Pf|
|f|
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
k
(dx)
_
_
_
_
2
1 +D
k
N
+D
k
sup
f
1
_
_
_
_
_
f(x)
k1
(dx)
_
f(x)
k1
(dx)
_
_
_
_
2
,
where we have dened
D
k
=
2 |
k
|
_
k
(x)
k|k1
(dx)
, k 1.
Iterating this bound, we obtain
sup
f
1
_
_
_
_
_
f(x)
n
(dx)
_
f(x)
n
(dx)
_
_
_
_
2
N
n
k=0
(1 +D
k
)
n
=k+1
D
,
provided that we can obtain a bound on the initial step of the form
sup
f
1
_
_
_
_
_
f(x)
0
(dx)
_
f(x)
0
(dx)
_
_
_
_
2
1 +D
0
N
.
But it is easily established (problem 4.2), following the same approach as our
previous estimates, that this is the case with the constant
D
0
=
2 |
0
|
_
0
(x) (dx)
,
where is the initial measure. The proof is complete. .
Problems
4.1. Consider the observation model Y
k
= H(X
k
) +
k
on the observation
state space F = R
p
, where H : E R
p
is measurable and
k
, k 0 are i.i.d.
62 4 Monte Carlo Methods: Interacting Particles
random variables whose law possesses a positive density f
: R
p
]0, [ with
respect to the Lebesgue measure on R
p
. Show that this observation model is
nondegenerate in the sense of denition 1.9, and argue that we may choose
(x, y) = f
1
_
_
_
_
_
f(x)
0
(dx)
_
f(x)
0
(dx)
_
_
_
_
2
N
_
1 +
2 |
0
|
_
0
(x) (dx)
_
,
where the notation is the same as in the proof of theorem 4.5.
4.3. A Performance Comparison
In this problem, we will investigate numerically how the SIS and SIS-R al-
gorithms compare to the exact lter. Consider the linear-Gaussian hidden
Markov model with real-valued signal and observations
X
k
= 0.9 X
k1
+
k
, Y
k
= X
k
+
k
,
where
k
and
k
are N(0, 1). Compute the conditional mean and variance
(a) using the exact ltering equation (problem 2.5);
(b) using the SIS algorithm; and
(c) using the SIS-R algorithm.
How do the approximation errors of the SIS and SIS-R algorithms behave as
a function of time and of particle number? Experiment with various particle
numbers and time horizons, and draw your conclusions.
4.4. Monte Carlo Path Estimation
Our particle lters only approximate the ltering distribution
k
. There are
various applications where one must approximate the smoother as well (e.g.,
to implement the EM algorithm in chapter 6). More generally, one can try to
approximate the entire conditional path distribution P
X
0
,...,X
n
|Y
0
,...,Y
n
:
_
f(x
0
, . . . , x
n
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(dx
0
, . . . , dx
n
)
N
i=1
w
(i)
n
f(x
(n,i)
0
, . . . , x
(n,i)
n
)
for suitable weights w
(i)
n
and paths x
(n,i)
k
(note that we have suppressed the
dependence of P
X
0
,...,X
n
|Y
0
,...,Y
n
on y
0
, . . . , y
n
for notational simplicity). The
smoothing distributions can be obtained as marginals of this distribution.
(a) Modify the SIS algorithm to compute the path distributions.
(b) Prove the following recursion for the exact path distributions:
_
f(x
0
, . . . , x
n
) P
X
0
,...,X
n
|Y
0
,...,Y
n
(dx
0
, . . . , dx
n
) =
_
f(x
0,...,n
) (x
n
, y
n
) P(x
n1
, dx
n
) P
X
0,...,n1
|Y
0,...,n1
(dx
0
, . . . , dx
n1
)
_
(x
n
, y
n
) P(x
n1
, dx
n
) P
X
0,...,n1
|Y
0,...,n1
(dx
0
, . . . , dx
n1
)
4.3 Convergence of SIS-R 63
for all bounded measurable functions f.
(c) Using this identity, propose a variant of the SIS-R algorithm to approxi-
mate the conditional path distributions P
X
0
,...,X
n
|Y
0
,...,Y
n
.
(d) Implement your proposed SIS and SIS-R smoothers together with the ex-
act smoother (problem 2.5) for the linear-Gaussian example in the previous
problem and investigate their performance numerically.
4.5. Credit Derivative Pricing
Suppose that the value of a rm is modeled by the recursion
X
k
= (1 +
k
) X
k1
,
k
N(,
2
), X
0
> 0
(typically ,
2
1). We are also given a threshold K > 0 such that the rm
goes bankrupt if its value drops below the threshold. The bankruptcy time of
the rm is given by = mink 0 : X
k
K.
To nance its operations, the rm issues a zero-coupon bond with maturity
N. This means that the rm agrees to pay the bond holder $1 at time N.
However, if the rm goes bankrupt before time N, the bond holder will not
get paid. The payo of the bond is therefore I
>N
. Our question is how to
price this bond: if a holder of such a bond wishes to sell the bond on the
market at time k < N, what price should he ask?
In practice, the value of the rm is not directly observable to investors.
Instead, an investor must rely on prot reports and other news issued period-
ically by the rm in order to form an estimate of the rms actual value. This
news is typically not entirely accurate. In a simple model, we could assume
that the information obtained by the investor at time k is of the form
Y
k
= X
k
+
k
,
k
N(0,
2
),
i.e., the investor knows the rms value up to some noise in the reporting. It
can be shown [DL01] that the fair market price S
k
of the bond at time k < N
is given by (assuming that we are modeling under a risk-neutral measure)
S
k
= I
>k
r
kN
P( > N[ > k, Y
0
, . . . , Y
k
),
where r is the single period risk-free interest rate (i.e., on your bank account).
(a) Develop a SIS-R type algorithm to compute the bond price at time k.
Hint: add a con point to the signal and observation state spaces E = F =
R , and construct new signal and observation processes
X
k
=
_
X
k
for k < ,
otherwise,
Y
k
=
_
Y
k
for k < ,
otherwise.
Show that (
X
k
,
Y
k
)
k0
denes a hidden Markov model and express the price
in terms of a prediction problem for this extended hidden Markov model.
(b) Write a computer program that implements your algorithm and plot the
bond price as a function of time and maturity. For your simulation, you may
choose model parameters that seem reasonable to you.
64 4 Monte Carlo Methods: Interacting Particles
Remark 4.8. There is a close connection between credit risk models with in-
complete information and nonlinear ltering. See [DL01, CC08] and the con-
tribution of R. Frey and W. Runggaldier in [CR09] for further details.
Notes
Variants of the SIS algorithm have been known for a long time [Han70]. As
Monte Carlo algorithms are computationally expensive, there appears to have
been little interest in such methods until major improvements in computer
technology made them practically applicable. The idea of adding a resampling
step to the SIS algorithm is due to Gordon, Salmond and Smith [GSS93], who
referred to the algorithm as the bootstrap algorithm rather than SIS-R. The
rst convergence proof of SIS-R is due to Del Moral [Del98a].
Much information on Monte Carlo particle lters can be found in the
collection [DDG01]. The convergence proof given here was inspired by the
treatment in Crisan and Doucet [CD02]. Some mathematical analysis of the
behavior of particle lters in high dimensional state spaces can be found in
the recent work of Bickel, Li and Bengtsson [BLB08]. Various approaches to
Monte Carlo smoothing can be found in [CMR05] and in [DGA00].
5
Filter Stability and Uniform Convergence
5.1 Orientation
In the previous chapter, we showed that the SIS-R algorithm converges to the
exact lter as we let the number of particles N go to innity:
sup
f
1
_
_
_
_
_
_
f(x)
n
(y
0
, . . . , y
n
, dx)
1
N
N
i=1
f(x
(i)
n
)
_
_
_
_
_
2
C
n
N
.
This means that for a xed time n, we can obtain an arbitrarily good approx-
imation to the exact lter by choosing N suciently large.
However, in many applications one might not necessarily be interested in
the lter at any particular xed time n, but we need to have good estimates
available at an arbitrary time. For example, in target tracking problems, the
aim is to continually track the location of the target. We can do this, for ex-
ample, by running the SIS-R algorithm where we compute the approximate
lter
k
in every time step k. Our error bound, however, does not guarantee
that this approach will be successful. In particular, if the constants C
k
grow
rapidly in time, then the SIS-R algorithm may degenerate very rapidly so
that we lose lock on the target. A closer look at the proof of theorem 4.5
should make us particularly worried: the constants C
k
obtained in the proof
are bounded from below by 2
k
, which suggests behavior that is entirely unac-
ceptable in tracking applications. Instead, we need to have good performance
at an arbitrary time for suciently large N:
sup
n0
sup
f
1
_
_
_
_
_
_
f(x)
n
(y
0
, . . . , y
n
, dx)
1
N
N
i=1
f(x
(i)
n
)
_
_
_
_
_
2
N
.
In other words, would like to show that
k
converges to
k
uniformly in time
as N . This certainly does not follow from theorem 4.5; in fact, one might
be led to think that uniform convergence does not hold. It is therefore quite
surprising that in many cases (see, e.g., the numerical example in the previous
66 5 Filter Stability and Uniform Convergence
chapter), numerical simulations strongly suggest that the SIS-R algorithm
does converge uniformly in time. That the algorithm works so much better
in practice than we would expect is exciting news, but it also means that we
are missing something fundamental in our analysis. One of the goals of the
present chapter is to gain some understanding of this phenomenon.
The reason that the constants C
k
grow exponentially is that the error
bound in the proof of theorem 4.5 was obtained by bounding the error incurred
in one step of the algorithm. When this single time step bound is iterated,
we obtain a bound on the error incurred in k steps of the algorithm. In this
approach, however, the error incurred in each step accumulates over time,
which causes the constant C
k
to grow. In order to prove uniform convergence,
we have to show that this accumulation of errors does not actually happen.
Filter stability
The new ingredient that is going to help us is a separate topic in itself: the
stability property of the lter. Let us forget for the moment about the ap-
proximate lter, and consider the exact ltering recursion of corollary 2.10. In
order to implement the lter, we need to know the initial measure and the
transition and observation kernels P and . Unlike the kernels, however, which
can be estimated very eciently using the statistical techniques in chapter 6
(provided that we are given a suciently long observation time series), the
initial measure is often dicult to estimate. For example, in many cases the
noise driving the signal dynamics will cause the signal itself to forget its
initial condition (the signal is ergodic), so that even an innite time series of
observations can not be used to estimate the initial measure exactly.
One might worry that our inability to estimate the initial measure would
mean that ltering becomes useless in real-world problems: using the wrong
initial measure in the ltering recursion could have disastrous results. Fortu-
nately, it turns out that this is much less of a problem that one might think.
Rather than hurt us, ergodicity of the signal actually helps us here: if the sig-
nal itself already forgets its initial condition, then it seems highly likely that
this is also true for the ltering distributions. On the other hand, an additional
eect helps us in the ltering problem even when the signal is not ergodic: as
we are obtaining more and more information from the observations as time
increases, it seems likely that this information will eventually supersede the
initial measure, which represents our best guess of the location of the signal
before any observations were actually made.
For these reasons, it is often the case that as time k increases the lter de-
pends less and less on the choice of the initial measure. Mathematically, what
happens is that if one performs the lter recursion (corollary 2.10) with the
same observations, transition and observation kernels, but with two dierent
initial measures, then the two resulting lters converge toward one another as
k . In this case, the lter is said to be stable.
5.1 Orientation 67
Stability of the lter means in particular that we may use the wrong initial
measure without obtaining unreliable estimatesan important practical issue.
However, beside its intrinsic interest, it turns out that the stability property of
the lter plays a central role in statistical inference (chapter 7) and in uniform
convergence of lter approximations (this chapter). For these reasons, it is of
signicant interest to characterize the stability properties of ltering models.
We will develop one particular approach in the next section; further comments
can be found in the notes at the end of the chapter.
Uniform convergence and stability
How does lter stability help us to establish uniform convergence of the SIS-R
algorithm? Intuitively, the stability property implies that the lter is insen-
sitive to approximation errors made a long time ago. For this reason, the
approximation error can not accumulate: though we make an approximation
error in every iteration of the algorithm, the errors made in the previous
iterations are progressively forgotten by the lter as time increases.
Let us show how to make this idea precise. We denote by F
k
the kth
iteration of the exact ltering recursion:
F
k
(A) =
_
I
A
(x) (x, y
k
) P(x
, dx) (dx
)
_
(x, y
k
) P(x
, dx) (dx
)
.
In particular, note that
k
= F
k
k1
by construction. We can now split the
discrepancy between the exact and approximate lter at time k into two parts:
k
k
=
propagation of error
..
F
k
k1
F
k
k1
+
one step error
..
F
k
k1
k
.
The rst term represents the contribution to the error at time k from the
error incurred in the previous iterations, while the second term represents the
error incurred in time step k by applying the SIS-R algorithm rather than the
exact lter. Splitting up the rst term in exactly the same manner, we can
write the error at time k as a sum of propagated one step errors:
k
k
=
k1
=0
(F
k
F
+1
F
1
F
k
F
+1
) +F
k
k1
k
(where F
0
1
=
0
). Now suppose we can establish an estimate of the form
|F
k
F
+1
F
k
F
+1
| C
0
e
(k)
|
|
for some C
0
, > 0, i.e., we suppose that the lter is exponentially stable (we
will work below with the norm |
| = sup|
_
f d
_
f d
|
2
). Then
|
k
k
| C
0
k
=0
e
(k)
|F
|.
68 5 Filter Stability and Uniform Convergence
Evidently, exponential stability of the lter causes the errors incurred in each
time step to be suppressed by a geometric factor. Therefore if the one step
errors are uniformly bounded, the total error can now be estimated uniformly
in timewhich is precisely what we set out to do!
In the remainder of the chapter we will make these ideas precise under cer-
tain (strong) technical assumptions. In section 5.2, we rst prove exponential
stability of the lter. Then, in section 5.3, we develop the above argument in
detail and prove uniform convergence of the SIS-R algorithm.
Remark 5.1. The purpose of this chapter is to give a avor of the stability and
uniform approximation properties of ltering problems; an extensive treat-
ment is outside our scope. We therefore develop our results in the simplest
possible setting. The assumptions that we must impose to make this work are
very strong, and there are many applications in which they are not satised
(some further discussion can be found below). Proving either lter stability
or uniform convergence in a general setting is a challenging problem, and to
date many open problems remain in this direction.
5.2 Filter Stability: A Contraction Estimate
In this section we are going to prove exponential lter stability under a certain
ergodicity assumption on the signal process, called the mixing condition. This
condition causes the signal itself to forget its initial measure at an geometric
rate, and we will show that the lter inherits this property. Note that the sec-
ond eect described abovethat the information gain from the observations
can lead to lter stabilitydoes not enter in our analysis. The stability rate
which we will prove is an upper bound obtained from the ergodicity of the
signal only, and in practice the lter may converge much faster.
Kernels and contraction
Before we can prove lter stability, we need to introduce a simple idea from
the ergodic theory of Markov processes.
Lemma 5.2 (Contraction). Let ,
1
_
_
_
_
_
f(x) K(dx)
_
f(x)
K(dx)
_
_
_
_
2
(1 ) sup
f
1
_
_
_
_
_
f(x) (dx)
_
f(x)
(dx)
_
_
_
_
2
.
5.2 Filter Stability: A Contraction Estimate 69
Proof. Dene
K(x, A) = (1 )
1
K(x, A) (A) for all x E, A E.
Then the minorization condition guarantees that
K is a transition kernel, and
we clearly have K
K = (1 )
K
K. Therefore
sup
f
1
_
_
_
_
_
f(x) K(dx)
_
f(x)
K(dx)
_
_
_
_
2
= (1 ) sup
f
1
_
_
_
_
_
Kf(x) (dx)
_
Kf(x)
(dx)
_
_
_
_
2
.
The result follows immediately as |
Kf|
|f|
k
)
k0
be a Markov process with the same
transition kernel P but with dierent initial measure
. Note that
E(f(X
k
)) =
_
f(x) P
k
(dx), E(f(X
k
)) =
_
f(x)
P
k
(dx).
Thus if P satises the minorization condition, lemma 5.2 shows that
sup
f
1
[E(f(X
k
)) E(f(X
k
))[ (1 )
k
sup
f
1
[E(f(X
0
)) E(f(X
0
))[.
In particular, we nd that the Markov process is geometrically ergodic: the
dierence between the laws of the Markov process started at two dierent
initial measures decays geometrically in time.
The minorization condition in lemma 5.2 is a special case of the well known
Doeblin condition for ergodicity. It has an interesting probabilistic interpreta-
tion. If the transition kernel P satises the condition in lemma 5.2, then we
can write P(x, A) = (A) + (1 ) P
is another transition
kernel. The corresponding Markov process can then be generated as follows:
1. In every time step, ip a coin with Prob(heads) = .
2. If the coin comes up tails, choose the next time step according to the
transition probability P
.
3. If the coin comes up heads, choose the next time step independently from
the present location by sampling from the probability distribution .
Once the coin comes up heads, the Markov process resets to the xed dis-
tribution and the initial condition is forgotten. This idea can be used to
provide a probabilistic proof of geometric ergodicity; see problem 5.1.
Exponential stability of the lter
We now consider our usual hidden Markov model (X
k
, Y
k
)
k0
. To prove lter
stability, we would like to apply the above contraction technique to the ltering
70 5 Filter Stability and Uniform Convergence
recursion, i.e., we would like to show that |F
k
F
k
| (1 ) |
|.
However, we immediately run into a problem: the lter time step F
k
can not
be expressed as a kernel, as F
k
is a nonlinear function of .
On the other hand, each iteration of the smoothing recursion is linear. In
particular, dene for every k n the transition kernel K
k|n
as
K
k|n
(x, A) =
_
I
A
(x
)
k|n
(x
, y
k+1
, . . . , y
n
) (x
, y
k
) P(x, dx
)
_
k|n
(x
, y
k+1
, . . . , y
n
) (x
, y
k
) P(x, dx
)
.
From theorem 2.12 (see also problem 2.2), we can read o that
k+1|n
(y
0
, . . . , y
n
, A) =
_
I
A
(x
) K
k|n
(x, dx
)
k|n
(y
0
, . . . , y
n
, dx),
i.e.,
k|n
=
k1|n
K
k|n
. That the smoothing recursion can be expressed in
this form is no coincidence, see problem 2.4. This observation turns out to be
the key to our problem: lemma 5.2 can be applied to the kernels K
k|n
.
Lemma 5.3 (Minorization of the smoother). Suppose that the transition
kernel P satises the following mixing condition: there exists a probability
measure and a constant 0 < < 1 such that
(A) P(x, A)
1
(A) for all x E, A E.
Then for every k n, the smoothing kernel K
k|n
satises the minorization
condition K
k|n
(x, A)
2
k|n
(A) for some probability measure
k|n
.
Proof. By the mixing condition, we have
K
k|n
(x, A)
2
_
I
A
(x)
k|n
(x, y
k+1
, . . . , y
n
) (x, y
k
) (dx)
_
k|n
(x, y
k+1
, . . . , y
n
) (x, y
k
) (dx)
=
2
k|n
(A).
The proof is complete. .
We can now prove stability of the lter.
Theorem 5.4 (Filter stability). Suppose that the transition kernel P sat-
ises the mixing condition in lemma 5.3. Then for any two (possibly random)
probability measures and
on E, we have for k
sup
f
1
_
_
_
_
_
f(x) F
k
F
+1
(dx)
_
f(x) F
k
F
+1
(dx)
_
_
_
_
2
2
(1
2
)
k
sup
f
1
_
_
_
_
_
f(x) (dx)
_
f(x)
(dx)
_
_
_
_
2
.
5.3 Uniform Convergence of SIS-R 71
Proof. From theorem 2.12, we can read o that
F
k
F
+1
=
|k
K
+1|k
K
k|k
for any probability measure , where we have dened
|k
(A) =
_
I
A
(x)
|k
(x, y
+1
, . . . , y
k
) (dx)
_
|k
(x, y
+1
, . . . , y
k
) (dx)
.
Therefore, by lemmas 5.2 and 5.3, we have
sup
f
1
_
_
_
_
_
f(x) F
k
F
+1
(dx)
_
f(x) F
k
F
+1
(dx)
_
_
_
_
2
(1
2
)
k
sup
f
1
_
_
_
_
_
f(x)
|k
(dx)
_
f(x)
|k
(dx)
_
_
_
_
2
(1
2
)
k
sup
xE
|k
(x)
inf
xE
|k
(x)
sup
f
1
_
_
_
_
_
f(x) (dx)
_
f(x)
(dx)
_
_
_
_
2
,
where the last estimate was obtained in the same manner as step 2 in the
proof of theorem 4.5. But by the mixing condition we can bound
|k
above
and below as C
0
|k
(x, y
+1
, . . . , y
k
)
1
C
0
, where
C
0
=
_
(x
+1
, y
+1
) (x
k
, y
k
) P(x
k1
, dx
k
) P(x
+1
, dx
+2
) (dx
+1
)
(cf. denition 2.11). The proof is easily completed. .
5.3 Uniform Convergence of SIS-R
In this section, we will complete our story by proving that the SIS-R algorithm
converges uniformly to the exact lter as the number of particles increases
N . We will do this under the following assumption.
Assumption 5.5 (Mixing) The transition kernel P is mixing, i.e., there
exists a probability measure and a constant 0 < < 1 such that
(A) P(x, A)
1
(A) for all x E, A E.
Moreover, the observation density is bounded from above and below, i.e.,
there is a constant 0 < < 1 such that
(x, y)
1
for all x E, y F.
Note that the condition on the observation density is very similar to the
mixing condition on the signal transition kernel when it is expressed in terms
72 5 Filter Stability and Uniform Convergence
of the observation kernel . Some comments about this assumption, which is
rather strong, can be found at the end of the section.
As you might expect, we have already done most of the work to complete
the proof of uniform convergence: lter stability has been established, and we
already know how to bound the one step errors as in the proof of theorem 4.5.
Theorem 5.6. Suppose assumption 5.5 holds. Let x
(i)
n
(i = 1, . . . , N, n 0)
be generated by the SIS-R algorithm for the observations (y
k
)
k0
. Then
sup
n0
sup
f
1
_
_
_
_
_
_
f(x)
n
(y
0
, . . . , y
n
, dx)
1
N
N
i=1
f(x
(i)
n
)
_
_
_
_
_
2
N
,
where the constant C depends neither on N nor on (y
k
)
k0
.
Proof. As noted in the introduction, we may write
k
k
=
k1
=0
(F
k
F
+1
F
1
F
k
F
+1
) +F
k
k1
k
(where we use the notation F
0
1
=
0
). Therefore
sup
f
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
k
(dx)
_
_
_
_
2
=0
2
(1
2
)
k
sup
f
1
_
_
_
_
_
f(x) F
1
(dx)
_
f(x)
(dx)
_
_
_
_
2
,
where we have used theorem 5.4. But following exactly the same steps as in
the proof of theorem 4.5, we nd that
sup
f
1
_
_
_
_
_
f(x) F
1
(dx)
_
f(x)
(dx)
_
_
_
_
2
1 + 2
2
N
,
where we have lled in the bounds on in assumption 5.5. This gives
sup
f
1
_
_
_
_
_
f(x)
k
(dx)
_
f(x)
k
(dx)
_
_
_
_
2
1 + 2
2
N
1 (1
2
)
1+k
4
.
We now complete the proof by taking the supremum over k. .
Some comments on Assumption 5.5
Assumption 5.5 is quite restrictive in practice, particularly the lower bounds
on P and (the upper bounds are usually not dicult to satisfy). We have
already seen that the lower bound in the mixing condition implies that the
signal process can be generated by a procedure which, in each time step, resets
5.3 Uniform Convergence of SIS-R 73
the process with probability by drawing from a xed probability distribution
. Similarly, it is easy to see that the same interpretation holds for the lower
bound on the observation density: in each time step, the observation is drawn
with probability from the reference measure , i.e., independently from
the signal, and with probability 1 from the shifted observation kernel
(x, dy) = (1 )
1
(x, dy) (dy).
In both cases, the conclusion is evident: assumption 5.5 implies that the
signal dynamics and the observations are very noisy. However, even this state-
ment should be interpreted with some care. When the signal state space E is
compact, for example, a signal that satises the mixing condition can be ob-
tained by discretizing in time a uniformly elliptic diusion (see [AZ97]). This
conforms to the intuition of noisy dynamics. However, when E is noncompact
even uniform ellipticity does not suce. Some intuition can be obtained by
considering a simple example (problem 5.3); it appears that in order to satisfy
assumption 5.5 in a noncompact setting, one typically needs noise with heavy
tails. Many (if not most) reasonable models, both in the compact and in the
noncompact setting, do not satisfy the required conditions.
This certainly does not mean that the phenomena introduced in this chap-
ter do not appear in more general models. In fact, both lter stability and
uniform approximation is observed numerically in a wide variety of models
which are not even close to satisfying assumption 5.5, and various mathemat-
ical approaches have been introduced to investigate these problems. There is
an important distinction with our results, however. Note that the bounds in
theorems 5.4 and 5.6 do not depend on the observation path (y
k
)
k0
: under
the assumption 5.5 we obtain stability and approximation results uniformly
in the observations. With a rare exception, this is no longer true when as-
sumption 5.5 is not satised. The lack of uniformity brings with it formidable
technical complications, which are beyond the scope of this course.
Problems
5.1. Geometric Ergodicity and Coupling
Let K be a transition kernel on (E, E) such that the minorization condition
holds: K(x, A) (A) for all A E, where 0 < < 1 and is some
probability measure. We are going to give a probabilistic proof of geometric
ergodicity (see section 5.2) of the Markov chain with transition kernel K.
(a) Show that K
(x, A) = (1 )
1
K(x, A) (A) is a transition kernel.
(b) Let (X
k
,
X
k
,
k
)
k0
be a sequence of random variables on some underlying
probability space such that the following hold:
1.
k
are i.i.d. with P(
k
= 0) = and P(
k
= 1) = 1 .
2. X
k
is a Markov chain with transition kernel K and initial measure .
3.
X
k
is a Markov chain with transition kernel K
= 1 for all k;
X
k
otherwise.
Show that Z
k
is Markov with transition kernel K and initial measure .
(c) Show that there exists a random time < a.s. such that P(X
k
=
Z
k
for all k ) = 1. The random variable is called the coupling time and
the Markov chains X
k
and Z
k
are said to be (successfully) coupled.
(d) Show that the following coupling inequality holds:
sup
f
1
[E(f(X
k
)) E(f(Z
k
))[ 2 P(X
k
,= Z
k
) 2 P(k < ).
Now use this estimate to conclude geometric ergodicity of our Markov chain.
5.2. A Weaker Mixing Condition
(a) Suppose that in assumption 5.5 the mixing condition on the transition
kernel is replaced by: there exists an m N such that
(A) P
m
(x, A)
1
(A) for all x E, A E.
Show that theorem 5.6 still holds under this weaker condition. (Hint: you can
no longer show that K
+1|n
satises the minorization condition; however, you
can establish minorization for kernels of the form K
+1|n
K
+m|n
.)
(b) Suppose that the signal and observation state spaces are both nite. Use
the technique in (a) to prove that the lter is exponentially stable whenever
the signal is an ergodic Markov chain and the observations satisfy the nonde-
generacy condition (denition 1.9). Hint: when a nite state Markov chain is
ergodic, there is an integer k > 0 such that (P
k
)
ij
> 0 for all i, j.
5.3. Mixing Is Hard To Do (in a noncompact space)
Consider a hidden Markov model on E F = R R where
X
k
= F(X
k1
) +
k
,
where F : R R is a bounded function. Show that the corresponding transi-
tion kernel does not satisfy the mixing condition if
k
are i.i.d. N(0, 1), unless
F(x) is independent of x. On the other hand, show that the mixing condition
is satised if
k
are i.i.d. exponentially distributed
k
1
2
e
|x|
dx. Draw the
corresponding conclusions for the existence of upper and lower bounds for the
observation density when the observation model is of the form
Y
k
= H(X
k
) +
k
,
where H : R R is bounded and
k
are i.i.d. Gaussian or exponential.
5.3 Uniform Convergence of SIS-R 75
5.4. Observability ([CL06])
In the chapter, we have shown that lter stability can be inherited from er-
godicity of the signalin words, if the signal forgets its initial condition, then
so does the lter. However, one might expect that the lter can be stable
even when the signal is not ergodic. After all, if the observations are good
enough one would expect that the information obtained from the observa-
tions eventually obsoletes the information contained in the initial measure. In
this problem, we will develop a simple result along these lines.
(a) Suppose P
dP
=
d
d
(X
0
) whenever .
(b) Suppose that . Prove that for all bounded measurable f
E
_
d
d
(X
0
)
Y
0
, . . . , Y
k
_
E
(f(Y
k+1
)[Y
0
, . . . , Y
k
)
= E
_
E
_
d
d
(X
0
)
Y
0
, . . . , Y
k+1
_
f(Y
k+1
)
Y
0
, . . . , Y
k
_
.
Hint: review the proof of the Bayes formula (theorem 2.7).
(c) Using part (b) prove the following: whenever
E
([E
(f(Y
k+1
)[Y
0
, . . . , Y
k
) E
(f(Y
k+1
)[Y
0
, . . . , Y
k
)[)
k
0
for all bounded measurable f. Conclude that
E
([E
(f(X
k+1
)[Y
0
, . . . , Y
k
) E
(f(X
k+1
)[Y
0
, . . . , Y
k
)[)
k
0
for all bounded measurable f, where f(x) =
_
f(y) (x, dy).
(d) Suppose that E = 1, . . . , d and F = 1, . . . , d
(|
k+1|k
k+1|k
|
1
)
k
0,
where we have denoted the predictor as (
k+1|k
)
i
= P
(X
k+1
= i[Y
0
, . . . , Y
k
)
and | |
1
denotes the
1
-norm of a vector.
(e) Suppose that is invertible and that
ij
> 0 for all i, j. Using the ltering
recursion to express the lter
k+1
in terms of the predictor
k+1|k
, show that
in fact E
(|
k
|
1
) 0 as k whenever .
Remark 5.7. Note that we have now proved lter stability in this simple setting
making only an observability assumption on the observations: we have made
no assumptions on the signal! These ideas have some very general ramications
for the stability of nonlinear lters, see [van08b, van08d, van08a].
76 5 Filter Stability and Uniform Convergence
Notes
In a pioneering paper on lter stability, Ocone and Pardoux [OP96] established
that nonlinear lters are stable under very general assumptions, provided only
that the signal process is ergodic. However, their approach relies crucially on a
result of Kunita [Kun71] whose proof was subsequently discovered to contain
a serious gap [BCL04, Bud03]. This gap is largely resolved in [van08c], where
additional results can be found on stability in the case of ergodic signals. In
such a general setting, however, no rate of convergence can be given.
Atar and Zeitouni [AZ97] were the rst to establish exponential stability
of nonlinear lters under the strong mixing assumption (early ideas in this
direction are in Delyon and Zeitouni [DZ91]). Del Moral and Guionnet [DG01]
obtained similar results using a dierent method, which gives rise to cleaner
bounds (which are suitable for application to particle lters). Our treatment
of lter stability is loosely based on the approach of Del Moral and Guionnet
(see [DG01, lemma 2.3]). Many authors have investigated lter stability under
weaker assumptions than the mixing condition. Let us mention, e.g., Chigan-
sky and Liptser [CL04], Le Gland and Oudjane [LO03], and Kleptsyna and
Veretennikov [KV08]. An extensive overview of lter stability results can be
found in [CR09]. Various questions in lter stability remain open; for example,
it appears to be unknown whether geometrically ergodic signals always yield
exponential stability of the lter (under mild conditions on the observations).
A standard reference on geometric ergodicity is Meyn and Tweedie [MT93].
For a nice discussion on minorization and coupling, see Rosenthal [Ros95].
The use of lter stability to prove uniform convergence of the SIS-R al-
gorithm is due to Del Moral and Guionnet [DG01]. Our approach is loosely
inspired by Le Gland and Oudjane [LO04]. The book by Del Moral [Del04]
contains much further information on this topic. An entirely dierent approach
(which still relies on lter stability, however) can be found in Budhiraja and
Kushner [BK01]. It should be noted that unlike in the SIS-R algorithm, the
approximation error in the SIS algorithm can generally not be controlled uni-
formly in time [Del98b]. This is a mathematical hint that the SIS-R algorithm
should indeed perform better than the SIS algorithm on longer time scales.
6
Statistical Inference: Methods
6.1 Maximum Likelihood and Bayesian Inference
In the previous chapters, we have discussed in detail how the unobserved signal
process X
k
can be estimated from an observed sample path of the observation
process Y
k
. In order to obtain such estimates, however, we presumed that
the underlying hidden Markov model was completely known. In the present
chapter, we start our investigation of the case where one or more of the basic
building blocks of the hidden Markov modelthe transition kernel P, the
observation kernel , and the initial measure are not known precisely. Our
goal is to select, or learn, a suitable underlying hidden Markov model from
a long training sample path of the observation process. It should be evident
that this statistical inference problem is of great practical importance.
To formalize this problem, we will follow the standard statistical practice
of introducing a family of candidate models for consideration. To this end, let
(, H) be a measurable space, called the parameter space. For each , we
introduce a separate transition kernel P
, observation kernel
, and initial
measure
will be denoted as P
n
(y
0
, . . . , y
n
). We
would like to guarantee that the estimate
n
is close to the true value of for
large n, regardless of what the true parameter happens to be. To be precise,
we would like to show that
n
in P
-probability (or P
, P
. Then
and (X
k
, Y
k
)
0kn
are jointly
distributed according to the distribution P
on (E F)
n
dened as
E
(f(
, X
0
, . . . , X
n
, Y
0
, . . . , Y
n
)) =
_
f(, x
0
, . . . , x
n
, y
0
, . . . , y
n
) P
(dx
0
, . . . , dx
n
, dy
0
, . . . , dy
n
) (d).
We can now estimate the value of
n
(Y
0
, . . . , Y
n
) which
minimizes the mean square error E
(|
|
2
) (assume that R
d
for
this to make sense), we would choose
n
= E
[Y
0
, . . . , Y
n
). This is called
the Bayesian parameter estimator with prior distribution .
By introducing the prior , we have turned the statistical inference prob-
lem into a standard estimation problem. However, our estimator will certainly
depend on . In practice, it is rarely the case that the parameter is actually
chosen from a probability distribution; typically we presume that there is a
xed (non-random) but unknown parameter value
n
(Y
0
, . . . , Y
n
) which minimizes sup
(|
|
2
).
In other words, the minimax estimator is the Bayesian estimator where the
6.1 Maximum Likelihood and Bayesian Inference 79
prior is chosen according to the worst case scenario. The minimax estimator
is generally very dicult to compute in practice, however.
Given a prior distribution, how would we compute the Bayesian estimate?
At least conceptually, this turns out to be extremely straightforward. Let us
dene the E-valued stochastic process
X
k
= (
X
1
k
,
X
2
k
) by setting
X
1
k
=
X
2
k
= X
k
for all k 0. Then it is a simple exercise to show that (
X
k
, Y
k
)
k0
is an ordinary hidden Markov model under the Bayesian measure P
with the
enlarged signal state space E (problem 6.1). The idea of enlarging the state
space to include the parameter is called state augmentation. It should be clear
that the Bayesian estimator
k
can now be computed using the lter
k
for
the augmented model. We have already discussed various ltering algorithms
in the previous chapters, and these apply also in this setting.
However, this also highlights the practical diculties of Bayesian estima-
tion. The computational eort needed to compute the lter to reasonable
accuracy increases rapidly (typically exponentially) with the dimension of the
state space. In many applications, the signal state space has moderate dimen-
sion, so that applying the lter for the signal itself is no problem. However, the
parameter space may be much larger than the signal state spacea typical
example is the case where the signal state space E = 1, . . . , d is a nite set,
but the parameter space consists of all elements of the transition probabil-
ity matrix P. Here ltering of the signal can be done exactly at little cost,
but Bayesian estimation requires us to run a lter on a d(d 1)-dimensional
parameter space: a very expensive problem.
There are, of course, situations where Bayesian estimation can be practi-
cal, e.g., when the parameter space happens to be low dimensional or in the
special case where the Kalman lter can be applied. If the parameter space is
not low dimensional then computing the Bayesian estimator through ltering
is typically intractable; however, there are other methods, such as Markov
Chain Monte Carlo (MCMC), which are specically designed to sample from
probability distributions in high dimensional spaces. For an entry point to the
literature on this topic, see [CMR05, chapter 13].
Maximum likelihood approach
The most common alternative to Bayesian estimation is maximum likelihood
estimation. The idea behind this approach is most easily explained in the case
where the observation state space is a nite set F = 1, . . . , d
. Let us briey
discuss the idea in this setting; we then return to the general case.
Suppose that we observe a training sequence y
0
, . . . , y
n
; in this setting
there is only a nite number of possible sequences of a xed length n, as each
y
k
can only take a nite number of values. Given a xed parameter , the
probability that the hidden Markov model dened by generated the observed
sequence can be evaluated as P
(Y
0
= y
0
, . . . , Y
n
= y
n
). The idea behind
80 6 Statistical Inference: Methods
maximum likelihood estimation is now simple: we select the parameter which
gives the highest probability of generating the actually observed training data
n
(y
0
, . . . , y
n
) = argmax
(Y
0
= y
0
, . . . , Y
n
= y
n
).
The estimate
n
can therefore be interpreted as the parameter value under
which the training data was most likely to be generated.
When F is not a nite set, the probabilities P
(Y
0
= y
0
, . . . , Y
n
= y
n
) will
typically be zero. However, the idea can still be implemented if we consider the
probability density of the observations rather than the probability itself. In
this general setting, we assume that the probability measure P
[
Y
0
,...,Y
n
is ab-
solutely continuous with respect to some xed probability measure Q[
Y
0
,...,Y
n
for every . The maximum likelihood estimate is then dened as
n
(y
0
, . . . , y
n
) = argmax
dP
[
Y
0
,...,Y
n
dQ[
Y
0
,...,Y
n
(y
0
, . . . , y
n
).
Note that the estimate does not depend on the choice of Q, as the latter does
not depend on . The discrete case above follows as a special case.
The maximum likelihood approach seems intuitively plausible. However,
it is certainly not entirely obvious (a) that it gives a good estimator; and (b)
that it can be computed eciently in practice. The latter question is the topic
of this chapter, while we will tackle the rst problem in the next chapter.
Before we can consider any of these problems, however, we need to ask a
basic question: what does the likelihood dP
[
Y
0
,...,Y
n
/dQ[
Y
0
,...,Y
n
look like in
a hidden Markov model? As it turns out, this is a familiar quantity indeed.
Denition 6.3. From now on, we suppose that
k
,
k|n
,
k
, etc., the conditional measures computed as in chapter
2 for the transition kernel P
, observation density
.
Proposition 6.4. Dene Q[
Y
0
,...,Y
n
(dy
0
, . . . , dy
n
) = (dy
0
) (dy
n
). Then
L
n
:=
dP
[
Y
0
,...,Y
n
dQ[
Y
0
,...,Y
n
(y
0
, . . . , y
n
) =
n
(y
0
, . . . , y
n
, E)
=
0
(y
0
, E)
n
k=1
_
(x, y
k
) P
(x
, dx)
k1
(y
0
, . . . , y
k1
, dx
).
Proof. It suces to note that by the denition of
n
E
(f(Y
0
, . . . , Y
n
)) =
_
f(y
0
, . . . , y
n
)
(x
0
, y
0
)
(x
n
, y
n
)
P
(x
n1
, dx
n
) P
(x
0
, dx
1
)
(dx
0
) (dy
0
) (dy
n
)
=
_
f(y
0
, . . . , y
n
)
n
(y
0
, . . . , y
n
, E) (dy
0
) (dy
n
)
6.1 Maximum Likelihood and Bayesian Inference 81
for every bounded measurable function f. .
For a xed value of , the likelihood L
n
is evidently easily computed using
the ltering recursion; for example, in algorithm 3.2 the likelihood is simply
c
0
c
n
. In order to compute the maximum likelihood estimate, however, we
must compute the lter not for a xed value of , but simultaneously for all
. At rst sight, this appears just as dicult as Bayesian estimation.
However, most algorithms for nding the maximum of a function f() do
not require us to evaluate this function a priori at every point . Instead, these
algorithms typically search for a maximum by starting from an initial guess
for and iteratively moving this guess in the direction in which the function
increases (think, e.g., of steepest descent or Newton-type methods). If we are
lucky, such an algorithm converges in a relatively small number of steps, so
that we need to run the lter only for a small number of values of . In the
next section, we will discuss a particular iterative method of this type that
is specically designed for maximum likelihood estimation. The downside of
such methods is that they are typically guaranteed to converge only to a local
maximum of the likelihood, which is not necessarily a global maximum.
To date, this appears to be the state of aairs: the (global) maximum
likelihood estimate can be proved to be consistent under suitable assumptions
on the model, but to compute the estimate eciently we can typically only
guarantee that a local maximum is found. In practice, this seems to work very
well; on the theoretical side, much has been but much also remains to be done.
A particularly simple setting: hypothesis testing
Before we move on to more complicated cases, we discuss a particularly simple
setting: the case where the parameter space = 1, . . . , p is a nite set. This
is known as the hypothesis testing problem: we are given p dierent model
possibilities (hypotheses), and our goal is to decide on the basis of observations
which of the hypotheses holds true. Though this is not the typical setting of
parameter estimation, such problems do appear in applicationsfor example,
the word recognition problem in speech recognition (see example 1.17).
Because there are only nitely many possibilities, the maximum likelihood
hypothesis can easily be found. All we need to do is to compute p lters for
the observed sequence, one for each parameter value. This can be done using
either the exact ltering algorithm if E is nite or using the SIS-R algorithm
otherwise (moreover, the computations are easily parallelized as the lters are
computed independently). Once the lters are computed, we choose as our
estimate the hypothesis with the largest likelihood. However, in this setting
Bayesian estimation is also tractableand gives essentially the same answer!
Proposition 6.5. Let be a Bayesian prior. Then the conditional distribu-
tion of the parameter
is given by
E
(f(
)[Y
0
, . . . , Y
n
) =
_
f()
n
(Y
0
, . . . , Y
n
, E) (d)
_
n
(Y
0
, . . . , Y
n
, E) (d)
.
82 6 Statistical Inference: Methods
In particular, provided that (i) > 0 for all i = 1, . . . , p, the maximum
likelihood parameter estimate coincides with the Bayesian MAP estimate as
then P
= i[Y
0
, . . . , Y
n
)
i
n
(Y
0
, . . . , Y
n
, E) for all i = 1, . . . , p.
Proof. Problem 6.3. .
This simple setting is exceptional in that consistency can be studied with-
out heroics. So why wait until the next chapter? Though the following result
and proof are deceptively simple, and we will need to develop dierent tools
to deal with a more general setting, it should nonetheless give some insightful
motivation for the statistical inference methodology.
Theorem 6.6. When is a nite set, the following are equivalent.
1. Maximum likelihood estimation is consistent:
n
P
[
(Y
k
)
k0
and P
[
(Y
k
)
k0
are mutually singular for all ,
, ,=
.
Recall that probability measures P, Q on a measurable space (, G) are
called mutually singular if there is S G such that P(S) = 1 and Q(S) = 0.
Proof. Suppose that the maximum likelihood estimator is consistent. Then
we nd that P
(lim
n
n
= ) = 1 and P
(lim
n
n
= ) = 0 whenever
,=
. As by construction
n
is a function of the observations only, this
implies that P
[
(Y
k
)
k0
and P
[
(Y
k
)
k0
are mutually singular for ,=
.
Now for the converse. The idea is to show that there exists a perfect
estimator: i.e., there exists a random variable
0
, which is a function of the
observations only, such that
0
= P
= [Y
0
, . . . , Y
n
)
n
P
= [(Y
k
)
k0
)
by the martingale convergence theorem, and as is a nite set we evidently
have lim
n
n
= argmax
= [(Y
k
)
k0
). By example 2.6, we nd
that
= lim
n
n
is the estimator that minimizes the cost P
,=
).
But if
0
is a perfect estimator, then clearly P
0
,=
) = 0. Therefore,
we evidently have
=
0
P
-a.s. for
every , i.e., the maximum likelihood estimator is consistent.
It remains to prove the existence of a perfect estimator. We will construct
such an estimator under the assumption that P
[
(Y
k
)
k0
and P
[
(Y
k
)
k0
are
mutually singular for ,=
, let
S
,
Y
k
: k 0 be a set such that P
(S
,
) = 1 and P
(S
,
) = 0.
Dene S
S
,
(S
) = 1 and P
(S
) =
0 when
0
() = for S
; then by
construction
0
is a function of the observations only and
0
= P
-a.s. for
every . Therefore
0
is a perfect estimator. .
6.2 The EM Algorithm 83
The second condition in this theoreman identiability conditionis nec-
essary for any estimator to be consistent. Though the rather naive approach
and conditions of this theorem do not extend to the case where the parameter
space is uncountable, we will see this idea return in the next chapter.
6.2 The EM Algorithm
When the parameter space is not nite, it is very dicult to compute the
exact maximum likelihood estimate. We therefore need algorithms to search
for the maximum likelihood parameter. In principle one can employ almost
any algorithm for nding a maximum of a function (see problem 6.8). The goal
of this section is to develop a particular algorithm that is specic to maximum
likelihood estimationthe EM (expectation-maximization) algorithmwhich
is widely used in statistical inference problems in hidden Markov models.
EM assumptions
The EM algorithm does not apply to the parameter estimation problem in its
most general form; we need to make some assumptions about the nature of
the parameter dependence. When these assumptions do not hold, parameter
estimation typically becomes a much more dicult problem. Fortunately, it
turns out that these assumptions hold in a variety of important examples.
Assumption 6.7 (EM assumptions) There exists a xed transition kernel
P on E, and probability measures on E and on F, such that P
(x, dx
) = p
(x, x
) P(x, dx
) = exp
_
d
p
=1
c
() p
(x, x
)
_
P(x, dx
),
(x, dy) =
=1
()
(x, y)
_
(dy),
(dx) = u
d
u
=1
q
() u
(x)
_
(dx).
(Necessarily
_
p
(x, x
)P(x, dx
) =
_
(x, y)(dy) =
_
u
(x)(dx) = 1.)
Let us give some typical examples.
Example 6.8 (Finite state space). Suppose that E = 1, . . . , d, so that we can
represent the kernel P
as a matrix P
)
ij
> 0 for all
. Then P
(i, j) = exp
_
d
k,=1
log((P
)
k
d) I
k
(i) I
(j)
_
P(i, j).
84 6 Statistical Inference: Methods
Therefore we may set c
k
() = log((P
)
k
d) and p
k
(i, j) = I
k
(i) I
(j).
Note that a minor modication allows us to treat the case where for each
i, j either (P
)
ij
> 0 for all or (P
)
ij
= 0 for all (choose a
suitable reference kernel P). Also, in a similar fashion, we nd that
always
satises the EM assumption if E and F are both nite sets (provided, as
always, that
2 and denote by m
i
() and v
i
(), respec-
tively, the mean and variance of the Gaussian distribution
(y m
i
())
2
2v
i
()
log(
_
v
i
())
_
(dy)
= exp
_
3
k=1
d
=1
k
()
k
(i, y)
_
(dy),
where
1
(i, y) = I
(i) y
2
,
2
(i, y) = I
(i) y,
3
(i, y) = I
(i), and
1
() =
1 v
()
1
2
,
2
() =
m
()
v
()
,
3
() =
m
()
2
2v
()
log(
_
v
()).
Along similar lines, we can establish that the EM assumption is satised for
if E = R
p
, F = R
q
, and the observations satisfy Y
k
= C()X
k
+ D()
k
where
k
N(0, Id) and D() is an invertble matrix for every .
The EM algorithm
Recall that the maximum likelihood estimate is dened by the expression
n
=
argmax
dP
[
Y
0
,...,Y
n
/dQ[
Y
0
,...,Y
n
for any reference measure Q. In particular,
we may choose Q = P
for an arbitrary
, so we can write
n
(y
0
, . . . , y
n
) = argmax
log
_
dP
[
Y
0
,...,Y
n
dP
[
Y
0
,...,Y
n
(y
0
, . . . , y
n
)
_
.
Here we have used the fact that the logarithm is an increasing function.
Now recall that (if this is unfamiliar, do problem 6.2)
log
_
dP
[
Y
0
,...,Y
n
dP
[
Y
0
,...,Y
n
_
= log
_
E
_
dP
dP
Y
0
, . . . , Y
n
__
.
The maximum of this expression with respect to is typically very dicult
to compute. However, consider instead the quantity
Q
n
(,
) = E
_
log
_
dP
dP
Y
0
, . . . , Y
n
_
.
6.2 The EM Algorithm 85
The key point is that the maximum of this quantity with respect to is easy
to compute when the EM assumptions hold. Indeed, under assumption 6.7,
log
_
dP
dP
(x
0
, . . . , x
n
, y
0
, . . . , y
n
)
_
=
n
k=0
d
=1
()
(x
k
, y
k
)
+
n
k=1
d
p
=1
c
() c
) p
(x
k1
, x
k
) +
d
u
=1
q
() q
) u
(x
0
),
so that we obtain
Q
n
(,
) =
n
k=0
d
=1
()
)
_
(x, y
k
)
k|n
(dx)
+
n
k=1
d
p
=1
c
() c
)
_
p
(x, x
k1,k|n
(dx, dx
)
+
d
u
=1
q
() q
)
_
u
(x)
0|n
(dx).
Therefore, the computation of argmax
Q
n
(,
) can be accomplished in
two steps. First, we compute the univariate and bivariate smoothing distribu-
tions
k|n
and
k1,k
(see theorem 3.2). This can be done eciently using, e.g.,
the Baum-Welch algorithm 3.2 or a variant of the SIS-R algorithm that com-
putes smoothing distributions. Then, we solve the deterministic optimization
problem of maximizing the above expression with respect to : this is much
simpler than the original problem, as the -dependence has been separated
out from the computation of the conditional expectation. This is the essence of
the EM-algorithm: we rst perform the E-step (computation of the smoothing
distributions), followed by the M-step (maximizing the deterministic expres-
sion for Q
n
). In many examples, the M-step can in fact be done analytically,
so that maximizing Q
n
(,
!
Lemma 6.10 (EM lemma). If = argmax
Q(
0
,
), then L
n
L
n
,
i.e., the likelihood of
n
log L
n
= log
_
E
_
dP
dP
Y
0
, . . . , Y
n
__
Q
n
(,
)
by Jensens inequality. But as Q
n
(
) = 0, we must have Q
n
(,
) 0. .
86 6 Statistical Inference: Methods
What this simple lemma suggests is that if we start from some candi-
date parameter estimate
(0)
n
. We then construct the sequence of estimates
(j)
n
= argmax
Q
n
(,
(j1)
n
), j 1
by iterating the E- and M-steps above. This is called the EM algorithm. The
likelihood of the sequence of EM estimates
(j)
n
will steadily increase as j
increases, and we hope that the sequence will converge to the maximum like-
lihood estimate. In practice, this is dicult to prove; what one can prove is
that, under mild conditions, the sequence
(j)
n
converges to a local maximum
of the likelihood function L
n
. This is briey sketched in the next chapter.
EM algorithm for a class of hidden Markov models
Let us show the EM algorithm at work in an important class of concrete
hidden Markov models. We consider a nite signal state space E = 1, . . . , d
and a real valued observation state space F = R, where the observations take
the form Y
k
= m(X
k
)+
_
v(X
k
)
k
with
k
N(0, 1). We wish to estimate all
the transition probabilities P
ij
of the signal, all initial probabilities
i
of the
signal, and the observation functions m and v (which we interpret as vectors
m
i
= m(i) and v
i
= v(i) as usual). We therefore introduce the parameter
space =
d
d
R
d
R
d
+
, where
d
is the space of dd stochastic matrices
with strictly positive entries,
d
is the space of d-dimensional probability
vectors with strictly positive entries, and R
d
+
is the space of d-dimensional
vectors with strictly positive entries; we wish to estimate (P, , m, v) .
What we are going to do is solve the M-step in the EM algorithm explicitly.
To this end, let us rst plug in the expressions in examples 6.8 and 6.9 into
the general expression for Q
n
(,
) =
n
k=0
d
=1
_
(y
k
m
)
2
2v
+ log(
)
_
(
k|n
)
+
n
k=1
d
=1
log(P
) (
k1,k|n
)
+
d
=1
log(
) (
0|n
)
= 1
and
= 1, e.g., by substituting P
d
by 1
<d
P
d
, before computing the maximum). We leave these routine computations to
you (problem 6.4), and jump straight to the result.
6.2 The EM Algorithm 87
Algorithm 6.1: Concrete EM Algorithm/Proposition 6.11
0;
repeat
(P, , m, v)
()
n
;
Run the Baum-Welch algorithm 3.2;
P
ij
n
k=1
(
k1,k|n
)
ij
/
n
k=1
(
k1|n
)
i
, i, j = 1, . . . , d;
i
(
0|n
)
i
, i = 1, . . . , d;
m
i
n
k=0
y
k
(
k|n
)
i
/
n
k=0
(
k|n
)
i
, i = 1, . . . , d;
v
i
n
k=0
(y
k
m
i
)
2
(
k|n
)
i
/
n
k=0
(
k|n
)
i
, i = 1, . . . , d;
(+1)
n
(
P, , m, v);
+ 1;
until parameter estimates converge ;
Proposition 6.11. We have (P, , m, v) = argmax
Q
n
(,
) where
P
ij
=
n
k=1
(
k1,k|n
)
ij
n
k=1
(
k1|n
)
i
,
i
= (
0|n
)
i
,
m
i
=
n
k=0
y
k
(
k|n
)
i
n
k=0
(
k|n
)
i
, v
i
=
n
k=0
(y
k
m
i
)
2
(
k|n
)
i
n
k=0
(
k|n
)
i
.
In particular, note that P
ij
=
ij;
n
/
i;
n
, where
n
and
n
are the transition
counts and occupation times as dened in section 3.2.
The entire EM algorithm is summarized as algorithm 6.1.
It is interesting to note that the EM iteration has a remarkably intuitive
interpretation. For example, the improved estimate of the transition proba-
bility from state i to state j is precisely the best estimategiven our present
best guess of the parameter valuesof the relative frequency of the transitions
from i to j. This might be a natural guess for a good estimate, but now we
know that this is always guaranteed to improve the likelihood. The estimates
for the remaining parameters possess equally intuitive interpretations.
Remark 6.12. We have included estimation of the initial measure in our
discussion. However, unlike the remaining parameters which aect the dy-
namics of the model in every time step, the initial measure is only sampled
once in a single realization of the model. Therefore, the maximum likelihood
estimate of obtained from a single observation time series is not particularly
meaningfulit is an estimate of X
0
rather than of the law of X
0
. Estimation
of the initial measure can therefore usually be omitted with little loss.
A simple numerical illustration is shown in gure 6.1. The observations
were generated from a model on E = 1, 2 with true parameters
P
=
_
.85 .15
.05 .95
_
,
=
_
.3
.7
_
, m
=
_
1
2
_
, v
=
_
.5
.2
_
.
88 6 Statistical Inference: Methods
0
0.5
1
n = 200
P
n = 500 n = 1500 n = 5000
0
1
2
3
m
0 10 20
0
0.2
0.5
1
v
0 10 20 0 10 20 0 10 20
Fig. 6.1. EM algorithm applied to observation time series y
0
, . . . , y
n
obtained from
the numerical example in section 6.2, for various data lengths n. Shown are the EM
estimates of P
11
(top, red), P
22
(top, blue), m
1
(middle, red), m
2
(middle, blue), v
1
(bottom, red), and v
2
(bottom, blue), as a function of the number of EM iterations.
The dotted lines show the true parameter values of each of these quantities.
The EM algorithm was run using the initial guesses
P
(0)
=
_
.5 .5
.5 .5
_
,
(0)
=
_
.5
.5
_
, m
(0)
=
_
1
0
_
, v
(0)
=
_
1
1
_
.
We see that the EM estimates do indeed converge after a few iterations of the
algorithm; moreover, as the length of the observation sequence increases, the
EM estimates converge to the true parameter values. The latter suggests that
the maximum likelihood estimates are indeed consistent. An interesting thing
to note, however, is that the EM estimates have changed the order of the states
in E as compared to the model which we used to generate the observations.
This is no problem, of course, as changing the order of the points in E just
gives a dierent representation of the same hidden Markov model.
6.3 Model Order Estimation
In the previous sections, we have tacitly assumed that the signal and obser-
vation state spaces E and F are xed at the outset. In order for any form of
estimation to make sense, we must indeed x Fafter all, we are trying to
estimate on the basis of a given observation sequence y
0
, . . . , y
n
which takes
values in F. However, it is certainly possible to consider statistical inference
problems where dierent E
EM
n
= .6371 n
1
log L
EM
n
= .2047 n
1
log L
EM
n
= .2041
P
EM
=
.73 .27
.04 .96
P
EM
=
P
EM
=
m
EM
=
.031 2.5
m
EM
=
m
EM
=
v
EM
=
.20 1.1
v
EM
=
v
EM
=
d
n
from the constants c
k
in the
Baum-Welch algorithm. The hope is then that if we choose D suciently large
then L
n
(d) := L
d
n
would attain a maximum for some d < D, in which case
the maximum likelihood value of d is clearly the model order of choice.
However, this does not quite work out the way one would think. The prob-
lem is that a d-state Markov process can always be represented as a d+1-state
Markov process by duplicating one of the states. You can therefore easily con-
vince yourself that for any hidden Markov model of order d, there is a hidden
Markov model of order d + 1 whose observation law is precisely the same.
Therefore, the maximum likelihood L
n
(d) of order d is always nondecreasing
in d! In particular, a maximum likelihood model order does not exist. To
illustrate this phenomenon, table 6.1 shows the results of a numerical ex-
ample where an observation time series y
0
, . . . , y
5000
was generated from the
following hidden Markov model with three signal states:
P
=
_
_
.70 .15 .15
.05 .90 .05
.05 .15 .80
_
_
,
=
_
_
1/3
1/3
1/3
_
_
, m
=
_
_
0
2
4
_
_
, v
=
_
_
.2
.2
.2
_
_
.
90 6 Statistical Inference: Methods
As you can see, the likelihood of the order d = 2 is signicantly smaller than
the likelihood of the (true) order d = 3, while the likelihood of the order
d = 4 is essentially equal to the likelihood of the true order. Inspection of the
parameter estimates for d = 4 shows that the middle state of the true model
has been duplicated as the two middle states of the estimated d = 4 model,
with very little eect on the observation statistics.
Our new-found intuition about the model order estimation problem sug-
gests the following heuristic approach. First, we compute the maximum like-
lihood function L
n
(d) for every model order d = 1, . . . , D as described above.
When plotted as a function of d, the likelihood should steadily increase for
orders below the true model order d < d
. The
model order estimate is therefore found by looking for the corner in the plot
of the likelihood function L
n
(d). This is indeed the essence of a successful
model order estimation technique, but this formulation is not very precise
mathematically (how is the corner dened?) In particular, we need to be
more precise if we wish to prove, e.g., consistency of the estimator.
A way to make this idea precise is to dene the model order estimate
d
n
(y
0
, . . . , y
n
) as a penalized maximum likelihood estimator: we set
d
n
= argmax
d0
L
n
(d) (n, d),
where (n, d) is a given penalty function which is strictly increasing in d for
every n. The idea is to try to choose (n, d) so that it grows less fast with
increasing d than does the likelihood L
n
(d) below the true model order d < d
.
As the likelihood levels o after d > d
n
(d)(n, d) will then have a maximum around the
true model order d d
n
(d), and look for the signature of a nite model order: the leveling
92 6 Statistical Inference: Methods
o of the likelihood function. To this end, we run the EM algorithm for each
model order; as we do not expect the regimes to switch on a daily basis, we
choose for every model order an initial guess of P which is close to the identity
matrix, and run the EM algorithm for 50 iterations. The likelihood function
obtained in this manner is shown as the top plot in gure 6.2. Lo and behold,
the plot does indeed level oit looks like d 3 is the corner of the plot.
This suggests that a regime switching model of order 3 should form a good
description of the statistics of GE prices.
As a by-product of order estimation, we already have an estimate for the
order 3 regime switching model. We nd the following model parameters:
P =
_
_
.9901 .0099 .0000
.0097 .9838 .0065
.0000 .0368 .9632
_
_
, =
_
_
.9990
.0010
.0000
_
_
,
m =
_
_
.3833
.8961
1.392
_
_
10
3
, v =
_
_
.0984
.2518
1.028
_
_
10
3
.
Note that the three regimes have interesting interpretations. The rst is a
low return, low volatility regime: a low risk investment. The second is a high
return, high volatility regime: a riskier but potentially more rewarding in-
vestment. The third regime is one of even higher volatility but negative (!)
returns: the signature of a market crash? The bottom plots of gure 6.2 show
the smoothed MAP estimates of the regime as a function of time. It is inter-
esting to note that the stock market crash of 1987, as well as two periods of
sharp decline after 2001, are estimated as being in the third regime.
Problems
6.1. Bayesian State Augmentation
What are the transition and observation kernels and the initial measure of the
augmented hidden Markov model (
X
k
, Y
k
)
k0
under the Bayesian measure
P
dQ[
G
= E
Q
_
dP
dQ
_
.
In particular, P[
G
is also absolutely continuous with respect to Q[
G
.
6.3. Prove proposition 6.5.
6.4. Complete the proof of proposition 6.11.
6.3 Model Order Estimation 93
6.5. Multiple Training Sequences
In our discussion of maximum likelihood estimation, we have presumed that
statistical inference is to be performed on the basis of a single observation
sequence. However, in many applications one might have multiple indepen-
dent observation sequences available from the same hidden Markov model.
For example, in speech recognition, the training set consists of multiple inde-
pendent speech samples of the same word or phrase. The training sequences
are independent but may have dierent lengths.
(a) Explain how maximum likelihood estimation works in this setting.
(b) Adapt the EM algorithm to cover this setting.
6.6. The EM Algorithm: Finite Signal and Observation State Spaces
Suppose that E = 1, . . . , d and F = 1, . . . , d
n
using the EM algorithm. However, one can in principle apply any nu-
merical algorithm for nding the maximum of a function. Typically such al-
gorithms require one to evaluate the derivatives of the objective function. For
example, the method of steepest descent has us compute iteratively
(j+1)
n
=
(j)
n
+
j
l
n
(
(j)
n
),
where
i
are nonnegative constants. For a suitable choice of
i
, the estimates
(j)
n
are known to converge to a stationary point of l
n
(). An alternative that
does not require us to nd suitable constants
i
(a nontrivial task) is to apply
the Newton-Raphson root nding algorithm to l
n
:
(j+1)
n
=
(j)
n
2
l
n
(
(j)
n
)
1
l
n
(
(j)
n
).
Here
(j)
n
will converge to a zero of l
n
, i.e., to a stationary point of the like-
lihood (typically a local maximum, hopefully the global maximum).
(a) For the model of proposition 6.11, compute the rst derivatives of l
n
()
with respect to the model parameters . Do the expressions look familiar?
(b) Choose a simple example of a hidden Markov model. Simulate an observa-
tion sequence and implement the EM and the Newton-Raphson algorithms to
re-estimate the parameters. Compare the performance of the two algorithms.
94 6 Statistical Inference: Methods
Remark 6.13. Gradient-based algorithms often converge much faster than the
EM algorithm. However, they are more complicated to implement than the
EM algorithm and may also be less stable numerically. Moreover, unlike in
the EM algorithm, the likelihood is not guaranteed to be nondecreasing with
successive iterations of a gradient-based algorithm. Both algorithms are of
interest and there is no universal answer to which one is better: this depends
on the setting and on the available computational resources.
6.9. Model Order Estimation
(a) Choose a one-state, two-state and three-state hidden Markov model and
simulate an observation time series from each. Now run the model order esti-
mation procedure on each of these time series, and show that you are led to
select the correct model order in every case.
(b) Estimate the number of regimes in the stock prices of your favorite com-
pany. Financial time series can be obtained, e.g., from Google Finance.
Notes
The method of maximum likelihood estimation was pioneered by Fisher in
the early 20th century. A modern introduction, chiey in the most common
setting with i.i.d. observations, can be found in [van98, van00, IH81]. The case
where the observations are generated by a hidden Markov model is made much
more dicult by the fact that the observations are not independent. Maximum
likelihood estimation in hidden Markov models was rst investigated by Baum
and Petrie [BP66] for nite signal and observation states spaces.
The EM algorithm for hidden Markov models dates back to Baum, Petrie,
Soules and Weiss [BPSW70]. The method uses no special features of hidden
Markov models; indeed, it turns out to be a special instance of the general
algorithm for maximum likelihood estimation introduced independently by
Dempster, Laird and Rubin [DLR77], who coined the term EM algorithm.
Other approaches for computing maximum likelihood estimates in hidden
Markov models, including the use of Monte Carlo lters when the signal state
space is not nite, are reviewed in [CMR05].
Model order estimation in hidden Markov models dates back to Finesso
[Fin90]. It is related to the model selection problem in statistics, see [CH08] for
an introduction. In practice it is often both mathematically and computation-
ally easier to estimate the model order through a quasi-likelihood approach,
as initially suggested by Ryden [Ryd95], rather than computing the full max-
imum likelihood estimate for every model order. See the notes at the end of
the next chapter for further references on this topic. Other methods beside
penalized (quasi-)likelihood methods have also been suggested for estimating
the model order. For example, Celeux and Durand [CD08] utilize a cross-
validation technique, while Cvitanic, Rozovskii and Zaliapin [CRZ06] employ
a method that is specically designed for continuous time observations.
7
Statistical Inference: Consistency
In the previous chapter, we introduced various maximum likelihood based
methods for statistical inference. The purpose of this chapter is to give a avor
of the theoretical underpinnings of these methods. This is a challenging topic
and, as in our discussion of lter stability in chapter 5, an extensive treatment
is beyond our scope. We therefore mainly focus on proving consistency of the
maximum likelihood estimator, and we will not hesitate to impose very strong
conditions in order to reduce the proofs to the simplest possible setting. Many
of our assumptions can be weakened, for which we refer to the references given
in the notes at the end of the chapter. In addition, some more advanced topics
beyond consistency are briey sketched (without proofs) in section 7.3.
7.1 Consistency of the Maximum Likelihood Estimate
Recall that the maximum likelihood estimate is dened as
n
= argmax
n
,
and our goal is to prove consistency:
as n P
-a.s.
We have already completed a successful trial run in the hypothesis testing
setting (theorem 6.6). Though the proof of this theorem can not be adapted to
more general models, the basic approach will provide the necessary inspiration.
The main idea of the proof of theorem 6.6 can be abstracted as follows:
1. Show that L
n
() := L
n
/C
n
converges P
.
3. Conclude that
n
= argmax
L
n
() argmax
L() =
-a.s.
In theorem 6.6 the process C
n
was chosen such that L
n
() is the Bayesian
conditional probability of the parameter at time n for a suitable prior, and
the identiability requirement established that L() has a unique maximum
at =
n)
2
, x [1, 1].
Then f
n
(x) f(x) as n for all x [1, 1]. However, argmax
x
f
n
(x) 1
as n , while argmax
x
f(x) = 0. Thus f
n
f pointwise, but the maximum
of f
n
does not converge to the maximum of f.
Evidently, L
n
() L() for every is not enough. However, as the follow-
ing elementary calculus lemma shows, our problems are resolved if we replace
pointwise convergence by uniform convergence sup
[L
n
() L()[ 0.
Lemma 7.2. Suppose is compact. Let L
n
: R be a sequence of con-
tinuous functions that converges uniformly to a function L : R. Then
argmax
L
n
() argmax
L() as n .
Proof. As a continuous function on a compact space attains its maximum, we
can nd a (not necessarily unique)
n
argmax
L
n
() for all n. Then
0 sup
L() L(
n
) = sup
L() L
n
() +L
n
() L(
n
)
sup
L() L
n
() + sup
L
n
() L(
n
)
= sup
L() L
n
() +L
n
(
n
) L(
n
) 2 sup
[L() L
n
()[
n
0.
Suppose that
n
does not converge to the set of maxima of L(). Then there
exists by compactness a subsequence
m
n
which converges to
,
argmax
m
) L(
) < sup
. It is here,
however, that the real diculties of the general setting enter the picture:
uniform convergence is not so easy to achieve. For example, when is a
continuous space, the Bayesian normalization used in the hypothesis testing
problem can not lead to uniform convergence. Indeed, in this case L
n
() is the
Bayesian density of the parameter with respect to the prior distribution
(proposition 6.5). If the estimator is consistent, then the Bayesian conditional
7.1 Consistency of the Maximum Likelihood Estimate 97
distribution of the parameter should converge to a point mass at
; therefore
the density L
n
() should converge to a nonzero value only if =
, so that
the convergence L
n
() L() can certainly not be uniform in .
We have thus arrived at the key diculty of proving consistency in the
general setting: we must nd a replacement for the quantity L
n
() which
converges uniformly to a limit. Remarkably, the appropriate notion comes
from an unexpected source: the classical Shannon-McMillan-Breiman (SMB)
theorem in information theory. For the version of this theorem that is suitable
for our purposes, we require the following (see denition 6.3 for notation).
Assumption 7.3 The following hold.
1. is a compact subset of R
p
.
2. There is a 0 < < 1 and a family of probability measures
such that
(A) P
(x, A)
1
(x, y)
1
for all x E, y F, .
4. P
and
(x, A) P
(x, A)[ c
1
|
|,
sup
xE
sup
yF
[
(x, y)
(x, y)[ c
2
|
|.
5. The initial measures
are stationary:
(A) =
_
(dx) P
n
, and suppose
assumption 7.3 holds. Then
n
() is continuous and () = lim
n
n
()
exists P
-a.s.
Before we prove this result, let us complete the proof of consistency.
Theorem 7.6 (Consistency). Suppose that assumption 7.3 holds and that
the following identiability condition holds true:
() has a unique maximum at =
-a.s.
Then the maximum likelihood estimate is consistent.
Proof. Note that the maximum likelihood estimate can be written as
n
=
argmax
n
(). The result follows from proposition 7.5 and lemma 7.2. .
In the next section we will investigate further the identiability condition
in theorem 7.6 and discuss how one might go about verifying it. The remainder
of this section is devoted to the proof of proposition 7.5.
98 7 Statistical Inference: Consistency
A law of large numbers
The basis for our proof is the following representation:
n
() =
1
n
n
k=0
log
__
(x, Y
k
)
k|k1
(Y
0
, . . . , Y
k1
, dx)
_
:=
1
n
n
k=0
D
k
,
where we have used the convention
0|1
(dx) =
k
. Limit theorems for time averages of random variables
are called laws of large numbers (LLN). For independent random variables, for
example, we encountered a type of LLN as lemma 4.7. The random variables
D
k
are not independent, so we will use the following LLN instead.
Lemma 7.7 (LLN). Let (Z
k
)
k0
be a sequence of random variables such that
[E(Z
k
[Z
0
, . . . , Z
)[ C
k
a.s. for all 0 k and some constants C > 0,
0 < < 1. Then S
n
:= n
1
n
k=0
Z
k
0 a.s. as n .
Proof. We rst prove mean square convergence. To this end, note that
E(S
2
n
) =
1
n
2
n
k=0
E(Z
2
k
) +
2
n
2
n
k=0
k1
=0
E(Z
k
Z
).
But E(Z
2
k
) C
2
and [E(Z
k
Z
)[ = [E(E(Z
k
[Z
0
, . . . , Z
) Z
)[ C
2
k
, so
it is easily established that E(S
2
n
) K/n for some K < . In particular,
E(S
2
n
) 0. We now strengthen to a.s. convergence. For any > 1 and > 0,
k=1
P([S
k[ > )
k=1
E(S
2
k
)
2
K
k=1
k
< .
By the Borel-Cantelli lemma, we nd that S
+
(n) the smallest integer such that
n
k
+
(n)
and by k
(n)
< n. Then
(n)
+
(n)
1
(n)
(n)
=0
(Z
+C)
1
n
n
=0
(Z
+C)
k
+
(n)
(n)
1
+
(n)
+
(n)
=0
(Z
+C),
where we have used that Z
+
(n) = k
=0
(Z
+C) limsup
n
1
n
n
=0
(Z
+C) C a.s.
As > 1 was arbitrary, we nd that S
n
0 a.s. .
7.1 Consistency of the Maximum Likelihood Estimate 99
The proof of proposition 7.5 proceeds in three steps. First, we show that
() := lim
k
E
(D
k
) exists for every .
Second, we will show that there exist C > 0 and 0 < < 1 such that
[E
(D
k
E
(D
k
) [ X
0
, . . . , X
, Y
0
, . . . , Y
)[ C
k
for all 0 k. The law of large numbers then guarantees that
n
() =
1
n
n
k=0
D
k
E
(D
k
) +
1
n
n
k=0
E
(D
k
)
n
() P
-a.s.
for every . Finally, in the third step we will show that this convergence
is in fact uniform in , thus completing the proof.
Two key consequences of lter stability
From the denition of D
k
, it is evident that the long time properties of
n
()
are intimately related with the long time properties of the prediction lter
k|k1
. It should therefore come as no surprise that the lter stability the-
ory from chapter 5 makes an appearance; indeed, assumption 7.3 was chiey
designed to make this possible (compare with assumption 5.5).
The techniques from chapter 5 will be used in the form of two key lemmas,
which we will prove rst. The rst lemma shows that the quantity D
k
, which
depends on the observations Y
0
, . . . , Y
k
, can be approximated uniformly by a
function of a xed number of observations Y
k
, . . . , Y
k
only.
Lemma 7.8 (Finite memory approximation). Dene for 0 < < k
D
k,
:= log
__
(x, Y
k
)
|1
(Y
k
, . . . , Y
k1
, dx)
_
.
If assumption 7.3 holds, then [D
k,
D
k
[ 2
2
2
(1
2
)
.
Proof. By assumption
(x, y) [,
1
] for some 0 < < 1. Using the
inequality [ log(x) log(x
)[
1
[x x
[ for all x, x
[,
1
], we estimate
[D
k,
D
k
[
1
(x, Y
k
)
1
(Y
k
, . . . , Y
k1
, dx)
(x, Y
k
)
k1
(Y
0
, . . . , Y
k1
, dx)
,
where we have dened
(x, y) =
_
(x
, y) P
(x, dx
k1
(Y
0
, . . . , Y
k1
, dx) = F
k1
F
k1
(dx),
1
(Y
k
, . . . , Y
k1
, dx) = F
k1
F
(dx),
where F
n
are the lter recursion map as dened in chapter 5. Taking into
account [
(x, y)[
1
, the proof is completed by invoking theorem 5.4. .
100 7 Statistical Inference: Consistency
The second lemma shows that D
k
is Lipschitz continuous uniformly
in k. This is, of course, similar to the uniform approximation theorem 5.6.
Lemma 7.9 (Equicontinuity). Suppose that assumption 7.3 holds. Then
there is a K < such that [D
k
D
k
[ K|
| for all k 1.
Proof. It is easily established as in the proof of lemma 7.8 that
[D
k
D
k
[
2
sup
f
_
f(x)
k1
(dx)
_
f(x)
k1
(dx)
.
But note that for every 0, probabilty measure and ,
sup
f
_
f(x) F
(dx)
_
f(x) F
(dx)
(x, y)
_
(x, y) (dx)
(x, y)
_
(x, y) (dx)
(x, y)
(x, y)[
_
(x, y) (dx)
+
(x, y)
_
[
(x, y)
_
(x, y) (dx)
_
(x, y) (dx)
(
1
+
3
) sup
x,y
[
(x, y)
(x, y)[
(
1
+
3
)c
2
+
1
c
1
|
|,
where c
1
and c
2
are dened in assumption 7.3. Moreover, using lemma 5.2
sup
f
_
f(x)
(dx)
_
f(x)
(dx)
= sup
f
_
f(x) P
(x
, dx)
(dx
)
_
f(x) P
(x
, dx)
(dx
c
1
|
| + (1 ) sup
f
_
f(x)
(dx)
_
f(x)
(dx)
,
so sup
f
1
[
_
fd
_
fd
[
1
c
1
|
(
n
())). Dene
:= E
(D
). As we assume
that
is stationary, (Y
k
)
k0
is a stationary stochastic process under P
.
Therefore
= E
(D
k,
) for any 0 < < k, and we can estimate
[
m+n
m
[ = [E
(D
m+n
) E
(D
m+n,m
)[ 2
2
2
(1
2
)
m
by lemma 7.8. Thus evidently sup
n0
[
m+n
m
[ 0 as m , i.e.,
k
is a Cauchy sequence and is therefore convergent. By Ces`aros theorem
7.1 Consistency of the Maximum Likelihood Estimate 101
(problem 7.1), E
(
n
()) = n
1
(
0
+ +
n
) converges also.
Step 2 (convergence of
n
()). We have shown that () := lim
n
E
(
n
())
exists for every . We aim to show that in fact
n
() () P
-a.s. for
every . By the LLN, this follows if we can show that
[E
(D
k
[X
0
, . . . , X
, Y
0
, . . . , Y
) E
(D
k
)[ C
k
for all 0 k and some constants C > 0, 0 < < 1.
To this end, note that D
k+n,n1
= f
n
(Y
k+1
, , Y
k+n
) for xed n > 1 and
all k 0. By the hidden Markov property (denition 1.6), there is a function
g
n
such that E
(D
+n,n1
[X
0
, . . . , X
, Y
0
, . . . , Y
) = g
n
(X
) for all 0. We
claim that for any n > 1 and , m 0 the following estimate holds:
[E
(D
+m+n,n1
[X
0
, . . . , X
, Y
0
, . . . , Y
)E
(D
+m+n,n1
)[ 2
1
(1)
m
.
Indeed, this follows from lemma 5.2, the Markov property of X
k
, and the
tower property of the conditional expectation. Therefore by lemma 7.8
[E
(D
+m+n
[X
0
, . . . , X
, Y
0
, . . . , Y
) E
(D
+m+n
)[
2
1
(1 )
m
+ 4
2
2
(1
2
)
n1
.
Substituting m = n 2 and m = n 1, respectively, we can estimate
[E
(D
+k
[X
0
, . . . , X
, Y
0
, . . . , Y
) E
(D
+k
)[ C
0
(1
2
)
k/21
for all k 2, where C
0
= 2
1
+4
2
2
. The condition of the LLN is now
easily veried by setting =
1
2
and choosing C suciently large.
Step 3 (uniform convergence of
n
()). By lemma 7.9,
n
() is Lipschitz
continuous for every n. As
n
() () P
, #
[
n
() ()[ 2 + max
[
n
() ()[.
As
n
pointwise and
is a nite set,
limsup
n
sup
[
n
() ()[ 2 P
-a.s.
But > 0 was arbitrary, so
n
uniformly. .
102 7 Statistical Inference: Consistency
7.2 Identiability
Our main consistency theorem 7.6 states that the maximum likelihood esti-
mate is consistent provided that the the model is identiable in the sense that
() has a unique maximum at =
(
n
()) P
-a.s.
(
)() = lim
n
1
n
E
_
log
_
L
n
L
n
__
= lim
n
1
n
E
_
log
_
dP
[
Y
0
,...,Y
n
dP
[
Y
0
,...,Y
n
__
.
The quantity on the right is a familiar quantity in information theory.
Denition 7.10. For any two probability measures P and Q, the quantity
D(P[[Q) =
_
E
P
_
log
_
dP
dQ
__
if P Q,
otherwise,
is called the relative entropy (or Kullback-Leibler divergence) between P, Q.
As we will shortly see, the relative entropy can be seen as a measure of
distance between probability measures. Evidently the quantity
(
) () = lim
n
1
n
D(P
[
Y
0
,...,Y
n
[[P
[
Y
0
,...,Y
n
) P
-a.s.
represents the rate of growth of the relative entropy distance between the laws
of the observation process over an increasing time horizon. This quantity is
therefore known as the relative entropy rate between the laws of the obser-
vations (Y
k
)
k0
under P
and P
) () > 0 for ,=
-a.s.
1. () (
) if and only if P
[
(Y
k
)
k0
= P
[
(Y
k
)
k0
.
In particular, if every gives rise to a distinct law of the observations
P
[
(Y
k
)
k0
, then
-a.s.
Proof. As relative entropy is nonnegative, it is immediate that the relative
entropy rate (
[
(Y
k
)
k0
= P
[
(Y
k
)
k0
clearly implies that (
) = () implies that P
[
(Y
k
)
k0
P
[
(Y
k
)
k0
. In the
second step, we will prove that the latter implies P
[
(Y
k
)
k0
= P
[
(Y
k
)
k0
.
Step 1. Suppose that (
) = (). Then
[E
(D
n
D
n
)[ = [E
(D
n
D
n
) (
) +()[
[E
(D
n
) (
)[ +[E
(D
n
) ()[ 4
2
2
(1
2
)
n
,
where the latter estimate was established in the rst step of the proof of
proposition 7.5. Dening K = 4
2
k=0
(1
2
)
k
< , we can write
D(P
[
Y
0
,...,Y
n
[[P
[
Y
0
,...,Y
n
) =
n
k=0
E
(D
k
D
k
) 4
2
2
n
k=0
(1
2
)
k
< K
for all n 0. That P
[
(Y
k
)
k0
P
[
(Y
k
)
k0
follows from lemma 7.11.
Step 2. We now suppose that P
[
(Y
k
)
k0
,= P
[
(Y
k
)
k0
. We will show that
under this assumption the laws of (Y
k
)
k0
under P
and P
are mutually
104 7 Statistical Inference: Consistency
singular. This implies, conversely, that if the laws of the observations are
absolutely continuous, then they must in fact be equal.
When the laws of the observations under P
and P
(f(Y
1
, . . . , Y
n
)) ,=
E
(f(Y
1
, . . . , Y
n
)). Dene Z
k
= f(Y
k+1
, . . . , Y
k+n
), and note that by station-
arity E
(Z
k
) = E
(f(Y
1
, . . . , Y
n
)) for all k and
[E
(Z
k
[Z
0
, . . . , Z
) E
(Z
k
)[ C
k
for some C > 0, 0 < < 1. Therefore, by the LLN,
1
r
r
k=0
Z
k
n
E
(f(Y
1
, . . . , Y
n
)) P
-a.s.
for every
r
k=0
Z
k
E
(f(Y
1
, . . . , Y
n
))
has unit probability under P
. Thus evidently
the laws of (Y
k
)
k0
under P
and P
n
be a sequence of maximum likelihood estimates. Then
n
converges P
-a.s.
to the set of parameters which give rise to the same observation law as
.
To wrap up our discussion, let us give an example.
Example 7.15. Let the signal state space E = 1, . . . , d be nite, and suppose
that the observations are real-valued and take the form Y
k
= h(X
k
) +
k
where
k
are i.i.d. N(0, 1) and > 0. The parameter space consists of
all transition probabilities P
ij
of the signal, the noise variance , and all
observation values h
i
= h(i) which we presume to be distinct h
i
,= h
j
for
i ,= j. We have seen various examples of this type of model in chapter 6. Note,
however, that this example does not satisfy the strong assumption 7.3 that we
have made throughout this chapter. An example of a model that does satisfy
our assumptions is given as problem 7.3 below.
7.3 Advanced Topics 105
We would like to investigate when two distinct parameters ,
give
rise to the same observation law. First, note that under any P
, the charac-
teristic function of Y
k
can be written as
E
(e
iY
k
) = E
(e
i
k
) E
(e
ih(X
k
)
) = e
2
/2
d
i=1
P
(X
k
= i) e
ih
i
,
i.e., a Gaussian envelope times a purely oscillatory term. Note that can be
uniquely determined from the law of Y
k
it is the unique > 0 such that
e
2
/2
E
(e
iY
k
) neither converges to zero nor diverges as . Therefore,
if the laws of the observations under P
and P
.
Using the same technique, we can investigate the multivariate laws:
E
(e
i{
0
Y
0
++
n
Y
n
}
) = E
(e
i{
0
h(X
0
)++
n
h(X
n
)}
) e
2
{
2
0
++
2
n
}/2
.
As can be determined uniquely from the observation law, we nd that if the
laws of the observations under P
and P
(X
k
) under P
, h
n
is close to the true parameter value
and variance V
. Then
m
n
=
1
n
n
k=1
X
k
n
m
-a.s.
for every by the law of large numbers. In particular, m
n
is a consistent
estimator of the mean m
n m
n
m
=
1
n
n
k=1
X
k
m
weakly
N(0, V
).
Therefore, for large n, the estimate m
n
is approximately distributed as a
Gaussian random variable with mean m
and variance V
1.96
_
V
/n. In practice V
weakly
N(0, ).
When this is the case, the maximum likelihood estimate is said to be asymp-
totically normal, and condence intervals can be obtained along the same lines
as in the i.i.d. case as described above.
There is a standard trick that is used to prove asymptotic normality of
maximum likelihood estimates. The idea is that the rst derivatives of a
smooth function must vanish at its maximum. Let us presume that regularity
conditions have been imposed so that
n
() is suciently smooth. Then
0 =
n
(
n
) =
n
(
) +
2
n
(
+R
n
(
n
,
),
7.3 Advanced Topics 107
where we have Taylor expanded the likelihood gradient
n
to rst order
around
. In particular, we nd that
= (
2
n
(
))
1
n
(
) +R
n
(
n
,
n.
To establish asymptotic normality, it then suces to prove the following:
n
(
)
n
a.s.
J(
),
n
n
(
)
n
weakly
N(0, J(
)),
and R
n
(
n
,
)
1
(in order to compute condence intervals in practice
one may now replace the unknown quantity J(
n
(
n
)). This procedure is reminiscent of the proof of the Cramer-Rao
bound, and it turns out that the matrix J(
d
, where
d
is the parameter set for the models with
xed order d (i.e., a point in
d
consists of all possible transition probabilities
and observation parameters for a hidden Markov model of order d).
Recall that if
d
is the true model parameter, then there exists for
every d > d
a parameter
d
which gives rise to the same observation law.
The model order estimation problem is therefore inherently non-identiable.
A consistent estimator would be guaranteed to converge to a model parameter
with the correct observation law, but this parameter might well be of a much
larger model order than is necessary to describe the observed training data.
Our goal is therefore to nd an estimator
n
which is not only consistent, but
also gives rise (as n ) to a parameter estimate with the smallest possible
order. In other words, we would like to estimate the smallest integer d such
that the observation law can be described by a hidden Markov model of order
dwe will refer to this quantity as the true model order d
.
108 7 Statistical Inference: Consistency
Let us dene
n
(d) = max
d
n
(). The maximizer
n
(d) in this expres-
sion is the maximum likelihood estimate of order d. Because there exists for
every d
> d a
d
with the same observation law as
n
(d), and hence
with the same likelihood, the likelihood function
n
(d) is nondecreasing with
increasing model order d. Moreover, assuming that the maximum likelihood
estimates are consistent, it will be the case that lim
n
n
(d) :=
(d) satis-
es
(d) =
(d
n
(d) is increasing for d < d
and is at for d d
.
How to estimate d
d
n
= argmax
d0
n
(d) (n) (d),
where the penalty functions and are to be chosen such that
d
n
d
-
a.s. We are now going to argue how this can be done, albeitwith apologies
to the readerwith a lot of handwaving and imprecision.
The essential idea is to require the following three conditions:
1. (d) is a strictly increasing function.
2. (n) 0 as n .
3.
n
(d
n
(d)/(n) 0 as n P
-a.s. for d d
.
Let us show the relevance of these conditions. First, note that
n
(d) (n) (d)
n
(d).
As the latter is at for d d
n
(d
) (n) (d
n
(d) (n) (d)
(n)
n
(d) (d
)
for d > d
. In other words, as n ,
the order estimate will not overestimate the true model order. This can only
imply that
d
n
d
(d) =
(d
) for d > d
, we have
n
(d
n
(d) 0
as n for d > d
n
(d
n
(d). We must therefore try to estimate
the latter rate. Heuristic arguments based on the law of iterated logarithm
7.3 Advanced Topics 109
lead one to expect that this rate is of order O(log log n/n), in which case
one could choose something like (n) = log n/n. In some particular cases
this argument can be made rigorous, though a detailed development of the
necessary technicalities is quite intricate and is most certainly beyond our
scope. It also appears that a completely satisfactory general result has yet to
be obtained. The reader is referred to the notes at the end of the chapter.
Convergence of the EM Algorithm
To compute maximum likelihood estimates in practice, we have introduced the
EM algorithm in the previous chapter. We have seen that each EM iteration
increases the likelihood, but this does not guarantee that repeated iteration
of the EM algorithm will cause the parameter estimate to converge to the
global maximum of the likelihood. Indeed, this is generally not guaranteed;
the EM algorithm may even converge to dierent limits depending on which
initial guess was used for the parameter value.
In this section, we will sketch a simple argument that shows that the EM
algorithm converges to a critical point of the likelihood (i.e., a point where all
the rst derivatives of the likelihood vanish) under certain conditions. As the
likelihood typically has several local maxima, this implies that the algorithm
generally converges to a local maximum. There does not appear to be a simple
way to guarantee that this local maximum is actually a global maximum. In
practice, one might try to run the algorithm several times started at dierent
initial guesses, and choose the run which leads to the largest likelihood.
Dene the map T : as T() = argmax
Q
n
(
0
, ), where Q
n
is
the dening quantity of the EM algorithm. Then the EM algorithm consists
of computing iteratively
j
= T(
j1
) from some initial guess
0
.
Proposition 7.18 (Local EM convergence). Assume the following:
1. is an open subset of R
p
.
2. Q
n
(
, ) and L
n
are continuously dierentiable w.r.t.
for every .
3. Q
n
(
, ) is strictly concave in
for every .
4. Q
n
(
0
, ) attains its maximum at a unique point
0
= T() for every .
5. The map T is continuous.
Dene
j
recursively as
j
= T(
j1
) given an arbitrary initial guess
0
.
Then every convergent subsequence of
j
converges to a critical point of L
n
.
Proof. Let j
k
be a sequence such that
j
k
as k . As T
is continuous, we nd that
j
k
+1
= T(
j
k
) T(
). In particular, as the
likelihood is continuous and is nondecreasing with respect to T (lemma 6.10),
L
j
k
n
L
j
k
+1
n
L
j
k+1
n
j
L
n
L
T(
)
n
L
n
.
Therefore L
n
= L
T(
)
n
. We claim that this implies that
= T(
).
110 7 Statistical Inference: Consistency
Indeed, suppose that T() ,= . As Q
n
(
= T(). Therefore Q
n
(T(), ) > Q
n
(, ) = 0,
and L
T()
n
> L
n
by lemma 6.10. Conversely, L
T()
n
= L
n
must imply T() = .
It remains to show that every xed point of the map T is a criti-
cal point of the likelihood. Note that as Q
n
(
, ) is continuously dier-
entiable, its derivatives with respect to
Q
n
(
, )[
=
= 0. We claim
that
Q
n
(
, )[
=
= log L
n
. Indeed, for xed , the function
f(
) := log L
n
log L
n
Q
n
(
, ) is continuously dierentiable, f(
) 0 for
all
= is a minimum of f(
),
and as is an open set and f is continuously dierentiable this implies that
0 = f() = log L
Q
n
(
, )[
=
. This establishes the claim. .
The assumptions of this simple result are far from the weakest possible,
but the statement is fairly representative of the type of convergence that can
be established for the EM algorithm. The assumptions are not dicult to
verify for a slightly simplied form of the the model of proposition 6.11 where
the observation variance v is presumed to be known and xed (problem 7.5).
Problems
7.1. Ces`aros theorem
Prove Ces`aros theorem: if x
n
is a sequence of real numbers that converges
x
n
x as n , then n
1
n
k=0
x
k
x as n also.
7.2. Relaxing Stationarity
The mixing assumption on P
. The
assumption that
for every .
(Hint: use lemma 5.2 and the Banach xed point theorem.)
(b) Show that (P
)
k
(A)
(A)[ c
3
|
| for all ,
.
7.3. Identiability: Finite Signal and Observation State Spaces
Suppose that the signal and observation state spaces E = 1, . . . , d and
F = 1, . . . , d
and a reason-
ably large time horizon n. Before we compute condence intervals on the basis
of observed data, let us simulate the exact distribution of the maximum like-
lihood estimate as a benchmark. Note that in reality this distribution is not
computable: after all,
n
for each path. Plot a histogram of the distribution of
n
.
Now simulate a single sample path Y
0
, . . . , Y
n
of the observations under the
true model parameter
n
()/d
2
)
1
[
=
n
. Obtain an expression for this quantity and compute
it for the observed path. Plot the resulting Gaussian distribution and compare
with the histogram obtained in part (a).
A dierent method to obtain approximate condence intervals is the paramet-
ric bootstrap. This works as follows. First, compute the maximum likelihood
estimate
n
on the basis of the observations. Next, repeat part (a) of this
problem under the assumption that
n
is the true model parameter value.
Note that this procedure does not depend on the actual parameter value
.
As
n
is close to
for large n.
(c) Compute the parametric bootstrap distribution given our observed path.
Compare with the exact and approximate distributions in parts (a) and (b).
7.5. Convergence of the EM Algorithm
Verify that the assumptions in proposition 7.18 for convergence of the EM
algorithm are satised for a simplied form of the the model of proposition
6.11 where the observation variance v is known and xed.
112 7 Statistical Inference: Consistency
Notes
The rst proof of consistency and asymptotic normality of the maximum
likelihood estimator for hidden Markov models was given by Baum and Petrie
[BP66] for the case where the signal and observation state spaces are both
nite. Remarkably, it took almost three decades for this result to be extended
to more general models. Leroux [Ler92] was the rst to prove consistency
for a nite signal state space but general observation state space. Bickel,
Ritov and Ryden [BRR98] subsequently proved asymptotic normality in this
setting. Meanwhile, Mevel [Mev97] developed a dierent approach based on
the ergodic properties of the lter. For the case where the signal state space is
not nite, Jensen and Petersen [JP99], Douc and Mathias [DM01], and Douc,
Moulines and Ryden [DMR04] prove consistency and asymptotic normality
under slightly weaker conditions than we have imposed in this chapter.
Our proof of consistency is close in spirit, but does not follow directly any
of the above references. The LLN used in our proof is extremely primitive; we
could have easily used the standard ergodic theorems of Birkho or Kingman
(see, e.g., [Kal02]), but the proofs of these results are much more complicated.
The proof of our LLN utilizes a simple device due to Etemadi [Ete81] to
strengthen the trivial mean square convergence to almost sure convergence.
Our proof of identiability appears to be new.
The basic approach to proving consistency and asymptotic normality out-
lined in this chapter, and used in the above references, is essentially the clas-
sical approach (see [van98]) for the analysis of maximum likelihood estimates.
A modern approach uses empirical process theory to establish uniform laws
of large numbers and uniform central limit theorems for the likelihood. Such
methods do not require a compact parameter space, but instead impose en-
tropic bounds on the complexity of the model class [van00]. It remains an open
problem to adapt this much more general approach to hidden Markov models:
the fact that hidden Markov model observations are not i.i.d. complicates the
application of empirical process theory. Another open problem is to weaken
the strong mixing condition on the signal in the case of a general signal state
space. The general setting is not yet entirely understood; in particular, at
present the known results for a nite state space are more general than can
be obtained by applying the general theory.
The analysis of the model order estimation problem requires us to study
the rate of convergence of the likelihood function. Some results in this direction
can be found, e.g., in Mevel and Finesso [MF04] and in Gerencser and Molnar-
Saksa [GMS03]. These results do not appear to be suciently strong to prove
consistency of penalized likelihood methods. In the setting where the signal
and observation state spaces are nite, Gassiat and Boucheron [GB03] prove
consistency of a penalized likelihood method for model order estimation using
a particular penalty. This result and previous results following initial work
of Finesso [Fin90] are reviewed in [CMR05, chapter 15]. Recent results in a
setting where the observation state space is not nite can be found in [CGG08].
7.3 Advanced Topics 113
Using the full likelihood functions for model order selection is often overkill,
however. It is often sucient to consider quasi-likelihood type functions, as
suggested by Ryden [Ryd95]. The idea is that when the signal state space
is nite, the marginal law of a single observation Y
k
is a nite mixture of
observation densities. One can then use estimators of the form
d
n
= argmax
d0
_
sup
d
1
n
n
k=0
log g
(Y
k
) (n, d)
_
,
where g