0% found this document useful (0 votes)
30 views9 pages

State Space

The document discusses state space models and the Kalman filter, focusing on their application in dynamic time series analysis with unobserved variables. It provides examples of time-varying parameter models and unobserved component models, detailing the measurement and transition equations. Additionally, it covers the Kalman filter's recursive procedure for estimating unobserved state vectors and addresses identification problems in unobserved component models.

Uploaded by

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

State Space

The document discusses state space models and the Kalman filter, focusing on their application in dynamic time series analysis with unobserved variables. It provides examples of time-varying parameter models and unobserved component models, detailing the measurement and transition equations. Additionally, it covers the Kalman filter's recursive procedure for estimating unobserved state vectors and addresses identification problems in unobserved component models.

Uploaded by

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

Lecture Notes on State Space Model

N. Kundan Kishor

1 State space models & Kalman filter


State space models typically are associated with dynamic time series models
with unobserved variables.

Example 1: Time-varying parameter model, i.e.

yt =β0t + β1t x1t + · · · + βkt xkt + et


et ∼iidN(0, R)
βit =βit−1 + νit
νit ∼iidN 0, σν2i ,


and usual regression models have fixed βs. Here β is time-varying and all
other assumptions of OLS hold.
GLS can be applied to this model but it is computationally intensive.

Example 2: Unobserved component model, i.e.

yt = ln GDPt
= τt + ct ,
|{z} |{z}
trend cycle

and both trend & cycle are unobserved. What is observable is yt and what
is unobservable is τt and ct , i.e.

τt =µ + τt−1 + νt , ν ∼ iid 0, σν2 , i.e. a random walk with a drift




ct =φ1 ct−1 + φ2 ct−2 + εt , εt ∼ iid 0, σε2 , i.e. stationary AR(2) cycle.




59
1.1 Two equations in state space framework
• Measurement equation: Expresses observed variable as a linear function
of unobserved variables
yt = Ht βt + Azt + et , et ∼ iid(0, R).

• Transition equation (or state equation): Expresses unobserved variables


as a linear function of its own past values
βt = µ + F βt−1 + νt , νt ∼ iid(0, Q),
and where zt is an exogenous variable & is known. βt is an unobservable
variable.
Example 2: Unobserved component model (cont’d),
yt =τt + ct
τt =µ + τt−1 + νt
ct =φ1 ct−1 + φ2 ct−2 + εt ,
and hence, the measurement equation is
 
 τt
yt = 1 1 0  ct 
ct−1
=Ht βt , zt = et = 0,
and the transition equation is
        
τt µ 1 0 0 τt−1 νt
 ct  =  0  + 0 φ1 φ2  ct−1  + εt 
ct−1 0 0 1 0 ct−2 0
βt =µ + F βt−1 + νt .
In the time-varying parameter model,
yt =β0t + β1t x1t + β2t x2t + et
νt ∼ iid 0, σν2i .

βit =βit−1 + νit , i ∈ {0, 1, 2},
Measurement equation is
 
 β0t
yt = 1 x1t x2t β1t  + et = Ht βt + et .
β2t
Transition equation is
      
β0t 1 0 0 β0t−1 ν1t
 β1t  = 0 1 0 β1t−1  + ν2t  .
β2t 0 0 1 β2t−1 ν3t

60
1.2 Kalman filter

Kalman filter: Recursive procedure for computing the optimal estimate


of the unobserved state vector βt based on the appropriate information set
& the parameters of the model, t ∈ {1, · · · , T }. Kalman filter provides is
an estimate of βt|t = E [βt |Ψt ] where Ψt is the information set at time t.
Sometimes, one also uses smoothed estimate of βt , i.e. βt|T = E [βt |ΨT ],
where T is the full sample size.

1.2.1 Notation
h  ⊤ i
Pt|t =E βt − βt|t βt − βt|t , state variance
yt|t−1 =E [yt |Ψt−1 ]
ηt|t−1 =yt − yt|t−1 , prediction error for measurement equation
h i

