EconBase
← Back to paper

On Bayesian Filtering for Markov Regime Switching Models

Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.

95,930 characters · 23 sections · 20 citation commands

Rendered from LaTeX for readability, not typeset faithfully. Citation keys are highlighted; maths is left as source; figures, tables and equation environments are summarised rather than reproduced; unrecognised commands are greyed out so nothing is silently dropped. Email addresses are removed.

On Bayesian Filtering for Markov Regime Switching Models

titlepage\begin{abstract} This paper presents a framework for empirical analysis of dynamic macroeconomic models using Bayesian filtering, with a specific focus on the state-space formulation of Dynamic Stochastic General Equilibrium (DSGE) models with multiple regimes. We outline the theoretical foundations of model estimation, provide the details of two families of powerful multiple-regime filters, IMM and GPB, and construct corresponding multiple-regime smoothers. A simulation exercise, based on a prototypical New Keynesian DSGE model, is used to demonstrate the computational robustness of the proposed filters and smoothers and evaluate their accuracy and speed for a selection of filters from each family. We show that the canonical IMM filter is faster and is no less, and often more, accurate than its competitors within IMM and GPB families, the latter including the commonly used Kim and Nelson (1999) filter. Using it with the matching smoother improves the precision in recovering unobserved variables by about 25%. Furthermore, applying it to the U.S. 1947-2023 macroeconomic time series, we successfully identify significant past policy shifts including those related to the post-Covid-19 period. Our results demonstrate the practical applicability and potential of the proposed routines in macroeconomic analysis. \end{abstract} Keywords: Markov switching models, Filtering, Smoothing JEL Reference Number: C11, C32, C54, E52

\baselineskip=18pt

Introduction

In the evolving landscape of macroeconomic analysis, the empirical examination of dynamic models has become increasingly sophisticated and computationally demanding. This paper contributes to this area by presenting a comprehensive framework for empirical analysis of state space models with multiple regimes using Bayesian filtering. Our work introduces enhanced filter and smoother algorithms, crucial for accurate macroeconomic modelling and estimation.

Our study is motivated by the increasing popularity of Bayesian methods in macroeconomic time series analysis in the Dynamic Stochastic General Equilibrium (DSGE) framework, usually presented in the state-space form. These methods have gained traction due to their ability to effectively handle complex models with latent variables and structural changes. Bayesian perspective is invaluable for disentangling convoluted macroeconomic phenomena, such as differentiating between external shocks and policy-driven economic patterns.

Despite significant advancements in the literature, the field continues to face various challenges, especially when estimating macroeconomic dynamic models with multiple regimes. One such challenge is selecting an efficient and accurate filter for likelihood computation. Another challenge is the task of reconstructing latent variables through the smoothing of estimated state variables and regime probabilities.

The prevalent use of the Kim and Nelson (Kim1994, kim1999state) filter in macroeconomic applications (see, inter alia, DavigDoh2014, \citealp*{ChangMaihTan2021},\newline \citealp*{CLL2022}) suggests limited exploration of alternative methods in this field. Despite its unquestionable power, Kim and Nelson filter is known to have certain flaws. Namely, it is computationally intensive and, when extended to smoothing algorithms, computationally unstable. Perhaps, the latter is the reason for scant use of smoothing for more accurate recovery of latent variables in multiple regime models in the existing economic literature.

Our paper makes both theoretical and empirical contributions in this domain. First, we introduce and extend the Interactive Multiple Model (IMM) filter, originally developed by Bar-Shalom (BlomBarshalom1988). Despite its recognition in the engineering literature, the IMM filter remains underutilised in economic applications. In addition, we claim that the Kim and Nelson filter belongs to the family of Generalised Pseudo-Bayesian (GPB) filters and present it in a general form that accommodates different orders of approximation. Finally, we develop a computationally stable and easily implementable smoothing algorithm that can be conveniently adapted to a wide range of filters in multiple regime setting. Empirically, we apply these methods to a prototypical New Keynesian DSGE model and the U.S. macroeconomic time series spanning from 1947 to 2023. This exercise succeeds in identifying significant policy shifts, particularly in the post-Covid-19 era, and thus demonstrates the practical relevance of our methods.

We validate the superiority of the proposed filter-smoother algorithm using rigorous simulation exercises. Our findings indicate that the IMM filter outperforms the Kim and Nelson filter in terms of computational speed while maintaining comparable accuracy. Moreover, the implementation of our proposed smoother significantly enhances the precision in the recovery of latent variables, with an approximate 25% reduction in estimation errors. These empirical insights reveal the importance of smoothing in this framework, overlooked in the existing literature.

One should note that while the Kim and Nelson filter has dominated the analysis of multiple-regime macroeconomic models, there have been a few exceptions. \citet*{LiuWangZha2013}{\ apparently }applied IMM to study the role of land-price dynamics in macroeconomy. BinningMaih2015 used IMM to show how certain non-linear filters can be adapted to the multiple regime setting. \citet*{BLM2018} applied it to study the interplay between oil price shocks and macroeconomic instability. More recently, \citet*{ LKMR2024} used IMM in a study of monetary and fiscal policy changes in the United States. We are unaware of other IMM applications in macroeconomics to date.

