State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
State Space Representations
Schematic
Examples
David N. DeJong
University of Pittsburgh
Spring 2008; Revised Spring 2010
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
Notation
State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
Schematic
st : state variables
yt : observed variables
Yt : fyj gtj=1
Note: variables are expressed in levels (detrended when
appropriate)
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
State Space Representations
DND
State-transition equation:
Notation
s t = γ ( st
1 , Yt 1 , υt )
Likelihood
Evaluation and
Filtering
Schematic
Associated density:
Examples
f ( st j s t
1 , Yt 1 )
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
Measurement equation:
yt = δ (st , Yt
1 , ut )
Associated density:
f (yt jst , Yt
Initialization:
f ( s0 )
1)
Likelihood Evaluation and Filtering
State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
Schematic
I
Filtering objective: construct f (st jYt ) , which can
then be used to approximate Et (h(st )jYt ) .
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
I
Likelihood evaluation obtains as a by-product of the
…ltering process.
State Space Reps
Likelihood Evaluation and Filtering, cont.
DND
Notation
I
From Bayes’theorem, f (st jYt ) is given by
f (st jYt ) =
I
I
f (yt jst , Yt 1 ) f (st jYt
f (yt , st jYt 1 )
=
f (yt jYt 1 )
f (yt jYt 1 )
where f (st jYt
f (st jYt
1)
Likelihood
Evaluation and
Filtering
=
1)
Z
and f (yt jYt
1)
f (yt jYt
1)
1)
is given by
,
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
f ( st j st
1 , Yt 1 ) f
( st
1 jYt 1 ) dst 1 ,
is given by
=
Z
f (yt jst , Yt
1) f
(st jYt
1 ) dst .
State Space Reps
Schematic of the Filtering Process
Taking f (st 1 jYt 1 ) as given, initialized with
f (s0 jY0 ) f (s0 ), …ltering and likelihood evaluation proceed
recursively:
I
Prediction: f (st 1 jYt 1 ) combines with
f (st jst 1 , Yt 1 ) to yield
f (st jYt
I
=
f ( s t j st
Forecasting: f (st jYt
to yield
f (yt jYt
I
1)
Z
1) =
Z
1)
1 , Yt 1 ) f
( st
1) f
Schematic
1 jYt 1 ) dst 1
(st jYt
1 ) dst .
f (yt jst , Yt 1 ) f (st jYt
f (yt jYt 1 )
1)
! (4)
1)
! (5)
Updating: Bayes’Rule yields
f (st jYt ) =
Notation
Likelihood
Evaluation and
Filtering
Examples
combines with f (yt jst , Yt
f (yt jst , Yt
DND
! (3)
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
Schematic, cont.
State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
One-Tree Model
DND
Notation
Recall that with pt representing epgtt , etc., the model is
"
#
γ
ct + 1
(1 γ )g
pt = βe
Et
(dt +1 + pt +1 )
ct
ct
dt
qt
State:
Shocks:
Controls:
= dt + qt
= de ωdt , ω dt = ρd ω dt
= qe ωqt , ω qt = ρq ω qt
st = [dt qt ]0
υt = [εdt εqt ]0
ct = [ct pt ]0
Likelihood
Evaluation and
Filtering
Schematic
(1)
(2)
+ εdt,
1 + εqt .
1
(3)
(4)
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
One-Tree Model, cont.
DND
I
State-transition equations:
ln dt
ln qt
I
I
= (1
= (1
+ εdt,
ρq ) ln q + ρq ln qt 1 + εqt ,
υt
[εdt εqt ]0 iidN (0, Συ ) .
Thus the state-transition density f (st jst
N (0, Συ ) .
Measurement equations:
ct
pt
dt
I
ρd ) ln d + ρd ln dt
Notation
Likelihood
Evaluation and
Filtering
1
Schematic
Examples
1 , Yt 1 )
is
The Kalman Filter
= dt + qt + uct
= p (dt , qt ) + upt
= dt ,
ut
[uct upt ]0 iidN (0, Σu ) .
Note that the measurement density f (yt jst , Yt
partially degenerate.
One-Tree Model
RBC Model
Generic Linear State
Space Representation
1)
is
State Space Reps
RBC Model
DND
Notation
1
ϕ
ϕ
ct
lt
= (1
ctκ ltλ = βEt f g
yt
yt
1+
g
1
= zt ktα nt1
= ct + it
kt +1 = it + (1
α
kt
nt
α)zt
Likelihood
Evaluation and
Filtering
α
(5)
(6)
α
(7)
where κ = ϕ(1
φ)
= (1
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
(8)
δ)kt
(9)
1 = nt + lt
log zt
Schematic
Examples
(10)
ρ) log(z0 ) + ρ log zt
1 and λ = (1
ϕ)(1
φ ).
1
+ ε(11)
t,
State Space Reps
RBC Model
DND
Notation
Likelihood
Evaluation and
Filtering
Schematic
Examples
f g=
(
1+
κ
g
1
α
"
ctκ+1 ltλ+1 αzt +1
One-Tree Model
RBC Model
nt +1
kt +1
1 α
+ (1
δ)
#)
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
RBC Model, cont.
DND
Notation
A policy function c (k, z ) can be obtained by combining (5),
(6) and (10) to eliminate (l, n) . Given c (k, z ), policy
functions for (l, n, y , i ) obtain from simple algebra. The
state-transition equations are then
I
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
1+
g
1
α
kt +1 = i (kt , zt ) + (1
log zt
I
Likelihood
Evaluation and
Filtering
= (1
δ)kt
ρ) log(z0 ) + ρ log zt
1
+ εt .
Note that the transition density is partially degenerate.
State Space Reps
RBC Model, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Observation equations:
Schematic
Examples
yt
ct
it
nt
ut
N (0, Σu ) .
=
=
=
=
zt ktα n(kt , zt )1
c (kt , zt ) + uct
i (kt , zt ) + uit
n(kt , zt ) + unt ,
α
+ uyt
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
Generic Linear State Space Rep.
State Space Reps
DND
Notation
I
Likelihood
Evaluation and
Filtering
State-transition equations:
Schematic
= Fxt 1 + et ,
et = G υ t ,
E (et et0 ) = GE υt υt0 G 0 = Q.
xt
I
Measurement equations:
Xt = H 0 xt + ut ,
I
Eut ut0 = Σu
Note: xt in general contains state variables st and
control variables; Xt is directly analagous to yt .
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
The Kalman Filter.
DND
Notation
Likelihood evaluation and …ltering is achieved in the
linear-normal case via the Kalman …lter. Given
linearity/normality, targeted densities are fully characterized
by means and covariance matricies.
Pt jt
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
Notation:
xt j t
Likelihood
Evaluation and
Filtering
j
= E [xt j fX1 , ..., Xt j g],
= E ( xt
j = 0, 1.
j
xt jt
j )(xt
xt jt
j)
0
,
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Background I: Linear Projections
P
x j|{z}
X
|{z}
nx 1
mx 1
!
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
0
= |{z}
a |{z}
X
nxm
The Kalman Filter
mx 1
= E [x jX ] given lin/norm,
where
a = arg min E
h
x
a0 X
2
i
The Kalman Filter, cont.
State Space Reps
DND
Notation
FONC for a (Normal Equations/Orthogonality Conditions):
E
x
a0 X X 0 = 0
Likelihood
Evaluation and
Filtering
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
! E xX 0 = a0 E XX 0
! a0 = ExX 0 (E XX 0 ) 1
! b
x = ExX 0 (E XX 0 ) 1 X
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Background II: Updating
Schematic
Examples
P (x j fXt , Xt
0
P @x
|
1 , ...g)
One-Tree Model
RBC Model
Generic Linear State
Space Representation
= P (x j fXt 1 , ...g)+
|
{z
}
old forecast
P (x j fXt
{z
1 , ...g) jXt
forecast error
}|
P (Xt j fXt
{z
1
1 , ...g ) A
new information
}
The Kalman Filter
The Kalman Filter, cont.
State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
Kalman Filter I: Initialization f (s0 ) , or x1 j0 , P1 j0
Unconditional mean:
Ext
= FExt 1 = FExt
! (I F ) Ext = 0
! Ext x1 j0 = 0
Schematic
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Unconditional VCV:
Schematic
Examples
E x1 j0 x10 j0
P1 j0
= E (Fxt 1 + et ) (Fxt 1 + et )0
= F E xt 1 xt0 1 F 0 + E et et0
= FP1 j0 F 0 + Q
Thus
vec (P1 j0 ) = (I
F
F 0)
1
vec (Q )
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
The Kalman Filter, cont.
DND
Kalman Filter II: Forecasting
f (yt jYt 1 ) , or Xt jt 1 , Ωt jt 1
Given xt jt 1 , Pt jt 1 (initially x1 j0 , P1 j0 ):
Notation
Likelihood
Evaluation and
Filtering
I
I
Xt jt
MSE:
Ω t jt
1
= H 0 xt jt
Schematic
1
Examples
20
1
1
6B
C
6B
C
6B 0
C 0
B
= E6
H xt
xt jt 1 + ut C
6BH |xt {z
|{z} C
}
6B
C
4@ Prediction error Mea. err.A
|
{z
}
h
Forecasting error
= E H 0 xt
= H 0 Pt jt
One-Tree Model
RBC Model
Generic Linear State
Space Representation
1H
xt jt
+ Σu
1
xt
xt jt
1
0
H + ut ut0
The Kalman Filter
xt jt
i
1
3
7
7
07
+ ut 7
7
7
5
State Space Reps
The Kalman Filter, cont.
DND
Notation
Kalman Filter III: Updating f (st jYt ) , or xt jt , Pt jt
I
Using the updating equation from Background II:
xt jt = xt jt
I
Likelihood
Evaluation and
Filtering
1
+E
xt
xt jt
1
j Xt
Schematic
Xt jt
1
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
Using the Normal Equations from Background I:
E
0
xt
B
BE Xt
@|
xt jt
1
Xt jt
j Xt
Xt
1
{z
Ω t jt
1
Xt jt
= E xt
|
1
Xt jt
1
1
0C
C
}A
xt jt
1
E Xt
1
{z
P t jt
Xt jt
Xt
1H
1
The Kalman
0 Filter
Xt jt
1
}
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Kalman Filter III: Updating, cont.
Schematic
I
Thus
Examples
xt jt
I
=
MSE:
Pt jt = E
One-Tree Model
RBC Model
Generic Linear State
Space Representation
xt jt 1 + Pt jt 1 HΩt jt1 1
Xt H 0 xt jt 1
h
xt
xt jt
xt
xt jt
The Kalman Filter
0
i
State Space Reps
The Kalman Filter, cont.
DND
Kalman Filter III: Updating, cont.
Notation
Pt jt
h
= E
2
xt
6
= E6
4|xt
E xt
|
|
E Xt
E Xt
|
= P
xt jt
xt
xt jt
1
xt j t
xt
{z
P t jt
xt jt
1
{z
P t jt
Xt jt
1
Xt
Xt jt
1
1H
1
1
{z
H 0 P t jt
P
xt jt
1
Xt
{z
Ωt jt1
Xt jt
0
i
Xt jt
xt jt
1
1
HΩ
3
1
H 0P
Schematic
07
7
}5
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
0
}
1
1
xt
Likelihood
Evaluation and
Filtering
0
}
0
1
}
State Space Reps
The Kalman Filter, cont.
DND
Kalman Filter IV: Prediction
f (st +1 jYt ) , or xt +1 jt , Pt +1 jt
I
Plugging xt jt into the state equation:
xt +1 jt
Schematic
= Fxt jt
= Fxt jt
Xt
I
Notation
Examples
1
+ FPt jt
H 0 xt jt
1
1 HΩt jt 1
1
MSE:
Pt +1 jt
= E (xt +1 xt +1 jt )(xt +1 xt +1 jt )0
h
i
0
= E Fxt + et +1 Fxt jt Fxt + et +1 Fxt jt
h
i
0
= FE xt xt jt xt xt jt F 0 + E et +1 et0 +1
= FPt jt F 0 + Q
Likelihood
Evaluation and
Filtering
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
The Kalman Filter, cont.
DND
Notation
Summary (means and covariances)
I
I
I
Initialization:
x1 j0 = 0, vec (P1 j0 ) = (I
Likelihood
Evaluation and
Filtering
F 0)
F
1 vec (Q )
Schematic
Examples
H 0 xt jt 1 ,
Forecasting: Xt jt 1 =
Ωt jt 1 = H 0 Pt jt 1 H + Σu
One-Tree Model
RBC Model
Generic Linear State
Space Representation
Updating:
The Kalman Filter
xt jt
= xt jt
Xt
Pt jt = Pt jt
1
1
+ Pt jt
H 0 xt jt
Pt jt
1
1 HΩt jt 1
1
,
1
0
1 HΩt jt 1 H Pt jt 1
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
I
Prediction:
Schematic
Examples
xt +1 jt
= Fxt jt
= Fxt jt
Xt
Pt +1 jt
1
+ FPt jt
0
H xt jt
0
= FPt jt F + Q
1
1
1 HΩt jt 1
,
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
The Kalman Filter, cont.
State Space Reps
DND
Notation
Likelihood
Evaluation and
Filtering
Schematic
Examples
Code:
I
kalman.prc
I
kalmanm.prc
( Σu = 0)
( Σu 6 = 0)
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
State Space Reps
The Kalman Filter, cont.
DND
Notation
Likelihood
Evaluation and
Filtering
Exercise:
Schematic
Consider the AR(p) representation for a generic variable yt :
yt = ρ1 yt
1
+ ρ2 yt
2
+ ... + ρp yt
p
+ εt .
Examples
One-Tree Model
RBC Model
Generic Linear State
Space Representation
The Kalman Filter
I
Map this into the form of a state-space representation.
I
Generate arti…cial data using the model as a DGP.
I
Show that OLS estimates and ML estimates of ρ(L)
coincide.
© Copyright 2026 Paperzz