scieee Science in your language
[en] (orig)

On Bayesian filtering for Markov regime switching models

Author: Hashimzade, Nigar,Kirsanov, Oleg,Kirsanova, Tatiana,Maih, Junior
Publisher: Oslo: Norges Bank
Year: 2024
Source: https://www.econstor.eu/bitstream/10419/310426/1/1914936450.pdf
Hashimzade, Niga ; Ki sano , Oleg; Ki sano a, Ta iana; Maih, Junio
Wo king Pape
On Bayesian il e ing o Ma ko egime swi ching models
Wo king Pape , No. 8/2024
P o ided in Coope a ion wi h:
No ges Bank, Oslo
Sugges ed Ci a ion: Hashimzade, Niga ; Ki sano , Oleg; Ki sano a, Ta iana; Maih, Junio (2024) :
On Bayesian il e ing o Ma ko egime swi ching models, Wo king Pape , No. 8/2024, ISBN
978-82-8379-317-8, No ges Bank, Oslo,
h ps://hdl.handle.ne /11250/3172788
This Ve sion is a ailable a :
h ps://hdl.handle.ne /10419/310426
S anda d-Nu zungsbedingungen:
Die Dokumen e au EconS o dü en zu eigenen wissenscha lichen
Zwecken und zum P i a geb auch gespeiche und kopie we den.
Sie dü en die Dokumen e nich ü ö en liche ode komme zielle
Zwecke e iel äl igen, ö en lich auss ellen, ö en lich zugänglich
machen, e eiben ode ande wei ig nu zen.
So e n die Ve asse die Dokumen e un e Open-Con en -Lizenzen
(insbesonde e CC-Lizenzen) zu Ve ügung ges ell haben soll en,
gel en abweichend on diesen Nu zungsbedingungen die in de do
genann en Lizenz gewäh en Nu zungs ech e.
Te ms o use:
Documen s in EconS o may be sa ed and copied o you pe sonal
and schola ly pu poses.
You a e no o copy documen s o public o comme cial pu poses, o
exhibi he documen s publicly, o make hem publicly a ailable on he
in e ne , o o dis ibu e o o he wise use he documen s in public.
I he documen s ha e been made a ailable unde an Open Con en
Licence (especially C ea i e Commons Licences), you may exe cise
u he usage igh s as speci ied in he indica ed licence.
h ps://c ea i ecommons.o g/licenses/by-nc-nd/4.0/
Wo king Pape
On Bayesian Fil e ing o Ma ko Regime Swi ching Models
No ges Bank Resea ch
A
u ho s:
Niga Hashimzade
Oleg Ki sano
Ta iana Ki sano a
Junio Maih
K
eywo ds
Ma ko Swi ching models,
Fil e ing, Smoo hing
8 | 2024
No ges Bank Wo king Pape 1
Wo king pape s a No ges Bank, a 1992/1 il 2009/2 kan bes illes på e-
pos : se icesen e @no ges-bank.no
F a 1999 og sene e e publikasjonene ilgjengelige på www.no ges-bank.no
Wo king pape s inneholde o skningsa beide og u edninge som anlig is ikke
ha å sin endelige o m. Hensik en e blan anne a o a e en kan mo a
kommen a e a kollege og and e in e esse e. Synspunk e og konklusjone i
a beidene s å o o a e nes egning.
Wo king pape s om No ges Bank, om 1992/1 o 2009/2 can be o de ed
by e-mail: se icesen e @no ges-bank.no
Wo king pape s om 1999 onwa ds a e a ailable on www.no ges-bank.no
No ges Bank’s wo king pape s p esen esea ch p ojec s and epo s (no
usually in hei inal o m) and a e in ended in e alia o enable he au ho o
bene i om he commen s o colleagues and o he in e es ed pa ies. Views
and conclusions exp essed in wo king pape s a e he esponsibili y o he
au ho s alone.
ISSN 1502-8143 (online)
ISBN 978-82-8379-317-8 (online)
On Bayesian Fil e ing o Ma ko Regime Swi ching Models
Niga HashimzadeyOleg Ki sano zTa iana Ki sano axJunio Maih{
Ap il 17, 2024
Abs ac
This pape p esen s a amewo k o empi ical analysis o dynamic mac oeconomic models
using Bayesian …l e ing, wi h a speci…c ocus on he s a e-space o mula ion o Dynamic S o-
chas ic Gene al Equilib ium (DSGE) models wi h mul iple egimes. We ou line he heo e ical
ounda ions o model es ima ion, p o ide he de ails o wo amilies o powe ul mul iple- egime
…l e s, IMM and GPB, and cons uc co esponding mul iple- egime smoo he s. A simula ion
exe cise, based on a p o o ypical New Keynesian DSGE model, is used o demons a e he
compu a ional obus ness o he p oposed …l e s and smoo he s and e alua e hei accu acy
and speed o a selec ion o …l e s om each amily. We show ha he canonical IMM …l e
is as e and is no less, and o en mo e, accu a e han i s compe i o s wi hin IMM and GPB
amilies, he la e including he commonly used Kim and Nelson (1999) …l e . Using i wi h
he ma ching smoo he imp o es he p ecision in eco e ing unobse ed a iables by abou
25%. Fu he mo e, applying i o he U.S. 1947-2023 mac oeconomic ime se ies, we success-
ully iden i y signi…can pas policy shi s including hose ela ed o he pos -Co id-19 pe iod.
Ou esul s demons a e he p ac ical applicabili y and po en ial o he p oposed ou ines in
mac oeconomic analysis.
Keywo ds: Ma ko swi ching models, Fil e ing, Smoo hing
JEL Re e ence Numbe : C11, C32, C54, E52
This pape should no be epo ed as ep esen ing he iews o No ges Bank. The iews exp essed a e hose o
he au ho s and do no necessa ily e‡ec hose o No ges Bank. We hank he anonymous e e ee o he commen s
p o ided. All e o s emain ou s.
yDepa men o Economics and Finance, B unel Uni e si y, Uni ed Kingdom; e-mail: ni-
ga .hashimzade@b unel.ac.uk
zAdam Smi h Business School, Uni e si y o Glasgow, Uni ed Kingdom; e-mail: oleg.ki sano @glasgow.ac.uk
xAdam Smi h Business School, Uni e si y o Glasgow, Uni ed Kingdom; e-mail: a-
iana.ki sano [email protected]
{No ges Bank; e-mail Junio .Maih@no ges-bank.no
1
1 In oduc ion
In he e ol ing landscape o mac oeconomic analysis, he empi ical examina ion o dynamic
models has become inc easingly sophis ica ed and compu a ionally demanding. This pape con-
ibu es o his a ea by p esen ing a comp ehensi e amewo k o empi ical analysis o s a e
space models wi h mul iple egimes using Bayesian …l e ing. Ou wo k in oduces enhanced …l e
and smoo he algo i hms, c ucial o accu a e mac oeconomic modelling and es ima ion.
Ou s udy is mo i a ed by he inc easing popula i y o Bayesian me hods in mac oeconomic
ime se ies analysis in he Dynamic S ochas ic Gene al Equilib ium (DSGE) amewo k, usually
p esen ed in he s a e-space o m. These me hods ha e gained ac ion due o hei abili y o
e¤ec i ely handle complex models wi h la en a iables and s uc u al changes. Bayesian pe spec-
i e is in aluable o disen angling con olu ed mac oeconomic phenomena, such as di¤e en ia ing
be ween ex e nal shocks and policy-d i en economic pa e ns.
Despi e signi…can ad ancemen s in he li e a u e, he …eld con inues o ace a ious chal-
lenges, especially when es ima ing mac oeconomic dynamic models wi h mul iple egimes. One
such challenge is selec ing an e¢ cien and accu a e …l e o likelihood compu a ion. Ano he
challenge is he ask o econs uc ing la en a iables h ough he smoo hing o es ima ed s a e
a iables and egime p obabili ies.
The p e alen use o he Kim and Nelson (Kim, 1994, Kim and Nelson, 1999) …l e in mac o-
economic applica ions (see, in e alia, Da ig and Doh, 2014, Chang, Maih, and Tan, 2021, Chen,
Leepe , and Lei h, 2022) sugges s limi ed explo a ion o al e na i e me hods in his …eld. Despi e
i s unques ionable powe , Kim and Nelson …l e is known o ha e ce ain ‡aws. Namely, i is
compu a ionally in ensi e and, when ex ended o smoo hing algo i hms, compu a ionally uns a-
ble. Pe haps, he la e is he eason o scan use o smoo hing o mo e accu a e eco e y o
la en a iables in mul iple egime models in he exis ing economic li e a u e.
Ou pape makes bo h heo e ical and empi ical con ibu ions in his domain. Fi s , we
in oduce and ex end he In e ac i e Mul iple Model (IMM) …l e , o iginally de eloped by Ba -
Shalom (Blom and Ba -Shalom, 1988). Despi e i s ecogni ion in he enginee ing li e a u e, he
IMM …l e emains unde u ilised in economic applica ions. In addi ion, we claim ha he Kim
and Nelson …l e belongs o he amily o Gene alised Pseudo-Bayesian (GPB) …l e s and p esen
i in a gene al o m ha accommoda es di¤e en o de s o app oxima ion. Finally, we de elop a
compu a ionally s able and easily implemen able smoo hing algo i hm ha can be con enien ly
adap ed o a wide ange o …l e s in mul iple egime se ing. Empi ically, we apply hese me hods
1

o a p o o ypical New Keynesian DSGE model and he U.S. mac oeconomic ime se ies spanning
om 1947 o 2023. This exe cise succeeds in iden i ying signi…can policy shi s, pa icula ly in
he pos -Co id-19 e a, and hus demons a es he p ac ical ele ance o ou me hods.
We alida e he supe io i y o he p oposed …l e -smoo he algo i hm using igo ous simula ion
exe cises. Ou …ndings indica e ha he IMM …l e ou pe o ms he Kim and Nelson …l e in e ms
o compu a ional speed while main aining compa able accu acy. Mo eo e , he implemen a ion
o ou p oposed smoo he signi…can ly enhances he p ecision in he eco e y o la en a iables,
wi h an app oxima e 25% educ ion in es ima ion e o s. These empi ical insigh s e eal he
impo ance o smoo hing in his amewo k, o e looked in he exis ing li e a u e.
One should no e ha while he Kim and Nelson …l e has domina ed he analysis o mul iple-
egime mac oeconomic models, he e ha e been a ew excep ions. Liu, Wang, and Zha (2013)
appa en ly applied IMM o s udy he ole o land-p ice dynamics in mac oeconomy. Binning and
Maih (2015) used IMM o show how ce ain non-linea …l e s can be adap ed o he mul iple
egime se ing. Bjø nland, La sen, and Maih (2018) applied i o s udy he in e play be ween
oil p ice shocks and mac oeconomic ins abili y. Mo e ecen ly, Lei h, Ki sano a, Machado, and
Ribei o (2024) used IMM in a s udy o mone a y and …scal policy changes in he Uni ed S a es.
We a e unawa e o o he IMM applica ions in mac oeconomics o da e.
All compu a ions p esen ed in his pape we e implemen ed in he RISE c
 oolbox (Maih,
2015).1
The pape is o ganised as ollows. The nex sec ion p esen s heo e ical ounda ions. We
de i e wo amilies o …l e s, one o which encompasses he Kim and Nelson …l e and he o he
one encompasses he canonical IMM. We de i e a Ma ko -swi ching smoo he adap ed o he
app op ia e …l e amily. Sec ion 3 es s he e¢ cacy o he p oposed …l e and smoo he algo i hms
on a i…cial da a. An empi ical in es iga ion is p esen ed in Sec ion 4. Sec ion 5 concludes.
1RISE s ands o ‘Ra ionali y in Swi ching En i onmen s’. The codes and documen a ion a e a ailable a
h ps://gi hub.com/jmaih/RISE_ oolbox
2
2 Swi ching Fil e s and Smoo he s
2.1 The Fil e ing P oblem
We s a wi h a gene al mul iple- egime s a e-space ep esen a ion o a linea disc e e- ime dy-
namic model consis ing o a measu emen equa ion (1) and a ansi ion equa ion (2),
y =cy;s +Zs  +gs " ;(1)
 =c;s +Ts  1+Rs  ;(2)
whe e y ap1 ec o o obse a ions,  is a m1 ec o o unobse ed s a e a iables, and "
and  a e independen s anda d Gaussian andom a iables, = 1; : : : ; n. All model pa ame e s,
cy;s ; c;s ;Zs ; Ts ;gs ; Rs g, depend on egime s , which is an ou come o a Ma ko p ocess wi h
h1disc e e egimes. This p ocess is desc ibed by he ansi ion p obabili y ma ix wi h he
gene ic elemen Q(s 1; s ) = P [s js 1], so ha Ph
s =1 Q(s 1; s ) = 1 o e e y egime s 1
and e e y ime .
The in o ma ion a ailable a ime is ully con ained in he ec o o obse a ions Y :=
y1; :::; y g. The objec o in e es is an es ima e o he unobse ed s a e ec o  ; o which
h ee es ima o s,  j 1;  j and  jna e a ailable in Bayesian amewo k. The … s es ima o is
he o ecas o  based on in o ma ion Y 1,
 j 1:= E[ jY 1]:
I s mean squa e e o (MSE) is de…ned as
P j 1:= Eh  j 1  j 10jY 1i:
In he linea single- egime se ing wi h Gaussian shocks hese objec s and he associa ed
likelihood (y jY 1)a e compu ed by he well-es ablished echnique o he s anda d Kalman
…l e (KF), which in his case is exac and op imal (Kalman, 1960). Wo king in a mul iple- egime
en i onmen is mo e challenging because o he explosi e dimensionali y o he p oblem.
Speci…cally, in a mul iple- egime en i onmen , exac es ima ion is in easible because he num-
be o his o ies ha a Kalman- ype …l e needs o ake in o accoun inc eases exponen ially wi h
e e y ime pe iod. A any gi en ime , a mul iple- egime dynamic sys em can be in one o
hpossible egimes, each co esponding o a ealisa ion o hmu ually exclusi e and exhaus i e
andom e en s. Deno e he sequence o ealised egimes om he beginning o obse a ions up
o ime by J :
J = s1; s2; :::; s 1; s g 2 H ;
3
whe e HN; is he se o all possible his o ies o leng h N ha end a pe iod . The e a e h
possible mu ually exclusi e and exhaus i e his o ies up o ime . Using he o al p obabili y
heo em, he condi ional pd a ime is ob ained as a Gaussian mix u e wi h he numbe o
e ms equal o h :
(y +1 jY ) = X
J
(y +1 j J ; Y ) P [J jY ]:
The p obabili y o a gi en egime his o y is compu ed using Bayes o mula:
P [J jY ] = P [J jy ; Y 1] = (y j J ; Y 1) P [J jY 1]
(y jY 1)
= (y j J ; Y 1) P [s ;J 1jY 1]
(y jY 1)
= (y j J ; Y 1) P [s j J 1; Y 1]
(y jY 1)P [J 1jY 1]
When he egime swi ches ha e Ma ko p ope y, P [s j J 1; Y 1]'P [s js 1] = Q(s 1; s ),
which simpli…es he second e m in he nume a o . Howe e , condi ioning on he en i e pas
his o y is s ill needed o he las e m e en i he egimes ollow a Ma ko p ocess.
In p ac ice, one has o eso o some app oxima ion. In his sense, all p ac ical mul iple-
egime …l e s a e app oxima e and, he e o e, subop imal. One popula app oach in ol es me ging
wo o mo e his o ies in o one. A e sion o his app oach is well known in economic applica ions
as he Kim and Nelson …l e . We ocus on his amewo k and s udy wo amilies o …l e s wi h
di¤e en mechanisms o app oxima ion.
In he nex sec ion, we p esen he Gene alised Pseudo-Bayesian (GPB) …l e s, and In e ac ing
Mul iple Models (IMM) …l e s o a bi a y o de (leng h o acked his o ies) N:
2.2 Two P ac ical Families o Fil e s
We begin wi h he GPB(N) amily. I includes he Kim and Nelson …l e as a special case o
GPB(2), as one can see om compa ison o he exposi ions in Kim (1994) and Ba -Shalom e al.
(2001). Following commonly used no a ions, he GPB(N) …l e uses in o ma ion om he p e ious
Npe iods, including he cu en one. Thus, GPB(1) igno es pas his o y and uses cu en pe iod
in o ma ion only, GPB(2) inco po a es in o ma ion om he cu en pe iod and one immedia ely
p eceding pe iod, and so on. The IMM algo i hm is concep ually di¤e en om he GPB in he
way i combines pas his o ies. The e sion o IMM de eloped in Blom and Ba -Shalom (1988)
co esponds o IMM(1); we e e o i as canonical IMM.
One would expec ha a highe Nleads o inc eased accu acy a he cos o a la ge amoun
o compu a ions. We in es iga e ela i e accu acy and speed o di¤e en Nwi hin each amily.
4
Ano he in e es ing ques ion is whe he he canonical IMM ou pe o ms he KN …l e in accu acy
and speed in a p o o ypical mac oeconomic applica ion.
In his sec ion, we p esen he GPB(N) and he IMM(N) algo i hms in u n, using uni o m
no a ions. Whe e ele an , we will emind he eade ha KN is he same as GPB(2).
2.2.1 P elimina ies
Le H deno e he his o y o egimes in Nconsecu i e pe iods ending wi h pe iod ,
H := s N+1; :::; s 1; s g 2 HN; ;
and le C be he ‘collapsed’his o y, de…ned as
C := s N+2; :::; s g 2 HN1; :
Hence
H = C 1; s g= s N+1;C g;
and
H 1= s N; :::; s 2; s 1g 2 HN; 1;
H 1[ H = s N; :::; s 2; s 1; s g 2 HN+1; :
Le
(H )
j := P [H jY ]
be he p obabili y o ealisa ion o a pa icula his o y H condi ional on in o ma ion a ime .
2.2.2 Family o GPB Fil e s
The GPB algo i hm o o de N, deno ed GPB(N), akes in o accoun all hNpossible his o ies
o he …xed leng h N, …nishing a he cu en ime pe iod. I is implemen ed as ollows.
De…ne
(C )
j := P [C jY ] =
h
X
s N+1=1
(H )
j
as he p obabili y o he collapsed his o y, C , condi ional on in o ma ion a ime .
Algo i hm 1 GPB(N) Algo i hm
5
Algo i hm 3 Smoo hed P obabili ies
S ep 0. Ini ialise (sn)
njn= P [snjYn]; sn= 1; :::; h:
S ep 1. Fo =n1use (14) o compu e he smoo hed p obabili y o (H )
jn o his o y H .
S ep 2. Compu e smoo hed p obabili ies o each egime:
(s )
jn= P [s jYn] = X
C 1
P [H jYn] = X
C 1
(H )
jn
Use (s )
jn o ini ialise he algo i hm o =n2:
2.3.2 Smoo hed Va iables
The smoo he is based on he p ope ies o he join Gaussian dis ibu ion o he o ecas e o s
o he ec o o la en s a e a iables and he es ima ion e o s o he ec o o obse a ions
p oduced by he …l e .
By de…ni ion, smoo hed s a e ec o s and MSE ma ices a e:
(H )
jn=Eh(H )
jYn;H i;(15)
P(H )
jn=E(H )
(H )
j 1(H )
(H )
j 10jYn;H :(16)
De…ne he o ecas e o o he s a e ec o a ime wi h his o y H as
(H )
j 1:=  (H )
j 1(17)
Then,
P(H )
j 1=Eh(H )
j 1(H )0
j 1jY 1;H i:(18)
De…ne he Kalman gain ma ix:
K(H )
j 1=P(H )
j 1Z0
s hF(H )
j 1i1:(19)
To calcula e (H )
jnde…ned in (15), we spli he his o y in o wo componen s a 1and use
he o mula o he condi ional mean o mul i a ia e Gaussian dis ibu ion:
(H )
jn=E[ j H ; Yn] = E j H ; Y 1; kjk1gk= :n
=(H )
j 1+
n
X
k=
Eh 0
kjk1jY 1;H iF1
kjk1 kjk1
=(H )
j 1+
n
X
k=
Eh(H )
j 1+(H )
j 10
kjk1Z0
sk+ [gsk"k]0jY 1;H iF1
kjk1 kjk1
12

whe e we used
(H )
j 1=y Zs (H )
j 1cy;s =y Zs  (H )
j 1cy;s =gs " +Zs (H )
j 1:
So, …nally,
(H )
jn=(H )
j 1+
n
X
k=
Eh(H )
j 10
kjk1jY 1;H iZ0
skF1
kjk1 kjk1:(20)
Simila ly, he o mula o condi ional a iance o mul i a ia e Gaussian dis ibu ion applied
o (16) yields:
P(H )
jn=P(H )
j 1
n
X
k=
Eh 0
kjk1jY 1;H iF1
kjk1E kjk10
jY 1;H 
=P(H )
j 1
n
X
k=
Eh(H )
j 1+(H )
j 10
kjk1Z0
sk+ [gsk"k]0jY 1;H iF1
kjk1
EhZskkjk1+ [gsk"k](H )0
j 1+(H )0
j 1jY 1;H i;
so ha
P(H )
jn=P(H )
j 1
n
X
k=
Eh(H )
j 10
kjk1jY 1;H iZ0
skF1
kjk1ZskEhkjk1(H )0
j 1jY 1i(21)
In exp essions (20) and (21) we do no speci y he u u e egime sequences s a ing om s
unde he summa ion. We in oduce hem in he calcula ions o expec a ions E[ j ] o e e y
s ep going backwa d, as shown la e .
Fo now, we will need he ollowing ecu sion o (H )
j 1:The ecu sion is sligh ly di¤e en o
he wo amilies o …l e s.
Lemma 1 1. Fo GPB(N) …l e
(H )
j 1=Ts
h
X
s N=1
P [s NjY 1;C 1]IK(H 1)
1j 2Zs 1(H 1)
1j 2+! 1;(22)
whe e
! 1=Rs  Ts
h
X
s N=1
P [s NjY 1;C 1]K(H 1)
1j 2gs 1" 1:
2. Fo IMM …l e
(H )
j 1=Ts X
H 1
P [H 1jY 1;H ]IK(H 1)
1j 2Zs 1(H 1)
1j 2+! 1;(23)
13
whe e
! 1=Rs  Ts X
H 1
P [H 1jY 1;H ]K(s 1)
1j 2gs 1" 1:
P oo . Fo GPB(N) we ha e
(H )
j 1= (H )
j 1=Ts  1(C 1)
1j 1+Rs  ;
and, using (C 1)
1j 1 om equa ion (5),
(H )
j 1=Ts 0
@ 1
h
X
s N=1
P [s NjY 1;C 1](H 1)
1j 11
A+Rs  :(24)
Simila ly, o IMM(N) we ha e
(H )
j 1=Ts  1^(H 1jH )
1j 1+Rs 
and using ^(H 1jH )
1j 1 om (11),
(H )
j 1=Ts 0
@ 1X
H 1
P [H 1jY 1;H ](H 1)
1j 11
A+Rs  :(25)
Deno e
M( ) = P [ jY 1;C 1]; =s N; o GPB(N),
P [ jY 1;H ]; =H 1; o IMM(N).
Then exp essions (24) and (25) can be w i en in he same o m,
(H )
j 1=Ts 0
@ 1X
M( )(H 1)
1j 11
A+Rs  ;
and he es o he p oo is iden ical o bo h amilies o …l e s.
Use he KF upda e o (H 1)
1j 1and he de…ni ion o Kalman gain (19) o K(H 1)
1j 2 o ew i e
he las exp ession as:
(H )
j 1=Ts 0
@ 1X
M( )
(H 1)
1j 2+P(H 1)
1j 2Z0
s 1hF(H 1)
1j 2i1 (H 1)
1j 2+Rs 
=Ts X
M( ) 1(H 1)
1j 2
Ts X
M( )K(H 1)
1j 2 (H 1)
1j 2+Rs 
14
Nex , use he KF ou pu o (H 1)
1j 2along wi h he de…ni ion (17) o (H 1)
1j 2and equa ion (1)
o y 1 o ob ain he ecu sions in Lemma 1:
(HN; )
j 1=Ts X
M( ) 1(H 1)
1j 2
Ts X
M( )K(H 1)
1j 2y 1Zs 1(H 1)
1j 2cy;s 1+Rs 
=Ts X
M( )(H 1)
1j 2
Ts X
M( )K(H 1)
1j 2Zs 1(H 1)
1j 2
+Rs  Ts X
M( )K(H 1)
1j 2gs 1" 1
=Ts X
M( )IK(H 1)
1j 2Zs 1(H 1)
1j 2+!(H 1)
1
whe e we used he no a ion
! 1=Rs  Ts X
M( )K(H 1)
1j 2gs 1" 1:
No e ha in his de i a ion o GPB(N) he sum is aken o e all possible egimes a ime
Nwhen s Nis unknown. I he egime s Nis known, his ecu sion is gi en by
(s N;H )
j 1=Ts IK(s N;H 1)
1j 2Zs 1(s N;H 1)
1j 2+! 1:(26)
Simila ly, o IMM, when H 1=~
H 1is known, hen
(~
H 1;H )
j 1=Ts IK(~
H 1;H 1)
1j 2Zs 1(~
H 1;H 1)
1j 2+! 1:(27)
The emaining de i a ions a e iden ical o GPB and IMM.
We apply o mulas (20) and (21) ecu si ely, s a ing om he obse a ion a he …nal pe iod,
n, in egime sn:
(Hn)
njn=(Hn)
njn1+Eh(Hn)
njn1(Hn)0
njn1jYn1;HniZ0
snhF(Hn)
njn1i1 (Hn)
njn1
=(Hn)
njn1+P(Hn)
njn1Z0
snhF(Hn)
njn1i1 (Hn)
njn1=(Hn)
njn1+P(Hn)
njn1 (Hn)
njn1
15
whe e
(Hn)
njn1=Z0
snhF(Hn)
njn1i1 (Hn)
njn1;
and
P(Hn)
njn=P(Hn)
njn1Eh(Hn)
njn1(Hn)0
njn1jYn1;Hni
Z0
snhF(Hn)
njn1i1ZsnEhnjn1(Hn)0
njn1jYn1;Hni
=P(Hn)
njn1P(Hn)
njn1Z0
snhF(Hn)
njn1i1ZsnP(Hn)
njn1
=P(Hn)
njn1P(Hn)
njn1N(Hn)
njn1P(Hn)
njn1;
whe e
N(Hn)
njn1=Z0
snhF(Hn)
njn1i1Zsn:
Nex , we mo e one s ep back o =n1.
(Hn1)
n1jn=(Hn1)
n1jn2+
n
X
k=n1
Eh(Hn1)
n1jn20
kjk1jYn2;Hn1iZ0
skFkjk11 kjk1
=(Hn1)
n1jn2+P(Hn1)
n1jn2Z0
sn1hF(Hn1)
n1jn2i1 (Hn1)
n1jn2
+
h
X
sn=1
P [snjYn2;Hn1]
Eh(Hn1)
n1jn2(snN;Hn1)0
njn1jYn2;Hn1; sniZ0
snhF(Hn)
njn1i1 (Hn)
njn1
=(Hn1)
n1jn2+P(Hn1)
n1jn2Z0
sn1hF(Hn1)
n1jn2i1 (Hn1)
n1jn2
+
h
X
sn=1
P [snjYn2;Hn1]Eh(Hn1)
n1jn2(Hn1)0
n1jn2jYn2;Hn1i
IZ0
sn1K(Hn1)0
n1jn2T0
s Z0
snhF(Hn)
njn1i1 (Hn)
njn1
=(Hn1)
n1jn2+P(Hn1)
n1jn2Z0
sn1hF(Hn1)
n1jn2i1 (Hn1)
n1jn2(28)
+P(Hn1)
n1jn2
h
X
sn=1
P [snjYn2;Hn1]
IZ0
sn1K(Hn1)0
n1jn2T0
s Z0
snhF(Hn)
njn1i1 (Hn)
njn1:
16
Simila compu a ions yield
P(Hn1)
n1jn=P(Hn1)
n1jn2
n
X
k=n1
Eh(Hn1)
n1jn20
kjk1jYn2;Hn1iZ0
sk
hF(Hn1)
n1jn2i1ZskEhkjk1(Hn1)0
n1jn2jYn2;Hn1i
=P(Hn1)
n1jn2P(Hn1)
n1jn2Z0
sn1hF(Hn1)
n1jn2i1Zsn1P(Hn1)
n1jn2(29)
P(Hn1)
n1jn2
h
X
sn=1
P [snjYn2;Hn1]IZ0
sn1K(Hn1)0
n1jn2
T0
s Z0
snhF(Hn)
njn1i1Zsn1Ts IK(Hn1)
n1jn2Zsn1P(Hn1)
n1jn2:
In hese de i a ions we used P(Hn1)
n1jn2=Eh(Hn1)
n1jn2(Hn1)0
n1jn2jYn2;Hn1; sni=
Eh(Hn1)
n1jn2(Hn1)0
n1jn2jYn2;Hn1ias condi ioning on snbecomes i ele an .
Equa ions (28) and (29) can be w i en as:
(Hn1)
n1jn=(Hn1)
n1jn2+P(Hn1)
n1jn2 (Hn1)
n1jn2;
P(Hn1)
n1jn=P(Hn1)
n1jn2P(Hn1)
n1jn2N(Hn)
n1jn2P(Hn1)
n1jn2;
whe e, using app oxima ion P [snjYn2;Hn1]'Q(sn1; sn);we exp ess (Hn1)
n1jn2and N(Hn)
n1jn2
ecu si ely:
(Hn1)
n1jn2=Z0
sn1hF(Hn1)
n1jn2i1 (Hn1)
n1jn2+
h
X
sn=1
Q(sn1; sn)L(Hn1)0
n;n1 (Hn)
njn1;
N(Hn1)
n1jn2=Z0
sn1hF(Hn1)
n1jn2i1Zsn1+
h
X
sn=1
Q(sn1; sn)L(Hn1)0
n;n1N(Hn)
njn1L(Hn1)
n;n1:
He e
L(Hn1)
n;n1=TsnIK(Hn1)
n1jn2Zsn1:
Con inuing in he same way, we can summa ise he p ocedu es in he ollowing algo i hm.
Algo i hm 4 S a e Smoo hing
S ep 0. Ini ialise he smoo he by se ing (Hn)
njn1=Z0
snhF(Hn)
njn1i1 (Hn)
njn1,N(Hn)
njn1=
Z0
snhF(Hn)
njn1i1Zsn;Hn2HN;n. Ini ialise (Hn)
njnand P(Hn)
njnby ou pu s o he co esponding
…l e a =n.
17

S ep 1. Compu e he ollowing auxillia y quan i ies o each his o y H , using ecu sion:
L(H )
+1; =Ts +1 IK(H )
j 1Zs 
(H )
j 1=Z0
s hF(H )
j 1i1 (H )
j 1+
h
X
s +1=1
Q(s ; s +1)L(H )0
+1; (H +1)
+1j ;
N(H )
j 1=Z0
s hF(H )
j 1i1Zs +
h
X
s +1=1
Q(s ; s +1)L(H )0
+1; N(H +1)
+1j L(H )
; +1
o =n1; n 2; :::; 1:
S ep 2. Compu e he smoo hed es ima es o he s a e ec o and he MSE ma ix
(H )
jn=(H )
j 1+P(H )
j 1 (H )
j 1;
P(H )
jn=P(H )
j 1P(H )
j 1N(H )
j 1P(H )
j 1;
o = 1; :::; n 1:
Use he smoo hed p obabili ies, n(H )
jno =1:n1, o compu e he smoo hed s a e ec o s and
MSE ma ices:
x jn=X
H
(H )
jn(H )
jn;
P jn=X
H
(H )
jnP(H )
jn:
3 Valida ing he Fil e s
3.1 Model and Pa ame e isa ion
To compa e he pe o mance o …l e s and smoo he s, we use he model de eloped in Fe nandez-
Villa e de, Gue on-Quin ana, and Rubio-Rami ez (2015), he ea e e e ed o as FGR2015. I is
a ela i ely s anda d medium-scale New Keynesian DSGE model, which we modi y o in es iga e
he aspec s o good luck and good policy.
The model consis s o a household sec o , … ms, and a mone a y au ho i y. Households de i e
u ili y om consump ion ela i e o hei habi s ock and om leisu e. They supply di¤e en ia ed
labou o monopolis ically compe i i e … ms and choose wages subjec o Cal o wage-se ing
ic ion. Fi ms p oduce di¤e en ia ed ou pu using capi al, labou , and a neu al echnology
p ocess. They se p ices, also subjec o Cal o p icing ic ions. The capi al s ock e ol es in
he usual way, excep o he inclusion o embodied echnology in new in es men goods. The
18
model is closed by imposing a Taylo - ype ule o he mone a y au ho i y. We p esen he ull
speci…ca ion o he model in Appendix B.
We base he s uc u al pa ame e s o he model on he es ima es epo ed in FGR2015; see
column (1) in Table C1 in Appendix B. Ou ea men o policy and shock ola ili ies is di¤e en
om FGR2015, who es ima ed a single- egime nonlinea policy unc ion and a single- egime
s ochas ic ola ili y p ocess. We in oduce wo Ma ko -swi ching p ocesses in o he model. The
… s , SP; , go e ns policy pa ame e s in he ollowing mone a y policy ule:
ss
= 1
ss  (SP; ) 
 a g (SP; )Yd;
ydYd; 1y(SP; )!1 (SP; )
exp ((SV; )"; ):(30)
The li e a u e ypically ca ego izes mone a y policy app oaches in o hawkish and do ish modes,
cha ac e ized by mo e and less agg essi e esponses o in‡a ion, espec i ely. Acco dingly, we
assume ha he pa ame e s a e high in s a e SP; = 1 (hawkish s a e) and low in s a e SP; = 2
(do ish s a e). We explain below how we chose hese alues. The second wo-s a e p ocess, SV; ;
go e ns he shock ola ili ies o all shocks, including he policy shock in equa ion (30).
3.2 Mon e-Ca lo Simula ions Design
In ou simula ions, we aim o di¤e en ia e be ween pe iods o in equen la ge shocks and pe iods
o mo e equen egula shocks. We se he p obabili y o emaining in he low ola ili y s a e
o 0.95. This pa ame e isa ion implies an a e age o 20 qua e s be ween high shocks, wi h a
s anda d de ia ion o 19 qua e s.5This p obabili y accu a ely e‡ec s he ac ha ecessions
in he US ha e occu ed app oxima ely e e y 8-10 yea s since he end o Wo ld Wa II. We se
he p obabili y o s aying in he high ola ili y s a e o 0.8, esul ing in an a e age du a ion o
high shock pe iods o 5 qua e s (wi h a s anda d de ia ion o 4.5 qua e s). In e p e ing pe iods
o la ge shocks as ecessions sugges s ha a ypical ecession las s sligh ly o less han a yea , a
du a ion ha ou pa ame e isa ion app op ia ely cap u es.
In o mula ing ou policy model, we applied conside a ions simila o hose used in he assump-
ions in he shock ola ili y expe imen s. The exis ing li e a u e ends o epo ha hawkish
policies ha e been p edominan since he 1980s, spanning app oxima ely 40 yea s.6Howe e ,
conside ing he da a s a ing om 1955 and acknowledging he e iden do ish endencies since
2008, we in e ha he ime spli be ween hese egimes is oughly equal. The e o e, we assume
5I p obabili y o lea e one o he wo Ma ko s a es is q, hen he expec ed leng h o s ay in his s a e is 1=q
wi h he s anda d de ia ion o p1q=q:
6See e.g. Bianchi and Melosi (2017), Chen, Ki sano a, and Lei h (2017).
19
symme ic diagonal elemen s in he ansi ion p obabili y ma ix. As he benchma k case, we
calib a e he p obabili y o emain in ei he o hese s a es a 0.95. This implies an a e age o
20 qua e s be ween policy changes, allowing o a wide ange o du a ions be ween policy shi s.
In addi ion, we conside an al e na i e calib a ion, wi h his p obabili y se o 0.1. All ansi ion
ma ices a e p esen ed in Table 1.
Table 1: Pa ame e isa ion o shock and policy egimes
T ansi ion ma ices
Shocks Benchma k Case Al e na i e Case
Ps=0:95 0:05
0:2 0:8PI
p=0:95 0:05
0:05 0:95 PII
p=0:9 0:1
0:1 0:9
Pa ame e s o Taylo Rule:
Hawkish Feedback Do ish Feedback
Base
1:7 0:9
Al e n:
1:5 0:9
As o he policy coe¢ cien s ha a e ime- a ying (o depend on he s a e), we desc ibe he
hawkish policy mode wi h eedback on in‡a ion Base
= 1:7in he hawkish s a e and Base
= 0:9
in he do ish s a e, consis en wi h …ndings in o he s udies7. We also conside an al e na i e
pa ame e isa ion whe e hese wo eedbacks a e less dis inc , as shown in Table 1. In hese
simula ions, we keep he eedback on ou pu and he in e es a e smoo hing pa ame e he same
in bo h hawkish and do ish s a es.
As epo ed in column (1) in Table C1, he s anda d de ia ions o all shocks in he low-
ola ili y s a e, SV; = 1;a e se o be equal o he mean es ima es o co esponding a iables in
FGR2015, and hey a e doubled in he high- ola ili y s a e, SV; = 2:
In o de o gene a e a i…cial da a, we sol e and simula e his non-linea model using a
pe u ba ion app oach wi h he unc ional i e a ion algo i hm de eloped o RISE c
(Maih,
2015).
We chose o gene a e 500 samples o 1,000 obse a ions each. We conside ou pu g ow h,
p ice in‡a ion, wage in‡a ion, he Fede al Funds a e, and he ela i e p ice o in es men goods
as obse able a iables. The la en a iables a e lis ed in Table 2 and o he ele an ables. We
hen use he simula ion esul s o in es iga e he pe o mance o he discussed …l e s, con olling
o he sample leng h. Wi hin each sample, we use he ini ial 300 obse a ions as a p oxy o a
7See, e.g. Bianchi (2012), Chang, Kwak, and Qiu (2021), Chen, Leepe , and Lei h (2022).
20
ypical eal-li e scena io wi h pos -WW2 qua e ly da a, whe e he in‡uence o ini ial condi ions
can be subs an ial. Addi ionally, we analyze he ull sample o 1000 obse a ions, in which we
expec he impac o ini ial condi ions o be signi…can ly diminished.
3.3 Resul s
3.3.1 E alua ion C i e ia
We need some c i e ia o ank he …l e s o p ac ical pu pose, based on hei accu acy and speed.
Fo accu acy, o goodness-o -… , in ou exe cise we canno use measu es linked o he likelihood
L = log (y jY 1) e u ned by he …l e s. This is because di¤e en …l e s employ di¤e en
app oxima ions when compu ing he likelihood, and so compa ison based on his measu e is
no compelling o compa ison o he …l e s. An al e na i e and, pe haps, mo e s aigh o wa d
app oach in ou case is o use oo mean squa ed e o s (RMSE) o each la en a iable  , gi en
by he o mula
R'=1
nsim
nsim
X
i=1
u
u
1
n
n
X
=1  '
ss 2
:
We p esen he compa ison o he accu acy o he …l e s based on he upda ed a iables ('= j )
and smoo hed a iables ('= jn)in Tables 2-7.8He e, nis he leng h o each da a sample, and
nsim is he numbe o simula ions.
3.3.2 The Bes Pe o ming Fil e
Table 2 shows he esul s o ou …l e s: he IMM(1) and GPB(N) o N= 1;2;3, which includes
he KN …l e as i is equi alen o GPB(2).9Ou simula ions e eal ha inc easing he o de o
he GPB(N) …l e beyond N=3 o¤e s no p ac ical alue. We do no p esen esul s o IMM(2)
as i does no no iceably imp o e accu acy o he IMM(1).
We ocus on he upda ed a iables, as hese a iables con ibu e o he likelihood used in
es ima ion. The a e age RMSEs (deno ed as R j ) o all 500 d aws in he Mon e Ca lo expe imen
a e p esen ed in columns (1)-(4) o Table 2. They a y in magni ude, e‡ec ing …ndings simila
o hose in Binning and Maih (2015), whe e i is obse ed ha highly pe sis en la en a iables,
such as capi al, pose g ea e challenges o econs uc ion.
The ela i e RMSEs in columns (5)-(8) a e compu ed by di iding he RMSE o each a iable
by he lowes RMSE o ha pa icula a iable ac oss in es iga ed …l e s. In o he wo ds, o
8In compu ing RMSEs, we no malise all a iables, excep s a e p obabili ies, by hei s eady-s a e le els, as in
his model he s eady s a e is iden ical o all egimes.
9Appendix A p esen s selec ed …l e ing and smoo hing algo i hms in a o m con enien o implemen a ion.
21
Table 7: MRSEs o smoo hed a iables R j1000.
a s: No Missp-d Missp-d Missp-d
missp-b Policy H Shocks L Shocks H
(1) (2) (3) (4)
consump ion 0:023
[0:032] 0:057
[0:070] 0:022
[0:036] 0:021
[0:035]
capi al 0:178
[0:226] 1:472
[1:683] 0:186
[0:259] 0:164
[0:239]
ou pu 0:017
[0:030] 0:020
[0:038] 0:012
[0:032] 0:011
[0:031]
eal wage 0:002
[0:002] 0:005
[0:005] 0:002
[0:002] 0:002
[0:02]
Tobin’s Q 0:007
[0:010] 0:036
[0:037] 0:011
[0:013] 0:007
[0:010]
in es men 0:210
[0:302] 2:151
[2:533] 0:224
[0:349] 0:182
[0:317]
labou supply 0:017
[0:029] 0:019
[0:036] 0:011
[0:031] 0:011
[0:031]
p e e ence shock 0:037
[0:043] 0:112
[0:113] 0:045
[0:051] 0:037
[0:044]
labou supply shock 0:044
[0:070] 0:174
[0:199] 0:045
[0:080] 0:035
[0:073]
echnology shock 0:001
[0:001] 0:002
[0:002] 0:001
[0:001] 0:001
[0:001]
shock s a e p obs 0:224
[0:265] 0:247
[0:280] – –
policy s a e p obs 0:275
[0:335] –0:390
[0:408] 0:282
[0:339]
No e: MRSEs o upda ed a iables R j a e in squa e b acke s.
is highe han in he co ec ly speci…ed model. This sugges s ha inco ec ly speci ying shock
ola ili ies signi…can ly wo sens he iden i…ca ion o policy s a es.
In he …nal expe imen , epo ed in column (4), we e isi he second scena io, bu his ime
we assume ha he esea che belie es he ola ili y is always high. Al hough he RMSEs o
upda ed la en a iables in column (4) a e highe han hose in column (1), he RMSEs o
smoo hed a iables a e some imes lowe han in he co ec ly speci…ed model. The unexpec edly
supe io pe o mance o he misspeci…ed model a e smoo hing can be a ibu ed o he la ge
a iance o shocks. By allowing o a la ge a iance in he shocks dis ibu ion, i accommoda es
bo h la ge and small shocks. The smoo he hen e ises he es ima ed alues using he comple e
sample and adjus s he es ima es by ac o ing in in o ma ion abou he ealized shocks.
3.4 In e im Summa y
O e all, he …ndings in his sec ion demons a e he e¤ec i eness o he canonical IMM …l e , pa -
icula ly when combined wi h he app op ia e smoo he , in enhancing he accu acy and e¢ ciency
28

o Bayesian es ima ion o s a e-space models.
The canonical IMM ou pe o ms he Kim and Nelson …l e in e ms o compu a ional speed
while deli e ing compa able accu acy. The implemen a ion o he new smoo hing algo i hm wi h
he IMM …l e subs an ially enhances p ecision in es ima ing la en a iables, educing e o s by
app oxima ely 25%. We do no …nd any subs an ial imp o emen in accu acy when using highe
o de …l e s in ou example. I is ha d o p edic whe he he same will be ue o o he models.
Ou simula ions con… m ha , despi e app oxima ions, adding mo e in o ma ion imp o es
he pe o mance o he sugges ed …l e ing-smoo hing p ocedu e. We …nd ha , as long as he
sample leng h emains abo e 200 obse a ions, he e is no educ ion in he smoo he ’s e¢ cacy
in educing RMSEs o upda ed a iables. We …nd ha he …l e iden i…es p obabili ies o mo e
dis inc policy egimes wi h highe accu acy.
Finally, we demons a e ha we can s ill success ully eco e la en a iables e en when he
policy o shock ola ili y egimes in he model a e misspeci…ed.
Ha ing es ablished he supe io i y o he canonical IMM pai ed wi h he ma ching smoo he ,
we ocus on his …l e and smoo he in he empi ical applica ion.
4 Empi ical Applica ion
In his sec ion, we u he in es iga e he p ac icali y o he IMM …l e wi h he co esponding
smoo he . We es ima e a modi…ed e sion o he FGR2015 model bu using he same da a o
1959Q2-2013Q4 as in ha pape (see Table C2 in Appendix C). In ou es ima ion we impose
ela i ely wide p io s and use he A i…cial Bee Colony algo i hm by Ka aboga and Bas u k
(2007) o global op imisa ion.
Table 8: Es ima ion o pa ame e s ha go e n he wo Ma ko p ocesses
T ansi ion ma ices
Shocks Policy
Ps=0:939 05 0:060946
0:04625 0:95375 Pp=0:983 96 0:016039
0:043428 0:956 57 
Pa ame e s o Taylo Rule:
Hawkish Feedback 1.6574
Do ish Feedback 0.93984
Table 8 displays he es ima ed mode o he dis ibu ion o ansi ion p obabili ies and policy
29
pa ame e s. We p esen he emaining pa ame e s in Table C1 in Appendix C.
We no e ha bo h egime-swi ching p ocesses a e highly pe sis en , and he e o e hei iden-
i…ca ion is likely o be co ec , as sugges ed by ou simula ion esul s. The policy p ocess, in
pa icula , shows ha he e is only a 2% p obabili y o lea ing he hawkish s a e.
1947Q2 1957Q1 1966Q4 1976Q3 1986Q2 1996Q1 2005Q4 2015Q3
0
0.2
0.4
0.6
0.8
1
D: High ola ili y s a e
1947Q2 1957Q1 1966Q4 1976Q3 1986Q2 1996Q1 2005Q4 2015Q3
0
0.5
1
C: Do ish s a e
1947Q2 1957Q1 1966Q4 1976Q3 1986Q2 1996Q1 2005Q4 2015Q3
0
0.5
1
A: Do ish s a e
IMM GPB(1) GPB(2) GPB(3) GPB(4) GPB(5)
1947Q2 1957Q1 1966Q4 1976Q3 1986Q2 1996Q1 2005Q4 2015Q3
0
0.2
0.4
0.6
0.8
1
B: High ola ili y s a e
Figu e 3: Smoo hed S a e P obabili ies
Panels A and B in Figu e 3 epo he smoo hed p obabili ies o being in he do ish s a e and
he high ola ili y s a e. We used he canonical IMM a he es ima ion s age and six di¤e en
…l e s a he …l e ing s age.
One can no ice ha he lines plo ed o six …l e s a e e y close o one ano he . The GPB
…l e s o o de 2 o 5 p oduce nea ly iden ical esul s and hey a e also ex emely close o hose
p oduced by he canonical IMM. This sugges s, … s , ha using a mo e compu a ionally in ensi e
highe -o de GPB …l e does no necessa ily imp o e egime iden i…ca ion compa ed o he KN-
GPB(2) …l e , and, second, ha he canonical IMM and he KN …l e a e p ac ically iden ical in
accu acy. While GPB(1) s ands ou as less accu a e, i s ill iden i…es all main e en s simila ly o
he o he …l e s.
Panel A shows he p obabili y o being in he do ish policy s a e. No e ha i indica es ha
ou app oach succeded in iden i ying all majo changes in he US pos -wa policy s ance: he
30
G ea In‡a ion, he Volcke Disin‡a ion, he G ea Mode a ion, he G ea Financial C isis, and
he subsequen Ze o Lowe Bound (ZLB) pe iod. We did no assume a special egime o ZLB
mone a y policy bu iden i y his pe iod as a do ish s a e.
Panel B shows he p obabili y o being in he high ola ili y s a e. Ou app oach co ec ly
iden i…es mos o he ecessions and sugges s ha he p e-1990s pe iod expe ienced la ge shocks
han he mo e ecen pas .
Fo panels C and D he da ase includes he pe iod 1947Q2-2023Q3 (see Appendix C o
de ails). The ex ended da a co e s a longe pe iod, adding obse a ions a he beginning, which
should imp o e he iden i…ca ion o he G ea In‡a ion episode, and a he end, which includes
he pos -Co id pe iod wi h ising in‡a ion in 2022-23. In hese wo panels we only show he
esul s ob ained using he IMM …l e (wi h he associa ed smoo he ) o his ex ended da ase .
The message is simila o wha is sugges ed by panels A and B. We iden i y he do ish s a e
du ing he ZLB and a shi o hawkish policy a yea a e he ZLB li -o¤. In addi ion, we see he
e u n o he do ish policy du ing he Co id-19 pandemic which las ed un il 2023Q1, a which
ime ough measu es agains in‡a ion we e aken. The pos -Co id pe iod is also cha ac e ised by
ela i ely la ge shocks.
5 Conclusions
Ou ocus in his pape has been on imp o ing mul iple- egime Bayesian …l e ing echniques,
alongside he de elopmen o mul iple- egime smoo he s.
We in oduced he amily o IMM …l e s, along wi h an ex ension o he Kim and Nelson …l e ,
o accommoda e acking o longe egime his o ies. In addi ion, we de eloped a obus smoo hing
algo i hm ha can be adap ed o hese ex ended …l e s. Ou simula ion exe cises demons a e
ha he IMM …l e wi h ou p oposed smoo he deli e he bes combina ion o compu a ional
speed and accu acy in a p o o ypical mac oeconomic applica ion o Bayesian …l e ing.
Ou pape p o ides a comp ehensi e oolki o esea che s wo king wi h complex mac oeco-
nomic models. We demons a e i s p ac ical ele ance in an empi ical applica ion using a NK
DSGE model wi h long U.S. mac oeconomic ime se ies.
Re e ences
Ba -Shalom, Y., X.-R. Li, and T. Ki uba ajan (2001). Es ima ion wi h Applica ions To T acking
and Na iga ion. New Yo k: John Wiley and Sons.
31
Bianchi, F. (2012). E ol ing mone a y/…scal policy mix in he uni ed s a es. Ame ican Economic
Re iew 102(3), 167–72.
Bianchi, F. and L. Melosi (2017). Escaping he G ea Recession. Ame ican Economic Re-
iew 107(4), 1030–1058.
Binning, A. and J. Maih (2015). Sigma poin …l e s o dynamic nonlinea egime swi ching
models. Wo king Pape 2015/10, No ges Bank.
Bjø nland, H. C., V. H. La sen, and J. Maih (2018). Oil and mac oeconomic (in)s abili y. Ame -
ican Economic Jou nal: Mac oeconomics 10(4), 128–51.
Blom, H. A. and Y. Ba -Shalom (1988). The in e ac ing mul iple model algo i hm o sys ems
wi h ma ko ian swi ching coe¢ cien s. IEEE ansac ions on Au oma ic Con ol 33(8), 780–
783.
Chang, Y., B. Kwak, and S. Qiu (2021). U.S. Mone a y and Fiscal Policy Regime Changes and
Thei In e ac ions. Mimeo, Indiana Uni e si y.
Chang, Y., J. Maih, and F. Tan (2021). O igins o Mone a y Policy Shi s: A New App oach o
Regime Swi ching in DSGE Models. Jou nal o Economic Dynamics and Con ol 133, 104235.
Chen, X., T. Ki sano a, and C. Lei h (2017). How Op imal is US Mone a y Policy? Jou nal o
Mone a y Economics 92, 96–111.
Chen, X., E. M. Leepe , and C. Lei h (2022). S a egic In e ac ions in U.S. Mone a y and Fiscal
Policies. Quan i a i e Economics 13(2), 593–628.
Da ig, T. and T. Doh (2014). Mone a y Policy Regime Shi s and In‡a ion Pe sis ence. The
Re iew o Economics and S a is ics 96(5), 862–875.
De Jong, P. (1988). A c oss- alida ion …l e o ime se ies models. Biome ika 75 (3), 594–600.
Du bin, J. and S. J. Koopman (2012). Time Se ies Analysis by S a e Space Models. Ox o d:
Ox o d Uni e si y P ess.
Fe nandez-Villa e de, J., P. A. Gue on-Quin ana, and J. Rubio-Rami ez (2015). Es ima ing
Dynamic Equilib ium Models wi h S ochas ic Vola ili y. Jou nal o Econome ics 185(1),
216–229.
32
Hamil on, J. D. (1989). A new app oach o he economic analysis o nons a iona y ime se ies
and he business cycle. Econome ica 57(2), 357–384.
Kalman, R. E. (1960). A new app oach o linea …l e ing and p edic ion p oblems. Jou nal o
basic Enginee ing 82(1), 35–45.
Ka aboga, D. and B. Bas u k (2007). A powe ul and e¢ cien algo i hm o nume ical unc ion
op imiza ion: a i…cial bee colony (abc) algo i hm. Jou nal o Global Op imiza ion 39, 459–471.
Kim, C. and C. Nelson (1999). S a e-space Models wi h Regime Swi ching: Classical and Gibbs-
sampling App oaches wi h Applica ions. MIT P ess.
Kim, C.-J. (1994). Dynamic linea models wi h Ma ko -swi ching. Jou nal o Econome ics 60(1-
2), 1–22.
Lei h, C., T. Ki sano a, C. Machado, and A. P. Ribei o (2024). (Re)E alua ing ecen mac o-
economic policy in he US. Wo king Pape X, Uni e si y o Glasgow.
Liu, Z., P. Wang, and T. Zha (2013, May). Land P ice Dynamics and Mac oeconomic Fluc ua-
ions. Econome ica 81(3), 1147–1184.
Maih, J. (2015). E¢ cien pe u ba ion me hods o sol ing egime-swi ching DSGE models.
Wo king Pape 2015/01, No ges Bank.
33

Online Appendix
o
On Bayesian Fil e ing o Ma ko Regime Swi ching Models
by
Niga Hashimzade Oleg Ki sano Ta iana Ki sano a Junio Maih
A Selec ed Algo i hms
Le My
j; = Zj; ; cy;j; ; Tj; ; c;j; ; gj; ; Rj; ;y gbe s a e-space sys em ma ices o egime jand
in o ma ion a ime : Le K() be a KF ope a o . The …l e ing algo i hms a e summa ised in
Tables A1-A2. Smoo hing algo i hms a e summa ised in Table A3.
Table A1: GPB Fil e ing Algo i hms
GPB(1) GPB(2)
Regime p obabili ies
j
j := P [s =jjY ]ij
1j = P [s 1=i; s =jjY ]
j
j =Ph
i=1 ij
1j
Ini ialisa ion
 1j 1; P 1j 1; j
1j 1i
1j 1; Pi
1j 1; i
1j 1
Fil e ing and Upda ing
hj
j 1; Pj
j 1; j
j 1; j
j ; Pj
j i hij
j 1; Pij
j 1; ij
j 1; ij
j ; Pij
j i
=KMy
j; ; 1j 1; P 1j 1=KMy
j; ;i
1j 1; Pi
1j 1
j
= (2) =2jFj; j1=2e1
2 j0
j 1F1
j: j
j 1ij
= (2) =2jFi;j; j1=2e1
2 ij0
j 1F1
i;j; ij
j 1
Collapsing (dimension educ ion) and P obabili ies upda e
j
j =j
Ph
i=1 Qij
1; i
1j 1
Ph
k;m=1 m
Qkm
1; k
1j 1
ij
1j =ij
Qij
1; i
1j 1
Ph
k=1 kj
Qkj
1; k
1j 1
 j =Ph
j=1 j
j j
j j
j =Ph
i=1 ij
1j ij
j
P j =Ph
i=1 j
j Pj
j Pj
j =Ph
i=1 ij
1j Pij
j
+ j j
j  j j
j 0+j
j ij
j j
j ij
j 0
j
j =Ph
i=1 ij
1j
34
Table A2: IMM Fil e ing Algo i hms
IMM(1) IMM(2)
Regime p obabili ies
j
j := P [s =jjY ]ij
1j = P [s 1=i; s =jjY ]
Ini ialisa ion
i
1j 1; Pi
1j 1; i
1j 1ki
1j 1; Pki
1j 1; ki
1j 1
Mixing (dimension educ ion)
ijj
1j 1=Qij
1; i
1j 1
Ph
k=1 Qkj
1; k
1j 1
kijij
1j 1=Qk(h1)+i;i(h1)+jki
2j 1
Ph
m;l=1 Qm(h1)+l;l(h1)+jml
2j 1
0j
1j 1=Ph
i=1 ijj
1j 1i
1j 10ij
1j 1=Ph
k;i=1 kijij
1j 1ki
1j 1
P0j
1j 1=Ph
i=1 ijj
1j 1Pi
1j 1P0ij
1j 1=Ph
k;i=1 kijij
1j 1Pki
1j 1
+i
1j 10i
1j 1+ki
1j 10ki
1j 1
i
1j 10i
1j 10ki
1j 10ki
1j 10
Fil e ing and Upda ing
hj
j 1; Pj
j 1; j
j 1; j
j ; Pj
j i hij
j 1; Pij
j 1; ij
j 1; ij
j ; Pij
j i
=KMy
j; ;0j
1j 1; P0j
1j 1=KMy
j; ;0ij
1j 1; P0ij
1j 1
j
= (2) =2jFj; j1=2e1
2 j0
j 1F1
j; j
j 1ij
= (2) =2jFij; j1=2e1
2 ij0
j 1F1
ij; ij
j 1
P obabili ies upda e
j
j =j
Ph
i=1 Qij
1; i
1j 1
Ph
k;m=1 m
Qkm
1; k
1j 1
ij
1j =ij
Qij
1; i
1j 1
Ph
k=1 kj
Qkj
1; k
1j 1
Table A3: Smoo hing Algo i hms
GPB(1) and IMM(1) GPB(2) and IMM(2)
Smoo hed P obabili ies
j
jn=Ph
k=1 k
+1jn
j
j Qjk
; +1
Ph
m=1 Qmk
; +1m
j
Smoo hed S a es
Ini ialisaion
i
njn1=Z0
i;nF1
i;n i
njn1 ij
njn1=Z0
j;nF1
ij;n ij
njn1
Recu sion
Lij
+1; =Tj; +1 (IKi; Zi; )Lijk
+1; =Tk; +1 (IKi;j; Zj; )
i
j 1=Z0
i; F1
i; i
j 1 ij
j 1=Z0
;jF1
i;j; ij
j 1
+Ph
j=1 Qij
; +1Lij0
+1; j
+1j +Ph
k=1 Qjk
; +1Lijk0
+1; jk
+1j
i
jn=i
j 1+Pi
j 1 i
j 1ij
jn=ij
j 1+Pij
j 1 ij
j 1
Me ge s a es
j
jn=Ph
i=1 ij
1j ij
jn
 jn=Ph
i=1 i
jni
jn jn=Ph
i=1 i
jni
jn
35
B The Model
This sec ion summa ises he model in Fe nandez-Villa e de e al. (2015). We p esen he lis o
a iables and all he model equa ions. We hen p esen pa ame e isa ion o he model used in
Sec ion 3, and es ima ed pa ame e s ob ained in he empi ical in es iga ion discussed in Sec ion
4.
Table B1: Lis o Va iables
d Shi e o in e emp. p e e ence C Consump ion
G Go e nmen consump ion  Ma ginal u ili y o consump ion
g oss nominal in e es a e Rk Ren al a e o capi al
 G oss in‡a ion  Cos o use o capi al
Q Tobin’s Q 0
de i a i e o he capi al adj. cos
X In es men u capi al u iliza ion
s In es men adjus men cos s0
de i a i e o in es . adj. cos
Cal o wage pa ame e W; Op imal eal wage
W eal wage ld; labo demand
' labo supply shi e w; Rela i e op imal eal wage
g1; Cal o p ice p ocess 1 ; Rela i e P ice
g2; Cal o p ice p ocess 2 mc Real ma ginal cos
Yd; Ou pu p; P ice dispe sion
K Capi al A Neu al echnology
Z Combined echnology MU In es men -speci…c ech. le el
w; Wage dispe sion l hou s wo ked/labo supply
"; Mone a y policy shock, scale "'; labo supply shock, wi h scale '
"g; Go e nmen spending shock, scale g"; In es .-spec. echnology shock, scale 
"d; P e e ence shock, scale d"A; Neu al echnology shock, scale a
36
Table B2: Model Equa ions
Households
Capi al accum-n K = (1 )K 1+MU 1shX
X 1iX
FOC consum-n d
C hC 1hE d +1
C +1hC = 
FOC bonds  =E  +1
 +1
FOC capi al u il. Rk =0[u ]
MU
FOC capi al Q =E  +1
 (1 )Q +1 +Rk +1u +1 [u +1]
MU +1 
Capi al u il-n [u] = 1(u1) + 2
2(u1)2
i s de i a i e 0[u] = 1+2
2(u1)
FOC in es men 1 = Q MU 1shX
X 1is0hX
X 1iX
X 1
+E Q +1MU +1  +1
 s0hX +1
X iX +1
X 2
In es . adj. cos shX
X 1i=
2X
X 1x2
i s de i a i e s0hX
X 1i=X
X 1x
Fi ms
Wage helpe 1 =1
(W; )1 W
ld; +wE w
 +1 1W; +1
W; 1 +1
Wage helpe 2 = d ' (1+#)
w; l(1+#)
d; +wE w
 +1 (1+#)W; +1
W; (1+#) +1
Wage se ing w; =W;
W
Wage dynamics 1 = ww
1
 1W 1
W 1+ (1 w)1
w;
Wage dispe sion w; =wW 1
W
w
1
 
w; 1+ (1 w)
w;
P ice helpe 1 g1; =  mc Yd; +pE 
 +1 "g1; +1
P ice helpe 2 g2; =  ; Yd; +pE 
 +1 1";
; +1 g2; +1
P ice se ing "g1; = ("1) g2;
P ice dynamics 1 = p
1
 1"+ (1 p)1"
;
P ice dispe sion p; =p
1
 " p; 1+ (1 p)"
;
con inued on he nex page
37