All computations presented in this paper were implemented in the RISE$^{ \textcopyright}$ toolbox (MaihRISE2015).\footnote{ RISE stands for `Rationality in Switching Environments'. The codes and documentation are available at https://github.com/jmaih/RISE_toolbox}

The paper is organised as follows. The next section presents theoretical foundations. We derive two families of filters, one of which encompasses the Kim and Nelson filter and the other one encompasses the canonical IMM. We derive a Markov-switching smoother adapted to the appropriate filter family. Section (ref) tests the efficacy of the proposed filter and smoother algorithms on artificial data. An empirical investigation is presented in Section (ref). Section (ref)\ concludes.

Switching Filters and Smoothers

The Filtering Problem

We start with a general multiple-regime state-space representation of a linear discrete-time dynamic model consisting of a measurement equation ((ref)) and a transition equation ((ref)),

eqnarray[eqnarray omitted — 185 chars of source]

where $y_{t}$ a $p\times 1$ vector of observations, $\alpha _{t}$ is a $ m\times 1$ vector of unobserved state variables, and $\varepsilon _{t}$ and $ \eta _{t}$ are independent standard Gaussian random variables, $t=1,\ldots ,n $. All model parameters, $\left \{ c_{y,s_{t}},c_{\alpha ,s_{t}};Z_{s_{t}},T_{s_{t}};g_{s_{t}},R_{s_{t}}\right \} $, depend on regime $s_{t}$, which is an outcome of a Markov process with $h\geq 1$ discrete regimes. This process is described by the transition probability matrix with the generic element $Q(s_{t-1},s_{t})=\func{Pr}\left[ s_{t}\mid s_{t-1} \right] $, so that $\sum_{s_{t}=1}^{h}Q(s_{t-1},s_{t})=1$ for every regime $ s_{t-1}$ and every time $t$.

The information available at time $t$ is fully contained in the vector of observations $Y_{t}:=\{y_{1},...,y_{t}\}$. The object of interest is an estimate of the unobserved state vector $\alpha _{t},$ for which three estimators, $\alpha _{t\mid t-1},$ $\alpha _{t\mid t}$ and $\alpha _{t\mid n} $ are available in Bayesian framework. The first estimator is the forecast of $\alpha _{t}$ based on information $Y_{t-1}$,

equation*[equation* omitted — 87 chars of source]

Its mean square error (MSE) is defined as

equation*[equation* omitted — 172 chars of source]

In the linear single-regime setting with Gaussian shocks these objects and the associated likelihood $f\left( y_{t}\mid Y_{t-1}\right) $ are computed by the well-established technique of the standard Kalman filter (KF), which in this case is exact and optimal (kalman1960). Working in a multiple-regime environment is more challenging because of the explosive dimensionality of the problem.

Specifically, in a multiple-regime environment, exact estimation is infeasible because the number of histories that a Kalman-type filter needs to take into account increases exponentially with every time period. At any given time $t$, a multiple-regime dynamic system can be in one of $h$ possible regimes, each corresponding to a realisation of $h$ mutually exclusive and exhaustive random events. Denote the sequence of realised regimes from the beginning of observations up to time $t$ by $\mathcal{J} _{t} $:

equation*[equation* omitted — 87 chars of source]

where $\mathbb{H}_{N,t}$ is the set of all possible histories of length $N$ that end at period $t$. There are $h^{t}$ possible mutually exclusive and exhaustive histories up to time $t$. Using the total probability theorem, the conditional pdf at time $t$ is obtained as a Gaussian mixture\ with the number of terms equal to $h^{t}$:

equation*[equation* omitted — 167 chars of source]

The probability of a given regime history is computed using Bayes formula:

eqnarray*[eqnarray* omitted — 608 chars of source]

When the regime switches have Markov property, $\Pr \left[ s_{t}\mid \mathcal{J}_{t-1},Y_{t-1}\right] =\func{Pr}\left[ s_{t}\mid s_{t-1}\right] =Q(s_{t-1},s_{t})$, which simplifies the second term in the numerator. However, conditioning on the entire past history is still needed for the last term even if the regimes follow a Markov process.

In practice, one has to resort to some approximation. In this sense, all practical multiple-regime filters are approximate and, therefore, suboptimal. One popular approach involves merging two or more histories into one. A version of this approach is well known in economic applications as the Kim and Nelson filter. We focus on this framework and study two families of filters with different mechanisms of approximation.

In the next section, we present the Generalised Pseudo-Bayesian (GPB) filters, and Interacting Multiple Models (IMM) filters of arbitrary order (length of tracked histories) $N.$

Two Practical Families of Filters

We begin with the GPB(N) family. It includes the Kim and Nelson filter as a special case of GPB(2), as one can see from comparison of the expositions in Kim1994 and BarShalom2001. Following commonly used notations, the GPB(N) filter uses information from the previous $N$ periods, including the current one. Thus, GPB(1) ignores past history and uses current period information only, GPB(2) incorporates information from the current period and one immediately preceding period, and so on. The IMM algorithm is conceptually different from the GPB in the way it combines past histories. The version of IMM developed in BlomBarshalom1988 corresponds to IMM(1); we refer to it as canonical IMM.

One would expect that a higher $N$ leads to increased accuracy at the cost of a larger amount of computations. We investigate relative accuracy and speed for different $N$ within each family. Another interesting question is whether the canonical IMM outperforms the KN filter in accuracy and speed in a prototypical macroeconomic application.

In this section, we present the GPB(N) and the IMM(N) algorithms in turn, using uniform notations for the entire GPB family. Where relevant, we will remind the reader that KN is the same as GPB(2).

Preliminaries

Let $\mathcal{H}_{t}$ denote the history of regimes in $N$ consecutive periods ending with period $t$,

equation*[equation* omitted — 87 chars of source]

and let $\mathcal{C}_{t}$ be the `collapsed'\ history, defined as

equation*[equation* omitted — 81 chars of source]

Hence

equation*[equation* omitted — 92 chars of source]

and

eqnarray*[eqnarray* omitted — 199 chars of source]

Let

equation*[equation* omitted — 102 chars of source]

be the probability of realisation of a particular history $\mathcal{H}_{t}$ conditional on information at time $t$.

Family of GPB Filters

The GPB algorithm \ of order $N$, denoted GPB(N), takes into account all $ h^{N}$ possible histories of the fixed length $N$, finishing at the current time period. It is implemented as follows.

Define

equation*[equation* omitted — 160 chars of source]

as the probability of the collapsed history, $\mathcal{C}_{t}$, conditional on information at time $t$.

algorithm[algorithm omitted — 33 chars of source]

Step 0. Start at $t=1$. Initialise $h^{N-1}$ versions of the state vector $\alpha _{t-1\mid t-1}^{\left( \mathcal{C}_{t-1}\right) },$ the MSE matrix $P_{t-1\mid t-1}^{\left( \mathcal{C}_{t-1}\right) },$ and probabilities $\mu _{t-1\mid t-1}^{\left( \mathcal{C}_{t-1}\right) }$, $ \mathcal{C}_{t-1}\in \mathbb{H}_{N-1,t-1}.$

Step 1. Compute $h^{N}$ standard KF forecasts to obtain

equation*[equation* omitted — 1,064 chars of source]

where

equation*[equation* omitted — 354 chars of source]

Compute the associated likelihood

equation*[equation* omitted — 405 chars of source]

Step 2. Compute probabilities $\mu _{t}^{(\mathcal{H}_{t})}$ according to\footnote{ This procedure is a generalised version of the Hamilton1989 filter.}

eqnarray*[eqnarray* omitted — 879 chars of source]

where in the last line we used approximation

equation[equation omitted — 170 chars of source]

and

eqnarray[eqnarray omitted — 531 chars of source]

where the sum is taken over all possible realisations of $\mathcal{H}_{t}.$

Step 3. Next, $h^{N}$ KF outputs \ are \ merged \ into $h^{N-1}$ \ using conditional probabilities $\Pr [s_{t-N+1}|Y_{t},\mathcal{C}_{t}]$ computed as:

equation*[equation* omitted — 348 chars of source]

Thus,

eqnarray[eqnarray omitted — 873 chars of source]

Updated $\alpha _{t\mid t}^{\left( \mathcal{C}_{t}\right) },$ $P_{t\mid t}^{\left( \mathcal{C}_{t}\right) }$ and $\mu _{t\mid t}^{\left( \mathcal{C} _{t}\right) }$ serve as initialisations for the next time period ($ t=2,3,...,n$) in a recursion at Step 1.

The $t$-increment likelihood

equation*[equation* omitted — 62 chars of source]

is computed using ((ref)) as part of the filter algorithm.

To \ continue \ the \ recursion \ to \ the \ end \ of \ the \ sample \ we \ only \ need \ to \ compute $\left \{ \alpha _{t\mid t}^{\left( \mathcal{C} _{t}\right) },P_{t\mid t}^{\left( \mathcal{C}_{t}\right) },\mu _{t\mid t}^{\left( \mathcal{C}_{t}\right) }\right \} _{\left( \mathcal{C}_{t}\right) \in \mathbb{H}_{N-1,t}}$\ at each step of the algorithm. These quantities are also used to compute the state vectors and the MSE matrices $\left \{ \alpha _{t\mid t},P_{t\mid t}\right \} _{t=1:n}$ for each time $t$, and the probability $\mu _{t}^{\left( s_{t}\right) }$ of the system being in regime $ s_{t}$ conditional on information at time $t$:

eqnarray[eqnarray omitted — 1,177 chars of source]

These objects can be computed outside of the recursion.

This algorithm works for any $N\geq 1$. Note that for $N=1$ we have $ \mathcal{C}_{t}=\varnothing ,\mathcal{H}_{t}=s_{t}.$ This implies that the GPB(1) algorithm considers possible regime histories only at their latest instant and merges all preceding regime sequences into one, using common initial conditions $\alpha _{t-1\mid t-1}$ at each time step.

Family of IMM Filters

IMM(N) maintains the dimensionality of histories at $h^{N}$ at every time period. This is achieved by mixing histories in every recursion of the algorithm immediately after making a step forward in time, which would otherwise result in an increase of dimension to $h^{N+1}.$ Effectively, at every $t$, mixing replaces $h^{N+1}$ extended `exact' histories by $h^{N}$ reduced approximate histories weighted by probabilities of transition from the earliest state, $s_{t-N}$, into the sequence of most recent states, $ \{s_{t-N+1},...,s_{t}\}$. These $h^{N}$ histories are then filtered and updated in the usual way.

A comparison of the IMM and the GPB shows that the dimension reduction is performed at the different stages of the algorithms.\footnote{ See Tables A1 and A2 in Appendix (ref).} In the IMM, mixing is done after the state update and before the measurement update, and in the GPB, collapsing is done after the state and measurement updates.\footnote{ We use mixing in the description of the IMM and collapsing in the description of the GPB following the convention in the literature.}

Let $\mathcal{Q}_{t|t-1}:=Q_{t|t-1}\otimes Q_{t-1|t-2}\otimes ...\otimes Q_{t-N+1|t-N}$ denote the grand transition matrix of format $h^{N}\times h^{N}.$

algorithm[algorithm omitted — 34 chars of source]

Step 0. Initialise $h^{N}$ versions of the state vector $\alpha _{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\right) },$ the MSE matrix $ P_{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\right) },$ and regime probabilities $\mu _{t-1\mid t-1}^{(\mathcal{H}_{t-1})}$, $\mathcal{H} _{t-1}\in \mathbb{H}_{N,t-1}.$ Compute $\mathcal{Q}_{t|t-1}.$

Step 1. Compute the mixing probabilities defined as

equation*[equation* omitted — 163 chars of source]

Note that

eqnarray*[eqnarray* omitted — 298 chars of source]

and

equation*[equation* omitted — 189 chars of source]

Therefore,

eqnarray*[eqnarray* omitted — 806 chars of source]

Step 2. Compute the mixed\ state vectors and MSE matrices for each history:

eqnarray[eqnarray omitted — 1,432 chars of source]

Here, $\hat{\alpha}_{t-1\mid t-1}^{\left( \ast ,\mathcal{H}_{t}\right) }$ is conditional on a particular sequence of regimes, and it is computed for all possible sequences, or histories, in $\mathbb{H}_{N,t}.$ When computing $ \hat{P}_{t-1\mid t-1}^{\left( \ast ,\mathcal{H}_{t}\right) }$\ in ((ref)) we take the sum over all possible sequences $\mathcal{H}_{t-1}$ of length $N$ ending at $t-1$ such that they overlap with $\mathcal{H}_{t}$ between times $t-N+1$ and $t-1.$\ Note that once states and MSEs are mixed, the memory of $s_{t-N}$ is `cleared', so we put an asterisk in place of the now non-existent index $s_{t-N}=\mathcal{H}_{t-1}\backslash (\mathcal{H} _{t}\cap \mathcal{H}_{t-1}).$ This reduces the dimensionality from $h^{N+1}$ to $h^{N}.$

Step 3. For each history compute the standard KF to obtain

equation*[equation* omitted — 1,082 chars of source]

where

equation*[equation* omitted — 354 chars of source]

Compute the associated likelihood:

align*[align* omitted — 410 chars of source]

Step 4. Update the probabilities $\mu _{t\mid t}^{(\mathcal{H} _{t})} $,

eqnarray*[eqnarray* omitted — 1,012 chars of source]

where in the last line we used

eqnarray[eqnarray omitted — 646 chars of source]

The KF outputs and the updated probabilities, $\left \{ \alpha _{t\mid t}^{\left( \mathcal{H}_{t}\right) },P_{t\mid t}^{\left( \mathcal{H} _{t}\right) },\mu _{t\mid t}^{(\mathcal{H}_{t})}\right \} $, serve as initialisations for the next time step in a recursion. The $t$-increment likelihood is

equation*[equation* omitted — 60 chars of source]

and it is computed using formula ((ref)) as part of the filtering algorithm. The state vectors, the MSE matrices, and updated regime probabilities $\left \{ \alpha _{t\mid t},P_{t\mid t},\mu _{t\mid t}^{\left( s_{t}\right) }\right \} _{t=1:n}$ for each time $t$ are computed using the same formulae ((ref))-((ref)) as in the GPB algorithm.

Smoothing

After estimating the states and regime probabilities through forward recursion, we can improve the inference on $s_{t}$ and $\alpha _{t}$ using the information from the entire sample. This process, known as smoothing, is usually conducted by backward recursion. However, since smoothing algorithms employ approximations, the smoothed estimates may not necessarily be more precise than the filtered and updated estimates for every time period. Thus, the overall performance of smoothing algorithms is evaluated using simulations.

A practical algorithm for computing smoothed probabilities for a KN-GPB(2) filter is detailed in Kim1994. In this paper we generalise it for arbitrary length of history to make it applicable to filters of higher order.

Smoothing state vectors, even in single-regime models, can be challenging, and is even more so in models with multiple regimes. Kim1994 introduces an algorithm specifically designed to work with the KN-GPB(2) filter. However, this algorithm is computationally unstable as it requires inverting large auxiliary matrices. Existing smoothers developed for engineering applications typically exploit measurement errors and require the invertibility of matrix $H_{s_{t}}=g_{s_{t}}g_{s_{t}}^{\prime }$ , a condition often not met in economic applications.\ In this section, we adapt a single-regime smoothing algorithm proposed by DurbinKoopman2012, based on DeJong1988, for use in a Markov-switching multiple-regime model with arbitrary history lengths. This adapted algorithm requires only matrix inversions that are part of the corresponding filter and would have been computed at the filtering stage.

Smoothed Probabilities

Smoothed probabilities are computed using the total probability theorem. The probability of history $\mathcal{H}_{t}$ conditional on the information contained in the full sample, $Y_{n}$, can be written as

equation*[equation* omitted — 139 chars of source]

To compute $\Pr [\mathcal{H}_{t},s_{t+1}\mid Y_{n}]$, we use the following approximation:

align*[align* omitted — 926 chars of source]

Upon substitution, we get

equation[equation omitted — 278 chars of source]

The smoothing algorithm is implemented by backward recursion as follows.

algorithm[algorithm omitted — 39 chars of source]

Step 0. Initialise $\mu _{n\mid n}^{\left( s_{n}\right) }=\func{Pr} \left[ s_{n}\mid Y_{n}\right] ,$ $s_{n}=1,...,h.$

Step 1. For $t=n-1$ use ((ref)) to compute the smoothed probability of $\mu _{t\mid n}^{(\mathcal{H}_{t})}$ for history $\mathcal{H} _{t}$ .

Step 2. Compute smoothed probabilities of each regime:

equation*[equation* omitted — 218 chars of source]

Use $\mu _{t\mid n}^{\left( s_{t}\right) }$ to initialise the algorithm for $ t=n-2.$

Smoothed Variables

The smoother is based on the properties of the joint Gaussian distribution of the forecast errors of the vector of latent state variables and the estimation errors of the vector of observations produced by the filter.

By definition, smoothed state vectors and MSE matrices are:

eqnarray[eqnarray omitted — 529 chars of source]

Define the forecast error of the state vector at time $t$ with history $ \mathcal{H}_{t}$ as

equation[equation omitted — 147 chars of source]

\qquad Then,

equation[equation omitted — 223 chars of source]

Define the Kalman gain matrix:

equation[equation omitted — 210 chars of source]

To calculate $\alpha _{t\mid n}^{\left( \mathcal{H}_{t}\right) }$ defined in ((ref)), we split the history into two components at $t-1$ and use the formula for the conditional mean of multivariate Gaussian distribution:

eqnarray*[eqnarray* omitted — 805 chars of source]

where we used

equation*[equation* omitted — 333 chars of source]

So, finally,

equation[equation omitted — 328 chars of source]

Similarly, the formula for conditional variance of multivariate Gaussian distribution applied to ((ref)) yields:

eqnarray*[eqnarray* omitted — 966 chars of source]

so that

equation[equation omitted — 421 chars of source]

In expressions ((ref)) and ((ref)) we do not specify the future regime sequences starting from $s_{t}$ under the summation. We introduce them in the calculations of expectations $\mathbb{E}\left[ \cdot \mid \cdot \right] $ for every step going backward, as shown later.

For now, we will need the following recursion for $\xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }.$ The recursion is slightly different for the two families of filters.