ft|t−1 =E ηt|t−1 ηt|t−1 , variance of prediction error.

Prediction is

βt|t−1 =µ + F βt−1|t−1
Pt|t−1 =F Pt−1|t−1 F ⊤ + Q
ηt|t−1 =yt − yt|t−1 = yt − Ht βt|t−1 − Azt
ft|t−1 =Ht Pt|t−1 Ht⊤ + R,

where R is the variance of measurement equation error.


Updating is

βt|t =βt|t−1 + kt ηt|t−1


Pt|t =Pt|t−1 − kt Ht Pt|t−1 ,
−1
and where kt is called as Kalman gain and kt = Pt|t−1 Ht⊤ ft|t−1 . kt determines
the weight assigned to the new information about βt contained in the prediction
error ηt|t−1 .
Digression:
     
z1t µ1 σ σ12
given Ψt−1 ∼MVN , 11 ,
z2t µ2 σ12 σ22

z1t |z2t given Ψt−1 ∼N µ1|2 , σ11|2
−1
µ1|2 =µ + σ12 σ22 (z2t − µ2 )
−1
σ11|2 =σ11 − σ12 σ22 σ12 .

z1t = βt , z2t = ηt|t−1 , µ1 = βt|t−1 , σ11 = Pt|t−1 , σ22 = ft|t−1 , σ12 =


Pt|t−1 Ht⊤ .

61
Note that kt is the weight assigned to ηt|t−1 in updating βt|t . Higher the
uncertainty in βt|t−1 , more weight (kt ) is assigned to ηt|t−1 (Pt|t−1 : the uncer-
tainty in βt|t−1 ). Higher the uncertainty in ηt|t−1 , lower the weight assigned to
ηt|t−1 (ft|t−1 : the uncertainty in ηt|t−1 ).
What one must estimate for this model is µ, F , Q, R and A and the initial
β0|0 and P0|0 .

2 Kalman filter and prediction


Prediction:

βt|t−1 =µ + F βt−1|t−1
Pt|t−1 =F Pt−1|t−1 F ⊤ + Q
ηt|t−1 =yt − yt|t−1
=yt − Ht βt|t−1 − Azt
ft|t−1 =Ht Pt|t−1 Ht⊤ + R.

Updating:

βt|t =βt|t−1 + kt ηt|t−1


Pt|t =Pt|t−1 − kt Ht Pt|t−1 ,
−1
where kt is the Kalman gain Pt|t−1 Ht⊤ ft|t−1 .

Since ηt|t−1 ∼ N 0, ft|t−1 , use this property of prediction to form likelihood
and get the MLEs of µ, F , Q, R & Ht . And then estimate the state variable βt
and here we need initial value of β0|0 & P0|0 .
For stationary transition equation, we can use unconditional mean & uncon-
ditional variance of βt . So

βt =µ + F βt−1 + νt
E [βt ] =µ + F E [βt−1 ] ,

and at the steady state,

β0|0 =µ + F β0|0
−1
= (I − F ) µ

P0|0 =F P0|0 F
+Q


note that Vec(ABC) = C ⊗ A Vec(B)
Vec P0|0 =Vec F P0|0 F ⊤ + Vec(Q)
 

=(F ⊗ F )Vec P0|0 + Vec(Q)
=[I − (F ⊗ F )]−1 Vec(Q),

62
and hence we can use these unconditional moments in the case of stationary
state variables.
Measurement equation:
yt = Ht βt + Azt + et , et ∼ iidN(0, R).
Transition equation:
βt = µ + F βt−1 + νt , νt ∼ iidN(0, Q).
In case of non-stationary state variables, we can’t use unconditional mean
and variance as the initial value. Here, β0|0 can be any arbitrary guess & P0|0
can be high numbers to reflect the high uncertainty about β0|0 .
Calculate β0|0 & P0|0 for a stationary AR(2) model as,
yt = µ + φ1 yt−1 + φ2 yt−2 + νt , νt ∼ iidN 0, σν2 .


