13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

186

• Smoothing - Estimating the past values of the state given the observations

Filtering and smoothing are similar, but not the same. Perhaps the best way to think of the

difference is that with smoothing we are really wanting to understand what has happened to

states in the past given our current knowledge, whereas with filtering we really want to know

what is happening with the state right now.

In this chapter we are going to discuss the theory of the state space model and how we can

use the Kalman Filter to carry out the various types of inference described above. We will then

apply it to trading situations such as cointegrated pairs later in the book.

A Bayesian approach will be utilised for the problem. This is the statistical framework

that allows updates of beliefs in light of new information, which is precisely the desired behaviour

sought from the Kalman Filter.

I would like to warn you that state-space models and Kalman Filters suffer from an abundance

of mathematical notation, even if the conceptual ideas behind them are relatively straightforward.

I will try and explain all of this notation in depth, as it can be confusing for those new to

engineering control problems or state-space models in general. Fortunately we will be letting

Python do the heavy lifting of solving the model for us, so the verbose notation will not be a

problem in practice.

13.1 Linear State-Space Model

Let us begin by discussing all of the elements of the linear state-space model.

Since the states of the system are time-dependent we need to subscript them with t. We will

use θ t to represent a column vector of the states.

In a linear state-space model we say that these states are a linear combination of the prior

state at time t − 1 as well as system noise (random variation). In order to simplify the analysis

we are going to suggest that this noise is drawn from a multivariate normal distribution. Other

distributions can be used for alternative models but they will not be considered here.

The linear dependence of θ t on the previous state θ t−1 is given by the matrix G t , which can

also be time-varying (hence the subscript t). The multivariate time-dependent noise is given by

w t . The relationship is summarised below in what is often called the state equation:

θ t = G t θ t−1 + w t (13.1)

This equation is only half of the story. We also need to discuss the observations–what we

actually see–since the states are hidden to us.

We can denote the time-dependent observations by y t . The observations are a linear combination

of the current state and some additional random variation known as measurement noise,

which is also drawn from a multivariate normal distribution.

If we denote the linear dependence matrix of θ t on y t by F t (also time-dependent) and the

measurement noise by v t we have the observation equation:

y t = F T t θ t + v t (13.2)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!