lemma1. For GPB(N) filter \begin{equation} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\sum_{s_{t-N}=1}^{h}\Pr [s_{t-N}|Y_{t-1},\mathcal{C}_{t-1}]\left( I-K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }Z_{s_{t-1}}\right) \xi _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }+\omega _{t-1}, \end{equation} where \begin{equation*} \omega _{t-1}=R_{s_{t}}\eta _{t}-T_{s_{t}}\sum_{s_{t-N}=1}^{h}\Pr [s_{t-N}|Y_{t-1},\mathcal{C}_{t-1}]K_{t-1\mid t-2}^{\left( \mathcal{H} _{t-1}\right) }g_{s_{t-1}}\varepsilon _{t-1}. \end{equation*} 2. For IMM filter \begin{equation} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\sum_{\mathcal{H} _{t-1}}\func{Pr}\left[ \mathcal{H}_{t-1}\mid Y_{t-1},\mathcal{H}_{t}\right] \left( I-K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }Z_{s_{t-1}}\right) \xi _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }+\omega _{t-1}, \end{equation} where \begin{equation*} \omega _{t-1}=R_{s_{t}}\eta _{t}-T_{s_{t}}\sum_{\mathcal{H}_{t-1}}\func{Pr} \left[ \mathcal{H}_{t-1}\mid Y_{t-1},\mathcal{H}_{t}\right] K_{t-1\mid t-2}^{\left( s_{t-1}\right) }g_{s_{t-1}}\varepsilon _{t-1}. \end{equation*}
proofFor GPB(N) we have \begin{equation*} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=\alpha _{t}-\alpha _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\left( \alpha _{t-1}-\alpha _{t-1\mid t-1}^{\left( \mathcal{C}_{t-1}\right) }\right) +R_{s_{t}}\eta _{t}, \end{equation*} and, using $\alpha _{t-1\mid t-1}^{\left( \mathcal{C}_{t-1}\right) }$ from equation ((ref)), \begin{equation} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\left( \alpha _{t-1}-\sum_{s_{t-N}=1}^{h}\Pr [s_{t-N}\mid Y_{t-1},\mathcal{C}_{t-1}]\alpha _{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\right) }\right) +R_{s_{t}}\eta _{t}. \end{equation} Similarly, for IMM(N) we have \begin{equation*} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\left( \alpha _{t-1}-\hat{\alpha}_{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\mid \mathcal{H} _{t}\right) }\right) +R_{s_{t}}\eta _{t} \end{equation*} and using $\hat{\alpha}_{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\mid \mathcal{ H}_{t}\right) }$ from ((ref)), \begin{equation} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\left( \alpha _{t-1}-\sum_{\mathcal{H}_{t-1}}\func{Pr}\left[ \mathcal{H}_{t-1}\mid Y_{t-1}, \mathcal{H}_{t}\right] \alpha _{t-1\mid t-1}^{\left( \mathcal{H} _{t-1}\right) }\right) +R_{s_{t}}\eta _{t}. \end{equation} Denote \begin{equation*} M\left( \psi \right) =\left \{ \begin{array}{ccc} \Pr [\psi \mid Y_{t-1},\mathcal{C}_{t-1}], & \psi =s_{t-N}, & for GPB(N), \\ \func{Pr}\left[ \psi \mid Y_{t-1},\mathcal{H}_{t}\right] , & \psi =\mathcal{H }_{t-1}, & for IMM(N). \end{array} \right. \end{equation*} Then expressions ((ref)) and ((ref)) can be written in the same form, \begin{equation*} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) }=T_{s_{t}}\left( \alpha _{t-1}-\sum_{\psi }M\left( \psi \right) \alpha _{t-1\mid t-1}^{\left( \mathcal{H}_{t-1}\right) }\right) +R_{s_{t}}\eta _{t}, \end{equation*} and the rest of the proof is identical for both families of filters.\newline Use the KF update for $\alpha _{t-1\mid t-1}^{\left( \mathcal{H} _{t-1}\right) }$ and the definition of Kalman gain ((ref)) for $ K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }$ to rewrite the last expression as: \begin{eqnarray*} \xi _{t\mid t-1}^{\left( \mathcal{H}_{t}\right) } &=&T_{s_{t}}\left( \alpha _{t-1}-\sum_{\psi }M\left( \psi \right) \right. \\ &&\left. \times \left( \alpha _{t-1\mid t-2}^{\left( \mathcal{H} _{t-1}\right) }+P_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }Z_{s_{t-1}}^{\prime }\left[ F_{t-1\mid t-2}^{\left( \mathcal{H} _{t-1}\right) }\right] ^{-1}v_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }\right) \right) +R_{s_{t}}\eta _{t} \\ &=&T_{s_{t}}\sum_{\psi }M\left( \psi \right) \left( \alpha _{t-1}-\alpha _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }\right) \\ &&-T_{s_{t}}\sum_{\psi }M\left( \psi \right) K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }v_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }+R_{s_{t}}\eta _{t} \end{eqnarray*} Next, use the KF output for $v_{t-1\mid t-2}^{\left( \mathcal{H} _{t-1}\right) }$ along with the definition ((ref)) for $\xi _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }$ and equation ((ref)) for $ y_{t-1} $ to obtain the recursions in Lemma (ref): \begin{eqnarray*} \xi _{t\mid t-1}^{\left( \mathcal{H}_{N,t}\right) } &=&T_{s_{t}}\sum_{\psi }M\left( \psi \right) \left( \alpha _{t-1}-\alpha _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }\right) \\ &&-T_{s_{t}}\sum_{\psi }M\left( \psi \right) K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }\left( y_{t-1}-Z_{s_{t-1}}\alpha _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }-c_{y,s_{t-1}}\right) +R_{s_{t}}\eta _{t} \end{eqnarray*} \begin{eqnarray*} &=&T_{s_{t}}\sum_{\psi }M\left( \psi \right) \xi _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) } \\ &&-T_{s_{t}}\sum_{\psi }M\left( \psi \right) K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }Z_{s_{t-1}}\xi _{t-1\mid t-2}^{\left( \mathcal{H} _{t-1}\right) } \\ &&+R_{s_{t}}\eta _{t}-T_{s_{t}}\sum_{\psi }M\left( \psi \right) K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }g_{s_{t-1}}\varepsilon _{t-1} \\ &=&T_{s_{t}}\sum_{\psi }M\left( \psi \right) \left( I-K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }Z_{s_{t-1}}\right) \xi _{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }+\omega _{t-1}^{\left( \mathcal{H} _{t-1}\right) } \end{eqnarray*} where we used the notation \begin{equation*} \omega _{t-1}=R_{s_{t}}\eta _{t}-T_{s_{t}}\sum_{\psi }M\left( \psi \right) K_{t-1\mid t-2}^{\left( \mathcal{H}_{t-1}\right) }g_{s_{t-1}}\varepsilon _{t-1}. \end{equation*}