Transition equation:
        
yt µ φ1 φ2 yt−1 ν
= + + t
yt−1 0 1 0 yt−2 0
βt =µ + F βt−1 + νt
β0|0 =(I − F )−1 µ
 −1  
1 − φ1 −φ2 µ
=
−1 1 0
 µ 
= 1−φµ1 −φ2
1−φ1 −φ2
 −1
Vec P0|0 = (I − F ⊗ F ) Vec(Q)
−1  2 
1 − φ22 −φ1 φ2 −φ1 φ2 −φ22

σν
 −φ1 1 −φ2 0  0
= −φ1
  .
−φ2 1 0  0
−1 0 0 1 0
βt|t is the filtered estimate of βt . It uses only information until time period
t and does not use information from future. Thus, βt|t is one-sided-filtered
estimate of βt .
In some applications, full-sample information is needed to smooth out the
noise in one-sided-filtered estimate of βt .
If we use information from full sample, we say that we have a smoothed
estimate of βt , i.e. for t ∈ {1, · · · , t, · · · , T }, βt|t is the filtered estimate of βt
and βt|T is the smoothed estimate of βt that uses information from the full
sample.
Smoothing:
−1
βt|T =βt|t + Pt|t F ⊤ Pt+1|t

βt+1|T − F βt|t − µ
−1
 −1
Pt|T =Pt|t + Pt|t F ⊤ Pt+1|t Pt+1|T − Pt+1|t Pt+1|t ⊤
F Pt|t .

63
βT |T & PT |T are the initial values for the smoothing and are obtained from
the last iteration of the basic filter. So one can go from the last observation to
the first observation in order to find the smoothed estimates.

3 Identification problems in unobserved compo-


nent models

yt = y1t + y2t
|{z} |{z}
RW WN
e1t ∼ iid 0, σ12

y1t =y1t−1 + e1t ,
∼ iid 0, σ22

y2t =e2t , e2t
Cov [e1t , e2t ] =σ12 .

Reduced form version:

∆yt =∆y1t + ∆y2t


=e1t + e2t − e2t−1
ε1t ∼ iid 0, σε2 .

≈ε1t + θε1t−1 ,

Since this reduced form version has only two parameters (θ, σε2 ), the struc-
tural model cannot be identified because the structural model involves three
parameters (σ12 , σ12 , σ22 ). If σ12 = 0, then this UC model is identified.

3.1 Clark’s unobserved component model

yt = ln GDPt
=τt + ct
νt ∼ iid 0, σν2

τt =µ + τt−1 + νt ,
et ∼ iid 0, σe2 .

ct =φ1 ct−1 + φ2 ct−1 + et ,

Clark argued that to identify this UC model we need Cov [νt , et ] = σνe = 0.
Shocks to permanent component & shocks to transitory component are uncor-
related with each other.
Morley, Nelson and Zivot (2003) argued that the UC model is still identified
if σνe ̸= 0 & in fact, they show that the restriction σνe = 0 is rejected by data
in case of U.S. GDP.
In Clark’s UC model, the total number of parameters to be estimated is 5
and the restriction imposed there is σeν = 0.
Reduced form representation:

∆yt =∆τt + ∆ct


=µ + νt + (1 − L)ct ,

64
−1
and we know that ct = φ1 ct−1 + φ2 ct−2 + et = 1 − φ1 L − φ2 L2 et . Thus,
−1
∆yt =µ + νt + (1 − L) 1 − φ1 L − φ2 L2 et
2 2
1 − φ1 L − φ2 L ∆yt =µ 1 − φ1 L − φ2 L + νt 1 − φ1 L − φ2 L2 + (1 − L)et
  

=µ∗ + νt − φ1 νt−1 − φ2 νt−2 + et − et−1


≈µ∗ + εt + θ1 εt−1 + θ2 εt−2 , εt ∼ iid 0, σε2 .


Since the process ∆yt follows ARMA(2,2), there are 6 parameters to be


