Professional Documents
Culture Documents
L11 - Forecasting and Smoothing Using The Kalman Filter - KH
L11 - Forecasting and Smoothing Using The Kalman Filter - KH
L11 - Forecasting and Smoothing Using The Kalman Filter - KH
Presenter
Central Bank of Algeria Kaddour Hadri
Macroeconomic Forecasting
L11, March 2, 2017
1
Roadmap
I. Introduction
II. The state space representation
III. The Kalman filter
IV. ML estimation and the Kalman filter
V. Forecasting and smoothing
VI. Concluding remarks
2
I. Introduction
• The dynamics of time series could be influenced
by the dynamics of a set of variables i.e. states.
• State space models describe the law of motion of
the states and their link with observations. The
Kalman filter is an algorithm to estimate it.
• Classical regression analysis would fail in terms of
validity of tests (t-test F-test…) and in terms of
forecasts if these states were unobservable and
persistent.
• State space representation encompasses the
standard models (e.g. ARMA).
3
II. State Space Representation
4
Diagram of a state space form
t-1 t time
Yt-1 Measurement Yt
equation Observed
Hidden
αt-1 αt
Transition State
equation variable
5
The state space representation 1/2
• A time series y is observed
• Suppose that y is explained by a set of
unobserved variables or state variables subject
to a measurement equation:
yt = Zt αt +εt , εt ~NID(0, Ht)
6
The state space representation 2/2
• It is also assumed that:
7
Hyper-Parameters
• In the state space model the parameters Ht Qt
Rt Tt Zt are referred to as “hyper-parameters”
and are unknown in general.
• The main task of the Kalman filter will be to
estimate these parameters.
• Contrary to standard regressions, there are no
analytical solutions and the estimation
requires an iterative procedure (maximum
likelihood).
8
Why a recursive algorithm is the
natural approach to state space forms?
• In a state space form the notion of forecasting
given different information sets appears naturally
(e.g. dynamic vs. one-step-ahead).
• Given information on the initial state (time t), it is
possible to construct a forecast of the state (time
t+1).
• Given the observation (time t+1), it is possible to
refine the estimate of the state (time t+1).
• Given initial conditions, the recursion could be
used for the estimation.
9
III. The Kalman filter
10
Filtering, predicting and smoothing?
• All these refer to the same concept i.e.
estimating the state vector.
• The difference between them is the set of
information used in the estimate:
Filtering is based on past observations and current
observations.
Predicting is based on past observations only.
Smoothing is based on all past and future
observations.
11
The Kalman filter
• The Kalman filter is a recursive procedure to
estimate the state vector of a state space form
given all past and current observations.
• Given an initial state vector (normality) and
hyper-parameters or transition matrices, the
Kalman filter computes recursively the
conditional distributions of the state vector.
• It has applications in engineering e.g. satellite
location.
12
Properties of the Kalman filter
• Under normality condition (initial state and
disturbances), the Kalman filter produces an
optimal estimator of the state vector
(minimum Mean Square Error).
• If normality is dropped the Kalman filter still
produces the optimal estimator in the class of
linear predictors.
13
Algorithm: schematic diagram
t t+1 time
16
Period t: prediction equations
• Given at and Pt the optimal estimator of αt+1
at+1|t=Ttat
19
The Kalman gain and updating
• The Kalman gain measures the uncertainty of
the state based on past observations relative
to the uncertainty of the new observation.
• It determines the influence of the prediction
error of yt+1|t on the estimate of the state at
time t+1.
• In time-invariant models the Kalman gain
converges to a constant simplifying the
calculation of steady-state Kalman filter.
20
IV. ML estimation
21
Estimation
• The Kalman filter is applied given the hyper-
parameters. But how do we estimate those?
24
V. Forecasting and smoothing
25
Forecasting
• A state space form is estimated (suppose time
invariant).
• Suppose the last observation occurs at T+1.
• The filtered state at time T+1 is updated:
aT+1=aT+1|T+KTvT
• The forecast for T+n is simply:
yT+n|T=Z(T)n-1 aT+1
26
Smoothing
• Recursive algorithms “state and disturbance
smoothers” are applied to the output of the
Kalman filter.
• The goal is to obtain an estimate of the state
vector taking into account all observations
(past and future).
• Could be applied to estimate potential GDP
for example.
27
VI. Concluding remarks
• The state space model/Kalman filter is a
powerful and flexible tool. It can be applied to
non-stationary time series.
• It handles difficult issues like time varying
coefficients and missing data relatively easily.
• The normality condition is important to
ensure optimality and there are methods to
verify it.
28