Note that in this derivation for GPB(N) the sum is taken over all possible regimes at time $t-N$ when $s_{t-N}$ is unknown. If the regime $ s_{t-N}$ is known, this recursion is given by

equation[equation omitted — 264 chars of source]

Similarly, for IMM, when $\mathcal{H}_{t-1}=\mathcal{\tilde{H}}_{t-1}$ is known, then

equation[equation omitted — 317 chars of source]

The remaining derivations are identical for GPB and IMM.

We apply formulas ((ref)) and ((ref)) recursively, starting from the observation at the final period, $n$, in regime $s_{n}$:

eqnarray*[eqnarray* omitted — 798 chars of source]

where

equation*[equation* omitted — 196 chars of source]

and

eqnarray*[eqnarray* omitted — 937 chars of source]

where

equation*[equation* omitted — 159 chars of source]

Next, we move one step back to $t=n-1$.

eqnarray[eqnarray omitted — 2,493 chars of source]

Similar computations yield

eqnarray[eqnarray omitted — 1,299 chars of source]

In \ \ these \ \ derivations \ \ \ we \ \ used $P_{n-1\mid n-2}^{\left( \mathcal{H}_{n-1}\right) }$ $=$ $\mathbb{E}\left[ \xi _{n-1\mid n-2}^{\left( \mathcal{H}_{n-1}\right) }\xi _{n-1\mid n-2}^{\left( \mathcal{H} _{n-1}\right) \prime }\mid Y_{n-2},\mathcal{H}_{n-1},s_{n}\right] $ $=$ $ \mathbb{E}\left[ \xi _{n-1\mid n-2}^{\left( \mathcal{H}_{n-1}\right) }\xi _{n-1\mid n-2}^{\left( \mathcal{H}_{n-1}\right) \prime }\mid Y_{n-2}, \mathcal{H}_{n-1}\right] $ as conditioning on $s_{n}$ becomes irrelevant.