estimated (2 ARs, 2 MAs, intercept and sigma). So, from ARMA(2,2), one can
identify Clark’s UC model (5 parameters) fully and even can test whether the
imposed condition σνe = 0 is an overidentification or not.

4 Unobserved component models


Clark’s classical UC model assumed correlation between shock to the permanent
components & shock to transitory component are uncorrelated, i.e.

yt =τt + ct
νt ∼ iid 0, σν2

τt =µ + τt−1 + νt ,
et ∼ iid 0, σe2

ct =φ1 ct−1 + φ2 ct−2 + et ,
Cov [et , νt ] =0, for Clark’s model
̸=0, for MNZ model.

It was shown by MNZ that Cov [et , νt ] = 0 is not required for the identifica-
tion of the UC model. In fact, this covariance can be estimated.

5 Dynamic factor model


There are 3 countries. π f is the inflation in France, π g is the information in
Germany and π i is the information in Italy, respectively. Then

π g =γ1 ct + η1t
π f =γ2 ct + η2t
π i =γ3 ct + η3t
where ct =common European factor
γi =the loading on that factor
ηi =the idiosyncratic factors.

Identification condition: Either normalize the loadings on one of the coun-


tries to be equal to one or normalize the variance of the common component to
a constant.

65
Suppose, we normalize the variance of the common component,

ct = βct−1 + νt , νt ∼ iid(0, 1) ← normalized variance.

Suppose idiosyncratic factors follow AR(2) process, then

η1t =φ11 η1t−1 + φ12 η1t−2 + e1t


η2t =φ21 η2t−1 + φ22 η2t−2 + e2t
η3t =φ31 η3t−1 + φ32 η3t−2 + e3t
eit =iidN 0, σe2i , i ∈ {1, 2, 3}.


Measurement equation:
 
ct
  η1t 
 
πg
  
γ1 1 0 0 0 0 0  η
 1t−1 

π f  = γ2 0 0 1 0 0 0  η
 2t  .

πi γ3 0 0 0 0 1 0  η
 2t−1 

 η3t 
η3t−1
Transition equation:
      
ct β 0 0 0 0 0 0 ct−1 νt
 η1t   0 φ11 φ12 0 0 0 0  η1t−1  e1t 
      
η1t−1   0 1 0 0 0 0 0  η1t−2   0 
   
  
 η2t  =  0 0 0 φ21 φ22 0 0  η2t−1   + e2t  .
   
  
η2t−1   0 0 0 1 0 0 0  η2t−2   0
   
  
 η3t   0 0 0 0 0 φ31 φ32   η3t−1  e3t 
η3t−1 0 0 0 0 0 1 0 η3t−2 0
Note that,
Var [π g ] = γ12 Var [ct ] + Var [η1t ] ,
| {z } | {z }
unconditional unconditional
variance variance
i.e. share of common component in overall variance of inflation in Germany is
γ12 Var [ct ] γ12 Var [ct ]
g
= 2 .
Var [π ] γ1 Var [ct ] + Var [η1t ]

5.1 No break in trend mean

yt =τt + ct
νt ∼ iidN 0, σν2

τt =µ + τt−1 + νt ,
et ∼ iidN 0, σe2

ct =φ1 ct−1 + φ2 ct−2 + et ,
Cov [νt , et ] =0.

66
Measurement equation
 
 τt
yt = 1 1 0  ct  .
ct−1

Transition equation
        
τt µ 1 0 0 τt−1 νt
 ct  =  0  + 0 φ1 φ2  ct−1  + et  .
ct−1 0 0 1 0 ct−2 0

The roundabout approach to include µt = µ for all t in R package.


 
τt
  µt 
yt = 1 0 1 0   ct 

ct−1
      
τt 1 1 0 0 τt−1 νt
 µt  0 1 0 0  µt−1   0 
 ct  = 0 0 φ1 φ2   ct−1  + et  .
      

ct−1 0 0 1 0 ct−2 0

Notice: The initial value matters a lot. One has to be careful with this
feature.

67

You might also like