Equations ((ref)) and ((ref)) can be written as:

eqnarray*[eqnarray* omitted — 490 chars of source]

where, using approximation $\Pr \left[ s_{n}\mid Y_{n-2},\mathcal{H}_{n-1} \right] \simeq Q\left( s_{n-1},s_{n}\right) ,$ we express $r_{n-1\mid n-2}^{\left( \mathcal{H}_{n-1}\right) }$ and $N_{n-1\mid n-2}^{\left( \mathcal{H}_{n}\right) }$ recursively:

eqnarray*[eqnarray* omitted — 711 chars of source]

Here

equation*[equation* omitted — 150 chars of source]

Continuing in the same way, we can summarise the procedures in the following algorithm.

algorithm[algorithm omitted — 32 chars of source]

Step 0. Initialise the smoother by setting $r_{n\mid n-1}^{\left( \mathcal{H}_{n}\right) }=Z_{s_{n}}^{\prime }\left[ F_{n\mid n-1}^{\left( \mathcal{H}_{n}\right) }\right] ^{-1}v_{n\mid n-1}^{\left( \mathcal{H} _{n}\right) }$, $\ \ N_{n\mid n-1}^{\left( \mathcal{H}_{n}\right) }=Z_{s_{n}}^{\prime }\left[ F_{n\mid n-1}^{\left( \mathcal{H}_{n}\right) } \right] ^{-1}Z_{s_{n}},$ $\mathcal{H}_{n}\in \mathbb{H}_{N,n}$. Here $\alpha _{n\mid n}^{\left( \mathcal{H}_{n}\right) }$ is the output of the corresponding filter at $t=n$.

Step 1. Compute the smoothed estimates of the state vector an the MSE for each history $\mathcal{H}_{t}$, using recursion:

eqnarray*[eqnarray* omitted — 1,256 chars of source]

for $t=n-1,n-2,...,1.$

Use the smoothed probabilities, $\left \{ \mu _{t\mid n}^{(\mathcal{H} _{t})}\right \} $, to compute the smoothed state vectors and MSE matrices:

eqnarray*[eqnarray* omitted — 261 chars of source]

Validating the Filters

Model and Parameterisation

To compare the performance of filters and smoothers, we use the model developed in\newline \citet*{FVGQRR}, hereafter referred to as FGR2015. It is a relatively standard medium-scale New Keynesian DSGE model, which we modify to investigate the aspects of good luck and good policy.

The model consists of a household sector, firms, and a monetary authority. Households derive utility from consumption relative to their habit stock and from leisure. They supply differentiated labour to monopolistically competitive firms and choose wages subject to Calvo wage-setting friction. Firms produce differentiated output using capital, labour, and a neutral technology process. They set prices, also subject to Calvo pricing frictions. The capital stock evolves in the usual way, except for the inclusion of embodied technology in new investment goods. The model is closed by imposing a Taylor-type rule for the monetary authority. We present the full specification of the model in Appendix (ref).

We base the structural parameters of the model on the estimates reported in FGR2015; see column (1) in Table C1 in Appendix (ref). Our treatment of policy and shock volatilities is different from FGR2015, who estimated a single-regime nonlinear policy function and a single-regime stochastic volatility process. We introduce two Markov-switching processes into the model. The first, $S_{P,t}$, governs policy parameters in the following monetary policy rule:

equation[equation omitted — 440 chars of source]

The literature typically categorizes monetary policy approaches into hawkish and dovish modes, characterized by more and less aggressive responses to inflation, respectively. Accordingly, we assume that the $\gamma -$ parameters are high in state $S_{P,t}=1$ (hawkish state) and low in state $ S_{P,t}=2$ (dovish state). We explain below how we chose these values. The second two-state process, $S_{V,t},$ governs the shock volatilities for all shocks, including the policy shock in equation ((ref)).

Monte-Carlo Simulations Design

In our simulations, we aim to differentiate between periods of infrequent large shocks and periods of more frequent regular shocks. We set the probability of remaining in the low volatility state to 0.95. This parameterisation implies an average of 20 quarters between high shocks, with a standard deviation of 19 quarters.\footnote{ If probability to leave one of the two Markov states is $q$, then the expected length of stay in this state is $1/q$ with the standard deviation of $\sqrt{1-q}/q.$} This probability accurately reflects the fact that recessions in the US have occurred approximately every 8-10 years since the end of World War II. We set the probability of staying in the high volatility state to 0.8, resulting in an average duration of high shock periods of 5 quarters (with a standard deviation of 4.5 quarters). Interpreting periods of large shocks as recessions suggests that a typical recession lasts slightly for less than a year, a duration that our parameterisation appropriately captures.

In formulating our policy model, we applied considerations similar to those used in the assumptions in the shock volatility experiments. The existing literature tends to report that hawkish policies have been predominant since the 1980s, spanning approximately 40 years.\footnote{ See e.g. BianchiMelosiAER2017, \citet*{CKL2017}.} However, considering the data starting from 1955 and acknowledging the evident dovish tendencies since 2008, we infer that the time split between these regimes is roughly equal. Therefore, we assume symmetric diagonal elements in the transition probability matrix. As the benchmark case, we calibrate the probability to remain in either of these states at 0.95. This implies an average of 20 quarters between policy changes, allowing for a wide range of durations between policy shifts. In addition, we consider an alternative calibration, with this probability set to 0.1. All transition matrices are presented in Table (ref).

table[table omitted — 757 chars of source]

As for the policy coefficients that are time-varying (or depend on the state), we describe the hawkish policy mode with feedback on inflation $ \gamma _{\pi }^{Base}=1.7$ in the hawkish state and $\gamma _{\pi }^{Base}=0.9$ in the dovish state, consistent with findings in other studies \footnote{ See, e.g. BianchiAER2012, \citet*{Chang2021}, \citet*{CLL2022}.}. We also consider an alternative parameterisation where these two feedbacks are less distinct, as shown in Table (ref). In these simulations, we keep the feedback on output and the interest rate smoothing parameter the same in both hawkish and dovish states.

As reported in column (1) in Table C1, the standard deviations of all shocks in the low-volatility state, $S_{V,t}=1,$ are set to be equal to the mean estimates of corresponding variables in FGR2015, and they are doubled in the high-volatility state, $S_{V,t}=2.$

In order to generate artificial data, we solve and simulate this non-linear model using a perturbation approach with the functional iteration algorithm developed for RISE$^{\textcopyright}$ \ (MaihRISE2015).

We chose to generate 500 samples of 1,000 observations each. We consider output growth, price inflation, wage inflation, the Federal Funds rate, and the relative price of investment goods as observable variables. The latent variables are listed in Table (ref) and other relevant tables. We then use the simulation results to investigate the performance of the discussed filters, controlling for the sample length. Within each sample, we use the initial 300 observations as a proxy for a typical real-life scenario with post-WW2 quarterly data, where the influence of initial conditions can be substantial. Additionally, we analyze the full sample of 1000 observations, in which we expect the impact of initial conditions to be significantly diminished.

Results

Evaluation Criteria

We need some criteria to rank the filters for practical purpose, based on their accuracy and speed. For accuracy, or goodness-of-fit, in our exercise we cannot use measures linked to the likelihood $L_{t}=\log f\left( y_{t}\mid Y_{t-1}\right) $ returned by the filters. This is because different filters employ different approximations when computing the likelihood, and so comparison based on this measure is not compelling for comparison of the filters. An alternative and, perhaps, more straightforward approach in our case is to use root mean squared errors (RMSE) for each latent variable $\alpha _{t}$, given by the formula

equation*[equation* omitted — 182 chars of source]

We\ present the comparison of the accuracy of the filters based on the updated variables ($\varphi =t\mid t$) and smoothed variables ($\varphi =t\mid n)$ in Tables (ref)-(ref).\footnote{ In computing RMSEs, we normalise all variables, except state probabilities, by their steady-state levels, as in this model the steady state is identical for all regimes.} Here, $n$ is the length of each data sample, and $n_{sim}$ is the number of simulations.

The Best Performing Filter

Table (ref) shows the results for four filters: the IMM(1) and GPB(N) for $N=1,2,3$, which includes the KN filter as it is equivalent to GPB(2).\footnote{ Appendix (ref) presents selected filtering and smoothing algorithms in a form convenient for implementation.} Our simulations reveal that increasing the order of the GPB(N) filter beyond N=3 offers no practical value. We do not present results for IMM(2) as it does not noticeably improve accuracy of the IMM(1).

table[table omitted — 2,541 chars of source]

We focus on the updated variables, as these variables contribute to the likelihood used in estimation. The average RMSEs (denoted as $\mathcal{R} _{t\mid t}$) for all 500 draws in the Monte Carlo experiment are presented in columns (1)-(4) of Table (ref). They vary in magnitude, reflecting findings similar to those in BinningMaih2015, where it is observed that highly persistent latent variables, such as capital, pose greater challenges for reconstruction.

The relative RMSEs in columns (5)-(8) are computed by dividing the RMSE for each variable by the lowest RMSE for that particular variable across investigated filters. In other words, for the best-performing filter it has the value of 1, while for all other filters its value is greater than one.

figure[figure omitted — 198 chars of source]
table[table omitted — 795 chars of source]

These RMSEs\ are visualised by a red dash-dotted line in Figure (ref), illustrating the recovery of latent variables and probabilities of being in a particular Markov state in one particular simulation. The true values are shown by the solid black lines. We plot only the initial 300 observations for clarity of visualisation.

In terms of computational burden, IMM{ (1)} has an advantage over KN-GPB(2) as it works with $h$ histories, rather than with $h^{2}$. Panel A of Table (ref) shows indicative computational times for these two filters, both independently and in conjunction with the corresponding smoother.\footnote{ These numbers are achieved on a Ryzen 3950X with 64GB RAM using MATLAB$^{ \textcopyright}$ R2022b.} These times serve merely as an indication of computational speed, as all filters implemented in RISE$^{\textcopyright}$ perform additional tasks beyond algorithm computation, which, even if not used, hold the potential to reduce speed.\footnote{ This includes checking for and accomodating properties such as time-varying states and parameters, missing observations, nonstationarity, and occasionally-binding constraints. See Appendix (ref) for further notes on implementation.} It is important to note that at the estimation stage, where speed is particularly crucial, smoothing is not applied.

One can see in panel B of Table (ref) how quickly the computation burden of IMM rises with higher orders. This is because the algorithm keeps track of all possible histories of fixed length where the histories contain all possible combinations of regimes in every time period of recursion. Therefore, the number of terms containing probabilities of different combinations of regimes is much bigger in IMM than in GPB.

One can reduce the computational burden in IMM(N) by using approximation similar to ((ref)). However, because of the repeated use the disrepancy created by this approximation accumulates and leads to lower accuracy, especially for higher $N$.

On the balance between accuracy and speed, it is clear that IMM{ (1)} dominates the GPB(N) family of filters. Based on that, we argue that in practical applications, IMM{ (1)} is the best. In what follows, we use IMM to denote IMM(1).

Updating and Smoothing

To visualize the effect of smoothing, in Figure (ref) we plot updated and smoothed probabilities and latent variables, alongside their true values. When comparing all lines, we see that smoothing reduces high-frequency noise in the recovered probabilities and often helps to identify the timing of regime changes more accurately. It is also apparent that the initial gap between the updated and actual values of latent variables is substantially corrected, although the improvement is not uniform across the entire sample. There are time periods where smoothing does not improve these particular variables at all. Notably, while the impact of initial conditions on the filter's effectiveness for economic variables is very clear, such an effect is less prominent for probabilities.

table[table omitted — 766 chars of source]

Figure (ref) illustrates the work of smoothing for the IMM filter. For all considered filters, Table (ref) reports the fractions of RMSEs that is removed by smoothing, $1-\frac{\mathcal{R}_{t\mid T}}{\mathcal{ R}_{t\mid t}}.$

While the RMSEs for some variables are only improved by 4%, for some others the improvement is as large as 47%, and the average improvement is about 25%. For state probabilities, the average improvement is 16%. Notably, the less computationally intensive smoothers for IMM and GPB(1) improve accuracy better than more complex algorithms for higher order of GPB filters.

Information

The following experiments aim to address the importance of working with longer series of data. In the first experiment, we use the IMM filter; other filters show very similar results. Column (1) of Panel A in Table (ref)\ presents RMSEs for updated variables using the first 300 observations in each simulation. Columns (2) and (3) present RMSEs for smoothed variables for the first 300 observations, where smoothing starts from the last of these 300 observations in column (2) and from the last of all 1000 observations in \ column (3).\ The comparison is consistent with the intuition that more information improves accuracy. However, this intuition is not necessarily true in our setting because filtering and smoothing procedures involve numerous approximations. It is remarkable that, despite these approximations, the improvement in accuracy is substantial: close to 10% for some variables.

table[table omitted — 1,577 chars of source]

Panel B of Table (ref) shows an improvement in the RMSEs from smoothing \ obtained in the second experiment. Here we explore different sample sizes, $n\in \{300,250,200,100\}$. We know that RMSEs of updated variables are larger in shorter samples. One might expect that the efficacy of smoothing will also deteriorate in shorter samples. However, Panel B reveals that this is not the case, except for $n=100$. This suggests that the sample size should be in excess of 100 and, perhaps, at least 200 to ensure that the smoother improves accuracy.

Another important observation is that there is no sample size effect for the smoothing of state probabilities, as can be seen in the last two rows of Panel B. This is consistent with the results presented in Figure (ref), where the effect of initial conditions is only observed for latent economic variables: in a shorter sample initial conditions play bigger role, but this not the case for probabilities.

Policy States

For the next experiment, we simulate artificial data for less and more distinct policy states as measured by different probabilities of remaining in a given policy state in the next period, and by larger difference in the feedback coefficient $\gamma _{\pi }$ in two policy states. Table (ref) reports the results.

table[table omitted — 560 chars of source]

We conclude that the greater the difference between the states, the better is their identification. This is true for both updated and smoothed policy state probabilities.

Model Misspecification

We investigate several cases of the model misspecification relevant for the Markov-switching nature of our model. We assume that the true data-generating process contains two Markov-switching processes as described above, but a researcher only considers one of them, either in policy or in volatility.

figure[figure omitted — 175 chars of source]
table[table omitted — 1,944 chars of source]

In the first scenario, we assume that the researcher believes in a single policy stance: the hawkish state.\footnote{ This is the common assumption in constant-parameter DSGE model estimations, see e.g. \citet*{CKL2017}} We then execute the filtering and smoothing algorithm with $\gamma _{\pi }^{Base}$, which is the correct policy feedback but only for one of the two policy Markov states. Panel A in Figure (ref) illustrates the outcomes of updating and smoothing for the same simulation, focusing on the initial 300 observations. The updated and smoothed variables are shown to accurately identify the patterns in the data, although with larger errors than in the correctly specified model.

One can get further insights from Table (ref) by comparing the RMSEs for updated and smoothed variables obtained from 500 simulations of the entire sample of 1000 observations in columns (1) and (2). Despite effectively handling data patterns, RMSEs for smoothed latent variables show a substantial increase. However, the RMSEs for smoothed heteroskedasticity state probability show only a small increase, as Figure (ref) also demonstrates.

In the second scenario, we assume that the researcher believes the volatility is always low. Panel B of Figure (ref), which shows the results of this scenario, confirms that the filter correctly identifies the patterns in the data. Column (3) in Table (ref) further supports this observation, as it shows a much smaller increase in RMSEs compared to column (1), and even smaller estimation errors for some variables. At the same time, the RMSE for smoothed probability of a policy state is higher than in the correctly specified model. This suggests that incorrectly specifying shock volatilities significantly worsens the identification of policy states.

In the final experiment, reported in column (4), we revisit the second scenario, but this time we assume that the researcher believes the volatility is always high. Although the RMSEs for updated latent variables in column (4) are higher than those in column (1), the RMSEs for smoothed variables are sometimes lower than in the correctly specified model. The unexpectedly superior performance of the misspecified model after smoothing can be attributed to the larger variance of shocks. By allowing for a large variance in the shocks distribution, it accommodates both large and small shocks. The smoother then revises the estimated values using the complete sample and adjusts the estimates by factoring in information about the realized shocks.

Interim Summary

Overall, the findings in this section demonstrate the effectiveness of the canonical IMM filter, particularly when combined with the appropriate smoother, in enhancing the accuracy and efficiency of Bayesian estimation of state-space models.

The canonical IMM outperforms the Kim and Nelson filter in terms of computational speed while delivering comparable accuracy. The implementation of the new smoothing algorithm with the IMM filter substantially enhances precision in estimating latent variables, reducing errors by approximately 25%. We do not find any substantial improvement in accuracy when\ using higher order filters in our example. It is hard to predict whether the same will be true for other models.

Our simulations confirm that, despite approximations, adding more information improves the performance of the suggested filtering-smoothing procedure. We find that, as long as the sample length remains above 200 observations, there is no reduction in the smoother's efficacy in reducing RMSEs for updated variables. We find that the filter identifies probabilities of more distinct policy regimes with higher accuracy.

Finally, we demonstrate that we can still successfully recover latent variables even when the policy or shock volatility regimes in the model are misspecified.

Having established the superiority of the canonical IMM paired with the matching smoother, we focus on this filter and smoother in the empirical application.

Empirical Application

In this section, we further investigate the practicality of the IMM filter with the corresponding smoother. We estimate a modified version of the FGR2015 model but using the same data for 1959Q2-2013Q4 as in that paper (see Table C2 in Appendix (ref)). In our estimation we impose relatively wide priors and use the Artificial Bee Colony algorithm by KarabogaBasturk2007 for global optimisation.

Table (ref) displays the estimated mode of the distribution of transition probabilities and policy parameters. We present the remaining parameters in Table C1 in Appendix (ref).

table[table omitted — 650 chars of source]

We note that both regime-switching processes are highly persistent, and therefore their identification is likely to be correct, as suggested by our simulation results. The policy process, in particular, shows that there is only a 2% probability of leaving the hawkish state.

figure[figure omitted — 185 chars of source]

Panels A and B in Figure (ref) report the smoothed probabilities of being in the dovish state and the high volatility state. We used the canonical IMM at the estimation stage and six different filters at the filtering stage.

One can notice that the lines plotted for six filters are very close to one another. The GPB filters of order 2 to 5 produce nearly identical results and they are also extremely close to those produced by the canonical IMM. This suggests, first, that using a more computationally intensive higher-order GPB filter does not necessarily improve regime identification compared to the KN-GPB(2) filter, and, second, that the canonical IMM and the KN filter are practically identical in accuracy. While GPB(1) stands out as less accurate, it still identifies all main events similarly to the other filters.

Panel A shows the probability of being in the dovish policy state. Note that it indicates that our approach succeded in identifying all major changes in the US post-war policy stance: the Great Inflation, the Volcker Disinflation, the Great Moderation, the Great Financial Crisis, and the subsequent Zero Lower Bound (ZLB) period. We did not assume a special regime for ZLB monetary policy but identify this period as a dovish state.

Panel B shows the probability of being in the high volatility state. Our approach correctly identifies most of the recessions and suggests that the pre-1990s period experienced larger shocks than the more recent past.

For panels C and D the dataset includes the period 1947Q2-2023Q3 (see Appendix (ref) for details). The extended data covers a longer period, adding observations at the beginning, which should improve the identification of the Great Inflation episode, and at the end, which includes the post-Covid period with rising inflation in 2022-23. In these two panels we only show the results obtained using the IMM filter (with the associated smoother) to this extended dataset.

The message is similar to what is suggested by panels A and B. We identify the dovish state during the ZLB and a shift to hawkish policy a year after the ZLB lift-off. In addition, we see the return to the dovish policy during the Covid-19 pandemic which lasted until 2023Q1, at which time tough measures against inflation were taken. The post-Covid period is also characterised by relatively large shocks.

Conclusions

Our focus in this paper has been on improving multiple-regime Bayesian filtering techniques, alongside the development of multiple-regime smoothers.

We introduced the family of IMM filters, along with an extension of the Kim and Nelson filter, to accommodate tracking of longer regime histories. In addition, we developed a robust smoothing algorithm that can be adapted to these extended filters. Our simulation exercises demonstrate that the IMM filter with our proposed smoother deliver the best combination of computational speed and accuracy in a prototypical macroeconomic application of Bayesian filtering.

Our paper provides a comprehensive toolkit for researchers working with complex macroeconomic models. We demonstrate its practical relevance in an empirical application using a NK DSGE\ model with long U.S. macroeconomic time series.