Regime-Switching Density Forecasts Using Economists' Scenarios

Extracted source text · arXiv 2110.13761

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}
\usepackage{amsmath}
\usepackage[affil-it]{authblk}
\usepackage{float}
\usepackage{subcaption}
\usepackage{verbatim}
%\usepackage{subfigure}
\usepackage{enumitem}
\usepackage{authblk}

\usepackage{titlesec}
\usepackage[titletoc,toc,title]{appendix}
\titlespacing*{\section}{0pt}{25pt}{17pt}
\titlespacing*{\subsection}{0pt}{15pt}{12pt}


\usepackage{array} 
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}} % this defines hidden (H) column in tables


\usepackage[bottom]{footmisc} %puts footnotes at bottom of the page

\interfootnotelinepenalty=10000



%\DeclareMathAlphabet{\mathbit}{OT1}{cmr}{bx}{it}


\usepackage{pdflscape}

\usepackage{hyperref}
\hypersetup{colorlinks=true,urlcolor=blue,citecolor=blue,linkcolor=blue}  

%\usepackage[font={normalsize,bf}]{caption}
%\captionsetup{format=upper}
%\usepackage[labelsep=period]{caption}
%\usepackage[font={small}]{subcaption}


\usepackage{graphicx}
\graphicspath{{figures/}}



%Margins:
\marginparwidth 0pt 
\oddsidemargin 10pt 
%\evensidemargin 0.0in 
%\marginparsep 0pt
\topmargin 0pt 
\textwidth 440pt 
\textheight 620pt

%Spacing equations:
\makeatletter
\g@addto@macro\normalsize{%
  \setlength\abovedisplayskip{20pt}
  \setlength\belowdisplayskip{20pt}
  \setlength\abovedisplayshortskip{20pt}
  \setlength\belowdisplayshortskip{20pt}
}
\makeatother


%\makeatletter
%\renewcommand\@biblabel[1]{}
%\makeatother
%

% Line spacing
\linespread{1.3}

% Remove line before footnotes:
%\renewcommand*\footnoterule{}
%\addtolength{\skip\footins}{\baselineskip}


\title{Optimal Regime-Switching Density Forecasts}
\author{Graziano Moramarco\thanks{University of Bologna, Department of Economics - Piazza Scaravilli 2, 40126 Bologna, Italy. \newline E-mail: graziano.moramarco@unibo.it.}}
\affil{University of Bologna}
\date{}


\begin{document}
	



\maketitle

    \begin{abstract}
    
		This paper proposes an approach for enhancing density forecasts of non-normal macroeconomic variables using Bayesian Markov-switching models.
		Alternative views about economic regimes are combined to produce flexible forecasts, which are optimized with respect to standard objective functions of density forecasting. The optimization procedure explores both forecast combinations and Bayesian model averaging. In an application to U.S. GDP growth, the approach is shown to achieve good accuracy in terms of average predictive densities and to produce well-calibrated forecast distributions. 
		% 
		The proposed framework can be used to evaluate the contribution of economists' views to density forecast performance. In the empirical application, we consider views derived from the Fed macroeconomic scenarios used for bank stress tests.  
		
        \vspace{0.5cm}

        {\bf Keywords:} Density forecasts, Markov-switching models, forecast combinations \\
     	{\bf JEL Codes:} C11, C13, C22, C53

        
    \end{abstract}


    
    
    
    \pagebreak




    \section{Introduction}
    
    In recent years, it has become essential for forecasting institutions to characterize the uncertainty around their point forecasts by assigning probabilities to a range of possible economic outcomes. Accordingly, generating economic predictions in the form of continuous probability distributions, or density forecasts, is now common practice (Elliott and Timmermann 2016). The task of forming reliable density forecasts for macroeconomic variables is a challenging one, which requires accounting for the departures from normality that are often  observed empirically. In this respect, econometric research has shown that gains in density forecast performance can often be achieved by combining different predictive distributions (Hall and Mitchell 2007, Geweke and Amisano 2011, Elliott and Timmermann 2016, Ganics 2017). At the same time, as the global financial crisis and the COVID-19 crisis have highlighted, macroeconomic projections should in general allow for the possibility of abrupt changes or regime shifts occurring in the economy, whether they be outbreaks of financial instability, political changes or pandemics. Relatedly, while many economic agents, such as financial institutions, routinely evaluate their potential losses as random draws from continuous distributions, macroeconomic outlooks are often reduced to a limited number of distinct scenarios or regimes (e.g., Moody's 2017). This logic facilitates communication regarding economic uncertainty and finds important practical applications, e.g., in the design of bank stress tests which are now integral part of the financial regulatory framework and risk management practices in major economies (e.g., Federal Reserve 2018). The specific characteristics of different economic regimes are themselves subject to uncertainty, and a great deal of qualitative assessments are generally required to define macro scenarios, giving rise to different views or beliefs that may be considered when producing density forecasts.
    
    This paper develops an approach to enhance density forecasts for macroeconomic variables using regime-switching models. In this approach, density forecasts are constructed by pooling alternative assumptions (\textit{views}) on economic regimes or scenarios. The composition of such forecasts is optimized with respect to standard evaluation criteria for density forecasts, such as the log predictive scores and a test of uniformity for probability integral transforms (PIT). Views differ in terms of the assumed number of (unobserved) regimes and/or in terms of priors on the parameters governing the economy under different regimes.
     Two pooling methods are explored: ex-post combinations of density forecasts from different views and Bayesian averaging of views. Based on the past performance of forecasts, an optimization procedure selects forecast weights or Bayesian prior probabilities to be used for forecasting future periods. The resulting mixture forecasts are evaluated and compared to alternative approaches by means of a recursive out-of-sample forecasting exercise. 
     Empirically, the approach is illustrated using a Markov-switching autoregressive model (MSAR) for U.S. GDP growth, considering both vague views and strong views derived from the Fed macroeconomic scenarios used in the bank stress tests 2015-2018.  In the application, the approach is found to be especially useful to improve the calibration of forecast distributions. In this respect, it outperforms a number of alternative approaches by generating PITs that are well-behaved according to several criteria. 
    At the same time, the proposed method achieves good accuracy in terms of log scores, in line with the best alternative methods.
    
    The approach is intended to deal with non-normality by producing extremely flexible predictive distributions. Such flexibility results from three key elements. First, density forecasts from any Markov-switching model are weighted averages of the different regime-specific predictive densities, where the weights are the probabilities of the economy ending up in the different regimes. In other words, forecasts allow for regime changes to occur over the forecast horizon and this alone gives rise to mixture distributions, which are in general non-normal even if their individual components are normal (on regime-switching models, see Fr{\"u}hwirth-Schnatter 2006 and Hamilton 2016, among many others). Second, composite predictions are formed here by averaging different views on the Markov-switching model, which means that the forecast densities will be mixtures of mixtures of normals, thereby adding a further layer of flexibility. Moreover, as a result of Bayesian estimation, density forecasts incorporate the uncertainty on the coefficients of the Markov-switching model for any given view. 
    
    This approach connects different strands of research on forecasting. First, it is similar in spirit to other Bayesian regime-switching approaches, such as those by Pesaran, Pettenuzzo and Timmermann (2006), who use a break point model (a generalization of regime-switching models) with hyperparameter uncertainty, and by Bauwens, Carpantier and Dufays (2017), who estimate a Markov-switching model with an unknown and potentially infinite number of regimes. 
    However, our paper focuses on a finite set of experts’ views to elicit values for the hyperparameters of the regime-switching model, while in Pesaran et al. (2006) and Bauwens et al. (2017) the hyperparameters are random draws from statistical distributions. More in general, this paper is concerned with optimizing the density regime-switching forecasts, based on out-of-sample evaluation criteria.\footnote{This approach fixes a maximum number of regimes, whereas Bauwens et al. (2017) allow for infinite regimes using a nonparametric Dirichlet process. However, when estimating a model for U.S. GDP growth (with different breaks for the mean and variance parameters), they find that the posterior probability that the number of regimes is at most 5 lies between 98\% and 100\% for the mean parameters and between 74\% and 100\% for the variance, depending on the prior used for estimation.}
    Second, the paper is closely related to research on optimal density forecast combinations (Hall and Mitchell 2007, Geweke and Amisano 2011, Ganics 2017). In fact, the proposed approach can be thought as a convenient alternative to forecast combinations of different models, since it combines views on a single Markov-switching model. Given its ability to produce highly flexible approximations of unknown distributions by means of finite mixtures of normals, it can also be seen as a parsimonious alternative to nonparametric methods.
    In addition, it differs from approaches that assume non-normal errors (e.g., Hansen 1994), in that it allows for a clear economic explanation of non-normality based on different macroeconomic regimes.
    
    
    
    While the available evidence on the point forecast performance of regime-switching models is mixed (Elliott and Timmermann 2016), the rise of density forecasting has opened up new opportunities for such models. For instance, Geweke and Amisano (2011) have shown the usefulness of hidden Markov mixtures for producing density forecasts of stock market returns. In Alessandri and Mumtaz (2017), a threshold VAR (in which changes in regime depend on financial conditions) produces good density forecasts of U.S. GDP during the Great Recession. Bauwens, Carpantier and Dufays (2017) use their infinite Markov-switching autoregressive moving average (ARMA) model to produce density forecasts of U.S. GDP. 
    
   
    Density forecasts can be evaluated using several criteria (see Corradi and Swanson 2006, Elliot and Timmermann 2016 for reviews). This paper adopts two of most popular criteria as objective functions to build optimal composite forecasts. The first one is the log score, which measures the ability to assign high probabilities to outcomes that are truly likely to be observed. The second one is a uniformity test on the sequence of PITs, which provides a measure of the calibration of the forecasts.\footnote{A well-calibrated forecast is one that does not make systematic errors: if \textit{p} is the predicted probability assigned to a given random event, then that event should empirically occur with frequency \textit{p}} Both measures have been used to compute forecast combinations.  Hall and Mitchell (2007) pioneered density forecast combinations using log scores. Geweke and Amisano (2011) use the log scores to combine five different models of stock returns.  Ganics (2017) provides theoretical results on the use of PITs for optimal forecast combinations and presents an empirical application using linear autoregressive distributed lag (ARDL) models of industrial production. Finally, to evaluate the results, two other measures of correct calibration are also considered, namely two tests of independence based on the first two moments of the PITs (Rossi and Sekhposyan 2014).
    
    The remainder of the paper is organized as follows: 
    Section \ref{sec:methodology} explains the methodology, 
    Section \ref{sec:application} introduces the empirical application and presents the results, and
    Section \ref{sec:conclusions} concludes.
       
   
	\section{Methodology}\label{sec:methodology}
 

		\subsection{The Markov-switching autoregressive (MSAR) model}
		
		    
		This section illustrates the approach using a Markov-switching autoregressive (MSAR) model in which the intercept and the variance of the error term depend on the unobserved state of the economy. Let $y_t$ denote a macroeconomic variable of interest at time $t$. The MSAR can be expressed as:
		%	
			\begin{gather}\label{eq:MSAR}
				y_t= \sum_{j=1}^{p}\alpha_j y_{t-j} + \beta_{S_t}  + \varepsilon_t \\
				\varepsilon_t \sim N(0,\sigma^2_{S_t}) \nonumber
			\end{gather}
		%	
		where $S_t$ is the unobserved state variable at time $t$, $\beta_{S_t}$ is the intercept in regime $S_t$, $\alpha_j$ for $j=1,\dots,p$ is a state-independent autoregressive term,\footnote{Hamilton (1989) uses state-independent autoregressive coefficients to study U.S. GDP growth.} $p$ is the maximum lag, $\varepsilon_t$ is the error term and $\sigma^2_{S_t}$ is the regime-dependent variance of the error. In particular, $S_t$ is a Markov chain characterized by a transition matrix $\boldsymbol{\xi}$, where the element $\xi_{kj}$ in row $k$ and column $j$ represents the probability of transition from state $k$ to state $j$:
		\begin{equation}\label{eq:transition_probability}
				\xi_{kj} = Pr (S_t=j|S_{t-1} =k)
		\end{equation}
		%	
		with $k,j=1,\dots,K$, where $K$ is the number of regimes in the economy. Therefore, the MSAR captures the typical autocorrelation of macro variables in two ways: by means of the autoregressive coefficients in \eqref{eq:MSAR} and through the persistence in the state variable $S_t$ as expressed by the transition matrix.
		Finally, let $\boldsymbol{\vartheta}$ denote the vector of parameters of the MSAR model, i.e.
			$\boldsymbol{\vartheta} = (\beta_1,\dots,\beta_K,\sigma_1,\dots,\sigma_K,\alpha_1,\dots,\alpha_p,\boldsymbol{\xi})$,
			and let $\boldsymbol{\theta} = (\beta_1,\dots,\beta_K,\sigma_1,\dots,\sigma_K,\alpha_1,\dots,\alpha_p,)$. 
			
			

      
    	\subsection{Bayesian estimation with multiple views}  
    	

	    	\subsubsection{Bayesian estimation of Markov-switching models}
	    	This section summarizes the Bayesian approach to the estimation of Markov-switching models following Fr{\"u}hwirth-Schnatter (2006) and adopting her notation.
	    	Let us define $\mathbf{y} = (y_0,y_1,\dots,y_T)$ and $\mathbf{S} = (S_0,S_1,\dots,S_T)$.
	    	The posterior distribution 	$p(\boldsymbol{\vartheta}|\mathbf{y}) $ for model \eqref{eq:MSAR} is obtained using Bayes' theorem:
	    	\begin{equation}
	    	p(\boldsymbol{\vartheta}|\mathbf{y}) \propto p(\mathbf{y}|\boldsymbol{\vartheta}) p(\boldsymbol{\vartheta})
	    	\end{equation}
	    	where $p(\boldsymbol{\vartheta})$ is the prior on the parameters and $p(\mathbf{y}|\boldsymbol{\vartheta}) $ is the likelihood function, which in this case is a Markov mixture of normals. Treating $\mathbf{S}$ as data, the Markov mixture likelihood can be expressed as the sum of the complete-data likelihood $p(\mathbf{y}, \mathbf{S} |\boldsymbol{\vartheta}) $ over all possible values of the state vector $\mathbf{S} $:
	    	%
	    	\begin{align}
	    	p(\mathbf{y}|\boldsymbol{\vartheta}) &= \sum_{\mathbf{S} \in S_K} p(\mathbf{y}, \mathbf{S}|\boldsymbol{\vartheta}) \nonumber \\
	    				&= \sum_{\mathbf{S} \in S_K} p(\mathbf{y}|\mathbf{S},\boldsymbol{\theta}_{1}\, \dots, \boldsymbol{\theta}_K) p(\mathbf{S}|\boldsymbol{\xi}) \label{eq:likelihood}%\\
	    				%&= \sum_{\mathbf{S} \in S_K} \prod_{t=p+1}^{T} p(y_t|\mathbf{y}^{t-1},\boldsymbol{\theta}_{S_t}) \prod_{j=1}^{K} \prod_{k=1}^{K}  \xi_{jk}^{N_{jk}(\mathbf{S})}p(S_0|\boldsymbol{\xi})
	    	\end{align}  
	    	%	    	
	    	As shown in Fr{\"u}hwirth-Schnatter (2006), expression \eqref{eq:likelihood} factors in a convenient way that makes estimation easier. %
	    	In particular, it can be shown that if the prior assumes (i) the independence of the parameter vector $\boldsymbol{\theta}$  across regimes and (ii) the independence between parameters $\boldsymbol{\theta}$ and the transition matrix $\boldsymbol{\xi}$, i.e. 	 % Or if the prior is improper, but prior has to be proper to get proper posterior.
	    	%
 		   		\begin{equation}
	    	 p(\boldsymbol{\vartheta}) = \prod_{k=1}^{K} p(\boldsymbol{\theta}_k)p(\boldsymbol{\xi})
	    	 \end{equation}
	    	 %
	    	then the complete-data posterior, i.e.
	    	%
	    	\begin{equation}
	    	p(\boldsymbol{\vartheta}|\mathbf{y},\mathbf{S}) \propto \prod_{k=1}^{K} p(\boldsymbol{\theta}_k|\mathbf{y},\mathbf{S}) p(\boldsymbol{\xi}|\mathbf{S})
	    	\end{equation}
	    	%
	    	factors in the same way as the complete-data likelihood $p(\mathbf{y},\mathbf{S}|\boldsymbol{\vartheta}) $. This facilitates  the application of conventional Markov Chain Monte Carlo (MCMC) methods used for Bayesian estimation, in a context where, due to the Markov-switching behavior, the prior $p(\boldsymbol{\vartheta})$ and the posterior $p(\boldsymbol{\vartheta}|\mathbf{y})$ are not conjugate and the posterior does not assume any convenient analytical form.  
	    	
	    	Finally, the posterior $p(\boldsymbol{\vartheta}|\mathbf{y})$  can be expressed as the sum of the posterior for the augmented parameter vector $(\mathbf{S},\boldsymbol{\vartheta})$ over all possible realizations of $\mathbf{S}$:
	    	\begin{align}
	    	p(\boldsymbol{\vartheta}|y) = \sum_{\mathbf{S} \in S_K} p(\mathbf{S},\boldsymbol{\vartheta}|\mathbf{y})
	    	\end{align} 
	    	%
	    	In practice, Bayesian estimation samples from the joint posterior $  p(\mathbf{S},\boldsymbol{\vartheta}|\mathbf{y})$, using: %(for details, see Fr{\"u}hwirth-Schnatter 2006, Algorithm 11.3), using:
	    	%
	    	\begin{equation}
	    	p(\mathbf{S},\boldsymbol{\vartheta}|\mathbf{y}) \propto p(\mathbf{y}|\mathbf{S},\boldsymbol{\vartheta}) p(\mathbf{S}|\boldsymbol{\vartheta}) p(\boldsymbol{\vartheta})
	    	\end{equation}
	    	
   	
    	\subsubsection{Estimating the MSAR with multiple views}
    	

			In line with the estimation framework presented so far, the MSAR \eqref{eq:MSAR} is estimated here using MCMC methods and assuming independence priors of the following form:
    		\begin{equation}
    		p(\alpha_1,\dots,\alpha_p,, \beta_1, \dots, \beta_K, \sigma^2_1, \dots, \sigma^2_K) = \prod_{j=1}^{p} p(\alpha_j) \prod_{k=1}^{K} p(\beta_k) \prod_{k=1}^{K} p(\sigma^2_k) 
    		\end{equation}
    		%
    		The priors follow conventional distributions, which are: 
    		\begin{gather}
	    		\beta_k \sim \mathcal{N}\left(b_{0,k},B_{0,k}\right)\\
	    		\sigma_{k}^2 \sim \mathcal{G}^{-1}\left(c_0,C_0\right) \\
	    		\alpha_j \sim \mathcal{N}\left(a_{j,0},A_{j,0}\right) \\ j=1,\dots,p \nonumber
    		\end{gather}         
          	where $\mathcal{N}$ and  $\mathcal{G}^{-1}$ denote Normal and inverse Gamma distributions, respectively, and $b_{0,k},B_{0,k},$ $c_0,C_0,a_{j,0},A_{j,0}$ are hyperparameters to be selected by the researcher. 
          	
          	In addition, for the transition matrix  $\boldsymbol{\xi}$ it is assumed that the rows are independent and each row follows a Dirichlet distribution $\mathcal{D}$: 
          	\begin{equation}
          	\boldsymbol{\xi_k} \sim \mathcal{D}\left(e_{k1},\ldots,e_{kK} \right)
          	\end{equation}
          	where $e_{k1},\ldots,e_{kK}$ are hyperparameters, for $k=1,\dots,K$.
          
          	The number of regimes is also treated as unknown. Accordingly, a discrete prior is defined for $K$, fixing a maximum number $\overline{K}$:
          	%
          	\begin{gather}\label{eq:prior_K}
          		\pi_K^0 = Pr\left(K\right)  \\
          			K=1,\ldots,\overline{K} \nonumber\\
          		\sum_{K=1}^{\overline{K}} \pi_K^0 =1 \nonumber
          	\end{gather}
          	%
          	Note that the letter $\pi$ will be used throughout the text to denote discrete probability distributions.
          	
          	Next, for any given number of states $K$, a number $P_K$ of alternative priors on the MSAR parameters are considered. Each prior is identified by a specific set of values for the hyperparameters $( b_{0,1},\dots,b_{0,K}, B_{0,1},\dots,B_{0,K},a_{0,1},\dots,a_{0,p},A_{0,1},\dots,A_{0,p}, c_0,C_0,e_{11},\dots,e_{KK} )$. 
          	Let $\boldsymbol{\vartheta}_{K,i}^0$ denote the generic $i$-th prior assuming $K$ states. A prior probability $\ \pi(\boldsymbol{\vartheta}_{K,i}^0|K)$ is assigned to $\boldsymbol{\vartheta}_{K,i}^0$, such that 
          	\begin{equation}\label{eq:prior_theta_Ki}
	          	\sum_{i=1}^{P_K}{\pi(\boldsymbol{\vartheta}_{K,i}^0\left|K\right)}=1
          	\end{equation}
          	In other words, a discrete hierarchical prior is defined with respect to $\mathbf{\boldsymbol{\vartheta}}$.
           	The unconditional prior probability of $\boldsymbol{\vartheta}^0_{K,i}$ is equal to the joint prior probability of $\boldsymbol{\vartheta}^0_{K,i}$ and the number $K$ of regimes, i.e. $\pi(\boldsymbol{\vartheta}^0_{K,i}) = \pi(\boldsymbol{\vartheta}^0_{K,i},K)$. Using $ \pi^{0}_{K,i}$ to denote this unconditional probability, we have that:
          	\begin{equation}%\label{eq:pi0}
          	\pi^{0}_{K,i}
          	\equiv \pi(\boldsymbol{\vartheta}^0_{K,i}) =
            \pi(\mathbf{\boldsymbol{\vartheta}}_{K,i}^{0}\left|K\right)\pi_K^0
          	\end{equation}
          	In what follows, let us refer to $\boldsymbol{\vartheta}^0_{K,i}$ as a \textit{view} about the regime-switching properties of the economy. Thus, defining a view implies (i) choosing the number of regimes and (ii) choosing a prior for the MSAR parameters $\boldsymbol{\vartheta}$.
          	Also, let $\boldsymbol{\pi}^{0}$ denote the vector of length $\sum_{K=1}^{\overline{K}}P_K\ $ containing the unconditional prior probabilities of all views, i.e. $\boldsymbol{\pi}^0= (\pi^0_{1,1},\dots,\pi^0_{\overline{K},P_{\overline{K}}} ) $.
          	
          	The posterior probabilities of the views depend on the prior $\boldsymbol{\pi}^0$ and on the marginal likelihood of the MSAR model under the different views. In particular, the posterior probability for view $\boldsymbol{\vartheta}^0_{K,i}$ is equal to the joint posterior probability of $\boldsymbol{\vartheta}^0_{K,i}$ and the number $K$ of regimes, i.e. $	\pi(\boldsymbol{\vartheta}^0_{K,i}|\mathbf{y}) = \pi(\boldsymbol{\vartheta}^0_{K,i},K|\mathbf{y})$, and is given by:
          	\begin{equation}\label{eq:pi}
	          	\pi_{K,i}
	          	\equiv
	          	\pi(\boldsymbol{\vartheta}^0_{K,i}|\mathbf{y}) =\frac{p(\mathbf{y}|\boldsymbol{\vartheta}^0_{K,i}) \pi^{0}_{K,i}}{\sum_{K=1}^{\overline{K}}\sum_{j=1}^{P_K} p(\mathbf{y}|\boldsymbol{\vartheta}^0_{K,j}) \pi^{0}_{K,j} }
          	\end{equation}
 			where $ p(\mathbf{y}|\boldsymbol{\vartheta}^0_{K,i})=p(\mathbf{y}|\boldsymbol{\vartheta}^0_{K,i},K) = \int p(\mathbf{y}|\boldsymbol{\vartheta}_K,\boldsymbol{\vartheta}^0_{K,i},K) p(\boldsymbol{\vartheta}_K|\boldsymbol{\vartheta}^0_{K,i},K) d\boldsymbol{\vartheta}_K$, with $\boldsymbol{\vartheta}_K$ denoting the parameter vector in the MSAR model with $K$ regimes.
          
         
         
         
		\subsection{Density forecasts}
	
		Computing density forecasts from a MSAR model requires three steps. 
		In what follows, let us add a time subscript to the vector of observations $\mathbf{y}$, so that $\mathbf{y}_t=(y_0,y_1,\dots,y_t)$. Also, let us assume that the current time period is $T$ and the forecast horizon is one period. 
		The first step consists in using the MCMC algorithm to sample both the current unobserved regime $S_T$ and the MSAR parameters $\boldsymbol{\vartheta}$ from the posterior distribution $p(\mathbf{S},\boldsymbol{\vartheta}|\mathbf{y}_T)$. Let $(\boldsymbol{\vartheta}^{(d)}, S^{(d)}_T)$ denote a generic MCMC draw.
		Next, each draw is used to forecast the future state of the economy. Taking $S_T^{(d)}$ as the starting value, a stochastic forecast $S_{T+1}^{(d)}$ is computed using the matrix of transition probabilities $\boldsymbol{\boldsymbol{\xi}}^{(d)}$, i.e. based on \eqref{eq:transition_probability}.
		Third, $y_{T+1}^{(d)}$ is sampled from the normal predictive density $p(y_{T+1}, | \mathbf{y}_T,\boldsymbol{\vartheta}^{(d)}, S_{T+1}^{(d)}) $. In particular, 
            \begin{equation}
			y_{T+1}|\mathbf{y}_T,\boldsymbol{\vartheta}^{(d)}, S_{T+1}^{(d)}=k
			\sim 
			\mathcal{N} \left( 
			\sum_{j=1}^{p}\alpha^{(d)}_j y_{T+1-j} + \beta_k^{(d)} ,\sigma^{(d)2}_k
			 \right)
			\end{equation}
			
          Conditional on knowing the state of the economy in the future period $T+1$, the predictive distribution of $y_{T+1}$ is a Normal for any given parameter vector. However, since the future state of the economy is unknown, the density forecast of $y_{T+1}$ produced by the MSAR will be a mixture of the different regime-specific normals, where the mixture weights are given by the probabilities of the economy ending up in the different possible regimes at $T+1$. As a result, the MSAR is generally able to produces highly flexible, non-normal forecast distributions. Also, the predictive densities are non-linear in $y_{T}$ and heteroskedastic (Fr{\"u}hwirth-Schnatter 2006). In addition, Bayesian estimation incorporates the uncertainty on the parameters $\boldsymbol{\vartheta}$ into the density forecasts. What is more, considering alternative views allows for an additional degree of flexibility, as formalized below.
                   
          Assuming a known number of regimes $K$ and a known parameter vector $\mathbf{\boldsymbol{\vartheta}}$, the one-step-ahead density forecast at time $T$ is the following finite mixture of $K$ normal components: 
          \begin{equation}
          p\left(y_{T+1}|\mathbf{y}_{T},\mathbf{\boldsymbol{\vartheta}}\right)=\ \sum_{k=1}^{K}p\left(y_{T+1}|\mathbf{y}_{T},\boldsymbol{\theta}_k\right)Pr\left(S_{T+1}=k|\mathbf{y}_{T},\mathbf{\boldsymbol{\vartheta}}\right)
          \end{equation}
          %
          Next, as a result of Bayesian estimation, the density forecast for any given view integrates out parameter uncertainty: 
          \begin{equation}%\label{eq:forecast_view}
			p\left(y_{T+1}|\mathbf{y}_{T},\boldsymbol{\vartheta}_{K,i}^0 \right)= 
			\int
				p\left(y_{T+1}|\mathbf{y}_{T},\boldsymbol{\vartheta}_K,\boldsymbol{\vartheta}_{K,i}^0 \right)
				p(\boldsymbol{\vartheta}_K|\mathbf{y}_{T},\boldsymbol{\vartheta}_{K,i}^0) d\boldsymbol{\vartheta}_K
		\end{equation}          
          %
          where, as before, $\boldsymbol{\vartheta}_K$ denotes the parameter vector when $K$ regimes are assumed.
          Finally, averaging over different views $\boldsymbol{\vartheta}_{K,i}^0$, we get:
          \begin{equation}\label{eq:forecast_pi0}
          p\left(y_{T+1}|\mathbf{y}_{T},\boldsymbol{\pi}^0\right)=\sum_{K=1}^{\overline{K}}\sum_{i=1}^{P_K}p\left(y_{T+1}|\mathbf{y}_{T},\mathbf{\boldsymbol{\vartheta}}_{K,i}^0\right)\pi_{K,i}
          \end{equation}
          %
          where $ \pi_{K,i}$ depends on the prior probability vector $\boldsymbol{\pi}^0$ and on the marginal likelihoods of the different views according to equation \eqref{eq:pi}. Forecast  \eqref{eq:forecast_pi0} is a composite forecast in which the weight assigned to the view-specific forecast $p\left(y_{T+1}|\mathbf{y}_{T},\mathbf{\boldsymbol{\vartheta}}_{K,i}^0\right)$ is given by the posterior probability of the view, $\pi_{K,i}$. Therefore, \eqref{eq:forecast_pi0} is a mixture of mixtures. If we take the set of alternative views as given, the forecast combination weights are unambiguously pinned down by the data $\mathbf{y}_{T}$ and by the prior vector $\boldsymbol{\pi}^0$.  
		
		In addition to the Bayesian averaging of views in \eqref{eq:forecast_pi0}, let us also consider standard non-Bayesian forecast combinations. In this case, let us express a forecast combination of different MSAR views, where the vector of combination weights is denoted by $ \mathbf{w}$, as:
		%	
         \begin{equation}\label{eq:forecast_w}
			p\left(y_{T+1}|\mathbf{y}_T, \mathbf{w} \right)=\sum_{K=1}^{\overline{K}}\sum_{i=1}^{P_K}  p\left(y_{T+1}|\mathbf{y}_{T},\mathbf{\boldsymbol{\vartheta}}_{K,i}^0\right)  w_{K,i} 
		\end{equation}
		%
		where $w_{K,i} \geq 0$ is the weight assigned to view $\boldsymbol{\vartheta}_{K,i}^0$ and $\sum_{K=1}^{\overline{K}}\sum_{i=1}^{P_K} w_{K,i} = 1$.

		\subsection{Optimizing density forecasts }\label{subsec:optimizing}

		The composite density forecasts from the MSAR with multiple views are optimized with respect to two alternative objective functions, based on statistics that are commonly used to evaluate density forecast performance: the log score and the probability integral transform (PIT). 
		
		The log score is the log of the predictive density function evaluated at the actual realization of the forecast variable. Let $y_{t+h}^o$ (where "o" stands for "observed") denote the realization of variable $y$ at time $t+h$, which is not observed at time $t$, when the forecast for $t+h$ is produced. Also, let $R$ be the length of the timespan over which forecasts are optimized. The first objective function, denoted by $f_1$, is given by the sum of log scores over the period of interest. For combinations using generic weights $\mathbf{w}$ as in \eqref{eq:forecast_w}, the sum of log scores at time $\tau$ can be expressed as:
		\begin{gather}
		f_{1,\tau}\left(\mathbf{w}\right)=\sum_{t=\tau-h-R+1}^{\tau-h}\ln{\left(p\left(y_{t+h}^o|\mathbf{y}_{t},\mathbf{w}\right)\right)}
		\end{gather}
		For combined forecasts using Bayesian averaging as in \eqref{eq:forecast_pi0}, the objective function can be written as:
		\begin{gather}
			f_{1,\tau}\left(\boldsymbol{\pi}^0\right)=\sum_{t=\tau-h-R+1}^{\tau-h}\ln{\left(p\left(y_{t+h}^o|\mathbf{y}_{t},\boldsymbol{\pi}^0\right)\right)}
		\end{gather}	
			
		The PIT is the cumulative predictive density function evaluated at the actual realization of the variable.
		If the density forecast used to compute the PIT corresponds to the true distribution of the variable, then, for $h = 1$, the PIT values are the realizations of independently and identically distributed (i.i.d.) Uniform $(0, 1)$ variables (Diebold et al. 1998).
		Therefore, a uniformity test on the PITs can be seen as a test of correct specification of the density forecasts (see also Rossi and Sekhposyan 2014). Accordingly, the second objective function for forecasts of type \eqref{eq:forecast_w} is given by: 
				\begin{gather}
					f_{2,\tau}\left(\mathbf{w} \right)= -ks\left(\left \{\Phi\left(y_{t+1}^o|\mathbf{y}_{t},\mathbf{w}\right) \right \}_{t=\tau-R}^{\tau-1}\right)
				\end{gather}
		where $\Phi\left(\cdot\right)$ denotes the cumulative predictive density function, i.e.
				    \begin{equation}
					\Phi\left(y_{t+1}^o|\mathbf{y}_{t},\mathbf{w}\right) \equiv \int_{-\infty}^{y_{t+1}^o} p \left(y_{t+1}|\mathbf{y}_{t},\mathbf{w} \right) dy_{t+1}
				    \end{equation}
				 while function $ks(\cdot)$ represents the test statistics of a Kolmogorov-Smirnov (KS) test of uniformity. Maximizing $-ks(\cdot)$ is equivalent to maximizing the p-value of the KS test.
		Analogously, 
			\begin{gather}
			f_{2,\tau}\left(\boldsymbol{\pi}^0 \right)= -ks\left(\left \{\Phi\left(y_{t+1}^o|\mathbf{y}_{t},\boldsymbol{\pi}^0\right) \right \}_{t=\tau-R}^{\tau-1}\right)
			\end{gather}
		

		Both the optimization based on $f_1$ and the one based on $f_2$ are solved numerically. For each $f_i$, with $i=1,2$, the optimization algorithm delivers two vectors at time $\tau$: the vector of optimal forecast weights $ 	\mathbf{w}^\ast_{i,\tau}$ for the set of alternative views, i.e.:
		\begin{equation}\label{eq:optimal_weights}
		\mathbf{w}^\ast_{i,\tau} \equiv \underset{\mathbf{w}}{\arg\max} \ f_{i,\tau}\left(\mathbf{w}\right)
		\end{equation}
		and the vector of optimal prior probabilities $\boldsymbol{\pi}^{0\ast}_{i,\tau}$:
		\begin{equation}\label{eq:optimal_priors}
		\boldsymbol{\pi}^{0\ast}_{i,\tau} \equiv \underset{\boldsymbol{\pi^0}}{\arg\max} \ f_{i,\tau}\left(  \boldsymbol{\pi^0}  \right)
		\end{equation}
		%	
		The former represents the typical problem explored in the literature on density forecast combination, whereas the latter can be seen as an empirical method for eliciting priors in the context of Bayesian model averaging. The optimal prior $\boldsymbol{\pi}_{i,\tau}^{0\ast}$ represents the discrete prior probability distribution of views such that the resulting posterior $\boldsymbol{\pi}_{i,\tau}^\ast$, when used as a vector of forecast weights, maximizes the density forecast performance, based on the selected objective function.
		In practice, the main difference between \eqref{eq:optimal_weights} and \eqref{eq:optimal_priors} is that the first problem directly delivers weights for forecast combination, while in the second case the actual forecast weights will also depend on the marginal likelihoods of all views, i.e.
		$p(\mathbf{y}|\boldsymbol{\vartheta}^0_{K,i}) $ $\forall K,i$.
		
		
		
		
		
		\section{Empirical application}\label{sec:application}
		
		This section assesses the empirical performance of the approach proposed in the paper. 
		The application deals with density forecasts of U.S. real GDP growth and uses quarterly data from 1948Q1 to 2017Q2 (Figure \ref{fig:GDP})\footnote{Source: U.S. Bureau of Economic Analysis, Real Gross Domestic Product [GDPC1], retrieved from the FRED database, Federal Reserve Bank of St. Louis.}. The growth rate considered is the year-on-year growth rate (expressed in percentage points in what follows). The lag length $p$ is set to 5, in consideration of the quarterly frequency of the variable.
		The optimal weights\ $\mathbf{w}^\ast$ and optimal priors $\boldsymbol{\pi}^{0\ast}$ are tracked over time by means of a recursive optimization scheme. Their performance is assessed on an evaluation sample, i.e. using observations of the target variable that have not been used in the optimization procedure, as described in section \ref{subsec:optimization_scheme}.

		
		
		
				\subsection{Views}

				
				A total of 13 alternative views on the regime-switching properties of U.S. GDP are considered.
				Eight views impose strongly informative priors derived from the scenarios of the Fed stress tests 2015-2018.\footnote{See https://www.federalreserve.gov/supervisionreg/dfast-archive.htm.} The remaining five views are vague views, defined by imposing a diffuse prior on the MSAR parameters under different assumptions on the number of regimes $K=1,2,3,4,5$.
				
				Let us first consider the Fed-based views. For each of the four stress tests under consideration, two views are constructed, one with $K=3$ and the other with $K=5$.
				In the view with $K=3$, one of the regimes (which may be called the "normal times" regime), is derived from the Fed baseline scenario, another ("adverse regime") from the adverse scenario and the last one ("severely adverse regime") from the severely adverse scenario.\footnote{Although the Fed stress scenarios represent hypothetical paths and not forecasts, they are intended to be plausible even when severe. Therefore, they can legitimately be assigned predictive probabilities (see e.g., Yuen 2013) and used to form density forecasts.} In particular, each regime is "centered" on the corresponding scenario using the following rule. Consider an AR(5) model where the coefficients are given by the $k$-state-specific hyperparameters of the prior $\boldsymbol{\vartheta}^0_{K,i}$, i.e.:
				\begin{equation}
					y_t= \sum_{j=1}^{5}a^{(K,i)}_j y_{t-j} + b^{(K,i)}_{0,k}  + \varepsilon_t
				\end{equation} 
				In this model, the unconditional expectation of $y_t$ is 
				\begin{equation}\label{eq:fed_match}
					E \left( y_t \right) = \frac{b^{(K,i)}_{0,k}}{ 1- \sum_{j=1}^{5} a_j^{(K,i)} }
				\end{equation} 
				Then, after making an assumption on the state-independent $a_j^{(K,i)}$, with $j=1,\dots,5$, each regime-specific $b^{(K,i)}_{0,k}$ is chosen in such a way that expectation \eqref{eq:fed_match} matches a specific value derived from the relevant scenario of the Fed stress test. For the normal times regime, this value is the average growth rate in the last 4 quarters of the baseline scenario, which is assumed to be close to the convergence value of the year-on-year growth rate in the absence of shocks.\footnote{The stress test scenarios are defined in terms of annualized quarter-on-quarter growth rates, so that averaging over the last 4 quarters approximates the year-on-year growth rate in the last quarter.}
				For both the adverse and the severely adverse regimes, the value to be matched is the average growth rate in the first 4 quarters of the corresponding scenario, as the first quarters are those when the negative shocks are assumed to occur and the growth rates are lowest. 
				
				An example may help. Let us consider the view with $K=3$ derived from the 2018 Fed stress test. The average growth rate of GDP in the last 4 quarters of the baseline scenario is 2.1\%, while the average growth rates in the first 4 quarters of the adverse and severely adverse scenarios are -2.125\% and -6.275\% respectively. Assuming that the prior mean for the autoregressive coefficients is 0.9 for the first lag and 0 for higher-order lags, which approximates the OLS estimate of a simple AR(1) for GDP growth over the entire sample, then $\sum_{j=1}^{5} a_j^{(K,i)} = 0.9$. Accordingly, the prior means for the regime-specific intercepts are set to $b_{0,1} = 2.1/(1-0.9)=0.21$ for the normal times regime,  $b_{0,2} = -2.125/(1-0.9)=-0.2125$ for the adverse regime and  $b_{0,3} = -6.275/(1-0.9)=-0.6275$ for the severely adverse regime.
				
				
				The four stress test-based views with $K=5$ expand the views with $K=3$ by adding two regimes: a regime which we may call "recovery from adverse shock", designed to match the last 4 quarters of the adverse scenario, and a regime of "recovery from severely adverse shock", which matches the last 4 quarters of the severely adverse scenario. This is done in consideration of the fact that growth rates in the last 4 quarters of the adverse and severely scenarios are assumed to be higher than the baseline rates, implying a rebound of the economy after a negative shock. Of course, such regimes may be more generally interpreted as "favorable regimes" characterized by positive shocks and not necessarily as recoveries from recessions.  
				
				In the five vague views, all priors on the intercepts are centered on 0 and have a variance of 1 percentage point, while the priors on the autoregressive coefficients are centered on 0.5 for the first lag, on 0 for the higher-order lags, and have a variance of 1. The combination of these assumptions imply a large prior variance on the regime-specific means of the GDP growth rate. In the Fed-based views, the priors for both $\beta$ and $\alpha$ are strongly informative, so as to ensure that the regime-specific means are tightly centered on the stress test values, based on equation \eqref{eq:fed_match}. In particular, both priors are assumed to have minimal variance, equal to $ 10^{-5}$. For the autoregressive coefficients $\alpha$, the prior mean is assumed to be 0.9 for the first lag and 0 for higher-order lags, as in the previous example.
        		
        		No strong assumption is made regarding the regime-switching error variance $\sigma_k^{2}$. Instead, a diffuse hierarchical prior is assumed for all views. Specifically, a Gamma hyper-prior is defined for $C_0$:\footnote{Accordingly, the independence prior of the MSAR model becomes:
        			\begin{equation*}
        			p(\alpha_1,\dots,\alpha_p, \beta_1, \dots, \beta_K, \sigma^2_1, \dots, \sigma^2_K, C_0) = \prod_{j=1}^{p} p(\alpha_j)  \prod_{k=1}^{K} p(\beta_k) \prod_{k=1}^{K} p(\sigma^2_k) p(C_0)
        			\end{equation*}
        		}
            	\begin{equation}
        		C_{0} \sim \mathcal{G}\left(g_{0},G_{0}\right)
        		\end{equation}
        		%
        		To make the prior on $\sigma_k^{2}$ diffuse, the following values are selected for the hyperparameters: $c_0=3$, $g_0=0.5$ and $G_0=0.5$. These imply that $\sigma_{k}^2$ has a prior expected value of 0.5 percentage points of GDP and a high prior variance of 1.25 percentage points (see the Appendix for the derivations).
			

				Finally, the hyperparameters for the $k$-th row of the transition matrix $ \boldsymbol{\xi}$ are  $e_{kk} = 2$ and $e_{kj}=1/(K-1)$ if $k \neq j$, $\forall k,j$.
				Given the properties of the Dirichlet distribution, $ \text{E}(\xi_{kj}) = e_{kj}/(\sum_{l=1}^{K}e_{kl})$.
				Therefore, the prior expected probability of remaining in the same state $k$ in the next period is  $ \text{E}(\xi_{kk}) = 2/3$ regardless of the number of regimes $K$, while the probability of moving to a different, specific state $j$ decreases with the number of regimes, $ \text{E}(\xi_{kj}) = 1/[3(K-1)]$.
				
				The summary of the alternative views is provided in Table \ref{tab:views}, where views 1-5 are the vague ones while views 6-13 are those derived from the Fed stress tests 2015-2018.  Table \ref{tab:fed_scenarios} displays the GDP scenarios of the Fed stress tests (see Federal Reserve Board 2014, 2016, 2017, 2018).

        	
        \subsection{Optimization scheme}\label{subsec:optimization_scheme}
        In the empirical application, a recursive-window estimation scheme is used to generate a sequence of density forecasts.\footnote{In this context, the choice of using expanding windows for estimation, as opposed to rolling windows, increases the probability that the variable "visits" the highest possible number of regimes within the sample.} 
        Next, the forecasts are used to carry out the optimization of weights/priors, which is iterated over time. The procedure can be described as follows. 
       Let us assume that we are at time $T_w$ and the forecast horizon is $h$.
       For each view under consideration, the MSAR model is recursively estimated using observations between time $t_0$ and time $t$, with $t=T_0,T_0+1,\dots,T_w-h$. $T_0$ is therefore the end period of the shortest estimation sample. Estimates at $T_0$ are used to make forecasts for period $T_0+h$, estimates at $T_0+1$ are used to make forecasts for $T_0+1+h$, and so on.
       At time $T_w$, a sequence of past forecasts is available for each view. At this point, the algorithm computes the optimal weights/priors based on the last $R$ forecasts, i.e. maximizes the relevant objective function between $T_w-R+1$ and $T_w$. Once the optimal weights/priors are retrieved, they are used to combine the different view-specific forecasts for the future period $T_w+h$, which is out of the optimization sample. When the actual value of the variable of interest is observed, at time $T_w+h$, the performance of the composite forecast is measured. The index $T_w$ runs from $T_0+h+R-1$ to $\overline{T}+h$, where $\overline{T}$ is the end of the largest estimation sample. $\overline{T}+2h$ is the last available observation for the target variable. Therefore, the period from $T_0+2h+R-1$ to $\overline{T}+2h$ defines the evaluation sample. Figure \ref{fig:optimization_scheme} summarizes the procedure, which closely follows Ganics (2017).
       
         More specifically, the application to U.S. GDP growth sets $t_0$=1948Q1, $T_0$=1967Q4, $R$=40 quarters, $h$=1 quarter and $\overline{T}$=2016Q4. Accordingly, the evaluation sample runs from 1978Q1 to 2017Q2.\footnote{We estimate the MSAR model using the MATLAB package \texttt{bayesf Version 2.0} by Fr{\"u}hwirth-Schnatter (2008). For each MSAR estimate, the MCMC algorithm uses 1000 iterations as burn-in and 1000 iterations to store the results. Starting from the sample of forecasts produced by the MCMC algorithm, a complete probability density function is fitted using standard kernel methods.}
          The main results hold true if we set $R=20$.


        
     
        
        
        \subsection{Results}\label{subsec:results}
       
        Table \ref{tab:results} shows the performance of the optimal forecast weights and optimal priors over the evaluation sample and compares it with five  benchmark approaches. The first approach simply uses a linear AR(5) model, corresponding to view no. 1 in Table \ref{tab:views}. The second approach uses an AR model estimated on rolling windows of 80 quarters to accommodate time-varying parameters.\footnote{Using rolling windows of 40 quarters gives similar results.} The third approach produces forecasts using the individual view that exhibits the highest marginal likelihood, selected recursively across estimation windows. The remaining two approaches consider uniform combination schemes for the alternative views, assigning respectively equal forecast weights and equal prior probabilities to different values of $K$ and, given $K$, equal weights/probabilities to the alternative views defined using $K$ regimes.\footnote{For instance, in the case of equal prior probabilities, it is assumed that $\pi_K^0=1/\overline{K}$ for each $K$ and that $\pi(\boldsymbol{\vartheta}_{K,i}^0|K)=1/P_K$ for each view $\boldsymbol{\vartheta}_{K,i}^0$. See \eqref{eq:prior_K} and \eqref{eq:prior_theta_Ki}.} As mentioned in section \ref{subsec:optimizing}, weights $\mathbf{w}_{1}^{*}$ and priors $\boldsymbol{\pi}_{1}^{*}$ result from the optimization taking the sum of log scores as objective function, while $\mathbf{w}_{2}^{*}$ and $\boldsymbol{\pi}_{2}^{*}$ are obtained by maximizing the p-value of the Kolmogorov-Smirnov (KS) test of uniformity for the PITs.
       The table shows the average predictive density (APD) (i.e. the average of the exponential of the log scores) and the p-value of the KS test. Besides, two additional measures of correct specification of density forecasts are taken into consideration, namely the p-values of the Ljung–Box test of serial independence for the first and second moment of the PITs (see Rossi and Sekhposyan 2014). Since correct calibration implies that the PITs are realizations of i.i.d U(0,1) variables, both tests should not reject the null of serial independence for forecasts to be considered well-calibrated. In the table, LB1 denotes the test on the first moment and LB2 the test on the second moment. Following Rossi and Sekhposyan (2014), in both tests the null hypothesis is serial independence over up to 4 lags. 
       
       The main result is that optimized regime-switching composite forecasts achieve well-behaved PITs, unlike all benchmarks considered. The optimization step generates substantial improvements in density forecast performance as measured by the uniformity of the PIT.
       As can be seen from Table \ref{tab:results}, using the optimal priors $\boldsymbol{\pi}_{2}^{*}$ and the optimal weights $\mathbf{w}_{2}^{*}$ results in the highest p-values in the KS test of PIT uniformity, 0.32 and 0.21 respectively, while also ensuring that both tests of independence of the PITs do not reject the null hypothesis. By contrast, the recursively estimated linear AR, the two uniform weighting schemes and the approach using the views with the highest marginal likelihood all lead to rejection of the null of uniformity at the 5\% level. The AR model estimated on a rolling window gives a p-value of 10\% in the KS test, but strongly rejects the serial independence of the second moment of the PITs. 
       In general, for all MSAR-based forecasts the null of independence cannot be rejected, whereas in the case of the linear AR model the independence of the second moment is rejected regardless of the estimation scheme.
       Interestingly, the weights $\mathbf{w}_{1}^{*}$ and the priors $\boldsymbol{\pi}_{1}^{*}$ both lead to increases in the KS p-value relative to uniform combinations, even though they are optimized using the log scores as objective function.  
         
       Second, the optimization step appears less useful for producing gains in terms of log scores. 
       The APDs of the log-score-optimized forecasts are higher than those achieved by the recursive-window AR, the rolling-window AR and equal forecast weights, but are roughly the same as those obtained by using uniform prior probabilities or by recursively selecting the view with the highest marginal likelihood. Moreover, using the sum of log scores as objective function results in small increases in APD compared to using the KS statistics. Overall, the comparatively good accuracy in terms of APDs appears to be driven more by the Markov-switching model than by the optimization procedure.
        
       
       To summarize, optimizing the combinations of views enhances the calibration of density forecasts in terms of PIT uniformity, i.e. improves the specification of the predictive distribution. This, combined with the regime-switching setup, leads to PITs that are not significantly different from i.i.d uniform variables. At the same time, the approach is capable of producing results in terms of log-score accuracy that are roughly in line with the best ones across several benchmarks.  
      
       Figure \ref{fig:pdf_time} shows the evolution over time of the well-calibrated 1-quarter-ahead forecasts based on the optimal priors $\boldsymbol{\pi}_{2}^{*}$. The upper part of the figure plots the p.d.f. of the forecasts in each period. The lower part summarizes the density forecasts using a fan chart, where different shades of color identify different percentiles, from 1\% to 99\%.      
      
       
       
       The approach can be used to evaluate the time-varying contribution of different views to the composite forecasts. Figures \ref{fig:w1}-\ref{fig:pi2} display the evolution over time of the optimal forecast weights and of the weights resulting from the optimal priors, i.e. the optimized posterior probabilities. 
       In each figure, the area chart in the left panel shows the time-varying weights for all views from 1978Q1 to 2017Q2. The right panel plots the cumulative weight assigned to the views derived from the Fed supervisory scenarios.
       Figures \ref{fig:w1} and  \ref{fig:pi1} show the results of the optimization based on log scores, while Figures \ref{fig:w2} and \ref{fig:pi2} show the results of the optimization based on the PITs.
       %
       As can be seen from Figures \ref{fig:w1} and \ref{fig:pi1}, the vague views tend to dominate in the case of log-score optimization, especially when the prior probabilities are optimized. In terms of optimal weights $\mathbf{w}_1^{*}$, the cumulative weight of the Fed-based views lies in the range 10\%-35\% between 1979 and 1990, remains flat at zero from the end of 1990 until 2006, then starts increasing in 2007 and peaks at 61\% in 2010. It rapidly declines afterwards. On average, the vague views account for more than 90\% of the composite forecasts.
       As regards the optimized posteriors, the Fed-based views only have short-lived spikes in 1984 (21\%) and 2010 (100\%). 
       Overall, the results indicate a minor role of Fed-based views in boosting density forecast accuracy.
       This is consistent with the fact that the maximum marginal likelihood criterion (used in the third row of Table \ref{tab:results}), which gives as high APDs as the log-score-optimized weights and priors, never selects any Fed-based views.
       
       When the PIT-based optimization is considered, the contribution of the Fed-based views is much higher. On average, they account for 33\% of the combined forecasts in the case of optimal weights and over 20\% in the case of optimal priors. In terms of $\mathbf{w}_2^{*}$, their cumulative weight exceeds 60\% in 1982-1983, increases quite rapidly during the period 2007-2009 and remains steadily between 75\% and 100\% from 2009 to 2017. The Fed-based views also dominate in terms of optimized posteriors for most of the period 2008-2017. Their cumulative posterior probability has a first peak in 1983, while it remains close to zero from 1984 to 2008.
       It is important to remark that using Fed-based views is not sufficient to achieve well-calibrated forecasts. None of these views, when considered individually, leads to non-rejection of the PIT uniformity hypothesis in the KS test. Instead, as already stressed, the combination of different views is what drives the good results in terms of calibration.  
       
 
        
        
    \subsubsection{Comparison with non-normal and heteroskedastic AR models}
   
    	To evaluate the approach within the broader perspective of non-normal and heteroskedastic models, this section shows the density forecast performance of three alternative models: an AR with Student-$t$ errors, an AR with ARCH errors and an AR with GARCH errors.
    	The models have been estimated on both recursive windows and rolling windows of 40 and 80 quarters.\footnote{The AR-GARCH model on rolling windows of 40 quarters is not supported by the data and is therefore not reported.}  
    	As with the MSAR models, the lag length for the AR component is set to 5 for all three models, while the ARCH and GARCH components have a lag length of 1.
    	
    	For each model, Table \ref{tab:art_garch} shows the APDs and the p-values for the KS, LB1 and LB2 tests over the same evaluation sample as in the previous section. 
    	When estimated on recursive windows, all three models generate non-uniform PITs and lower APDs than any MSAR-based method in Table \ref{tab:results}. Their performance considerably improves when rolling windows are used, which accommodate structural instabilities. In particular, the AR with \textit{t} errors achieves the highest APD (0.37) and generates PITs that do not reject the hypotheses of uniformity and independence in the first moment. Regarding independence in the second moment, the LB2 test rejects the null at the 5\% when estimated on 80-quarter windows, whereas it does not reject null at the 5\% but rejects it at the 10\% level when estimated on 40-quarter windows.
    	The models with ARCH/GARCH errors always reject the hypothesis of second-moment independence and are generally outperformed by the MSAR-based methods in terms of APDs.
    	
    	The results suggest that, when the PIT optimization is used, the approach proposed in the paper is able to achieve a more reliable specification of the conditional predictive distribution, based on the joint indications offered by the KS, LB1 and LB2 tests. In terms of log-score accuracy, the approach produces results that are close but below the best alternative, namely the AR model with Student-$t$ errors estimated on rolling windows. 
    
        
    \section{Conclusions}\label{sec:conclusions}

	This paper has proposed a procedure for constructing reliable density forecasts of economic variables using a regime-switching model. Composite forecasts are formed by pooling alternative model assumptions (or views) and are optimized with respect to measures of calibration (probability integral transforms or PITs) and accuracy (log scores) of density forecasts. The approach merges the well-established benefits of forecast combination with the flexibility of mixture predictive densities provided by a single Markov-switching model.
	Different sources of uncertainty are incorporated into the density forecasts. First, uncertainty on the future state of the economy is dealt with by using a Markov-switching setup. Second, as a result of Bayesian estimation, parameter uncertainty enters the predictive densities for any given view about economic regimes. Third, "disagreement" between views is also taken into account.      
    
    The approach appears to strike a good balance between the specification of flexible distributional shapes and the accuracy of density forecasts. 
    In an application to U.S. GDP, the optimized regime-switching forecasts achieve PITs that are not significantly different from i.i.d uniform variables, as prescribed by the theory on density forecast calibration. At the same time, they exhibit a good level of accuracy in terms of average predictive densities. Moreover, the forecasts appear better calibrated than those provided by a variety of competing approaches.
    
    Importantly, this methodology allows to incorporate different macroeconomic scenarios defined by experts and to evaluate their usefulness for forecasting. To illustrate this possibility, the empirical application makes use of the scenarios defined by the Fed for its annual bank stress tests, and tracks their contribution to the optimized forecasts over time. 
    This feature appears particularly valuable in all contexts in which tail risks have a clear economic interpretation and when predictive simulations have to comply with external, possibly judgmental views.
    Researchers and practitioners interested in this kind of analysis may fine-tune the approach by selecting different objective functions in the optimization step and by tailoring the range of views to be considered.   
    
    \pagebreak
     \section*{Data availability statement}
     The data that support the findings of this study are openly available in the Archival FRED database at \url{https://alfred.stlouisfed.org/series?seid=GDPC1} (vintage 2018-05-30) and in the website of the Board of Governors of the Federal Reserve System at \url{https://www.federalreserve.gov/supervisionreg/dfast-archive.htm}.
     
    
    \begin{thebibliography}{9}
    
    \input{bibliography_apa}

    \end{thebibliography}

    

    
\pagebreak

       		\vspace*{\fill}
\begin{figure}[H]
	\caption{U.S. real GDP growth 1948Q1-2017Q2}
	\centering
	\includegraphics[scale=0.6]{gdp.png}
	\subcaption*{\textit{Notes:} The left panel plots the quarterly time series of the U.S. real GDP growth rate (year-on-year) from 1948Q1 to 2017Q2. The histogram in the right panel summarizes the frequency distribution. The red line represents the normal p.d.f. with the same mean and variance as the empirical GDP distribution. The Jarque-Bera test rejects the hypothesis of normality at the 5\% level. }
	\label{fig:GDP}
\end{figure}
       		\vspace*{\fill}

\pagebreak

       		\vspace*{\fill}
\begin{figure}[H]
	\centering
	\caption{Optimization scheme}
	\includegraphics[scale=0.47]{recursive_scheme.png}
			\subcaption*{\textit{Notes:} The figure summarizes the density forecast optimization scheme. First, the MSAR model is recursively estimated on actual GDP data (dark blue bar) using alternative views. The sample start date is denoted with $t_0$, the end date runs from $T_0$ to $\overline{T}$. For each sample window, the estimates generate density forecasts with horizon $h$ (light blue bar). A rolling sequence of $R$ forecasts is used to compute optimal forecast weights and prior probabilities (green bar) for the views. The optimal weights/priors obtained in each period are used to combine the view-specific forecasts for subsequent periods. The resulting composite forecasts (dark yellow bar) are evaluated by comparison with the actual data over the period from $T_0+2h+R-1$ to $\overline{T}+2h$.}
	\label{fig:optimization_scheme}
\end{figure}
\vspace*{\fill}





\begin{landscape}
			\vspace*{\fill}
	\begin{table}[H]
		\caption{Alternative views for the regime-switching model of U.S. GDP growth }
		\centering
		\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|}
			\hline \hline
			& &  \multicolumn{9}{|c|}{hyperparameters}\\ \cline{4-11} 
			view no.& view type &$K$ & $b_0$                                 & $B_0$ & $a_0$         & $A_0$ & $e$ & $c_0$ & $g_0$ & $G_0$ \\
			\hline
			1&vague        & 1   & 0                                     & 1          & (0.5 0 0 0 0) & 1          & 2   & 3     & 0.5   & 0.5   \\
			2&vague       & 2   & (0,0)                                 & 1          & (0.5 0 0 0 0) & 1          & 2   & 3     & 0.5   & 0.5   \\
			3&vague        & 3   & (0,0,0)                               & 1          & (0.5 0 0 0 0) & 1          & 2   & 3     & 0.5   & 0.5   \\
			4&vague        & 4   & (0,0,0,0)                             & 1          & (0.5 0 0 0 0) & 1          & 2   & 3     & 0.5   & 0.5   \\
			5&vague        & 5   & (0,0,0,0,0)                           & 1          & (0.5 0 0 0 0) & 1          & 2   & 3     & 0.5   & 0.5   \\
			\hline
			6&Fed stress test       & 3   & (0.265,-0.0475,-0.4275)               & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			7&Fed stress test        & 3   & (0.2275,-0.1850,-0.5675)              & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			8&Fed stress test        & 3   & (0.205,-0.1950,-0.59)                 & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			9&Fed stress test        & 3   & (0.21,-0.2125,-0.6275)                & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			10&Fed stress test       & 5   & (0.39, 0.1975, 0.265,-0.0475,-0.4275) & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			11&Fed stress test       & 5   & (0.39, 0.3, 0.2275,-0.1850,-0.5675)   & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			12&Fed stress test       & 5   & (0.39, 0.3, 0.205,-0.1950,-0.59)      & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			13&Fed stress test       & 5   & (0.43, 0.32, 0.21,-0.2125,-0.6275)    & $10^{-5}$     & (0.9 0 0 0 0) & $10^{-5}$     & 2   & 3     & 0.5   & 0.5   \\
			\hline \hline
		\end{tabular}
				\subcaption*{\textit{Notes:} The table lists the 13 priors (\textit{views}) used to estimate the Bayesian Markov-switching autoregressive (MSAR) model considered in the empirical application. $K$ denotes the assumed number of regimes, $b_0, B_0, a_0, A_0, e, c_0, g_0$ and $G_0$ are the hyperparameters of the priors. Please refer to Section \ref{sec:methodology} for an explanation of the parameters. Views 1-5 represent diffuse priors, while views 6-13 are strongly informative priors derived from the Fed supervisory scenarios.}
		\label{tab:views}
	\end{table}
\vfill
\end{landscape}



\begin{table}[H]
	\caption{Fed stress tests 2015-2018: scenarios of GDP growth}
	\centering
	\begin{tabular}{l|lll|lll|lll|lll|}
		\hline \hline
				& \multicolumn{3}{c|}{2015} & \multicolumn{3}{c|}{2016}& \multicolumn{3}{c|}{2017}& \multicolumn{3}{c|}{2018}\\
		time	& base& adv.&sev.&base& adv.&sev.&base& adv.&sev. &base& adv.&sev.\\
		\hline
		2014Q4 & 3   & -0.6 & -3.9 &     &      &      &     &      &      &     &      &      \\
		2015Q1 & 2.9 & -1.3 & -6.1 &     &      &      &     &      &      &     &      &      \\
		2015Q2 & 2.9 & -0.2 & -3.9 &     &      &      &     &      &      &     &      &      \\
		2015Q3 & 2.9 & 0.2  & -3.2 &     &      &      &     &      &      &     &      &      \\
		2015Q4 & 2.9 & 0.3  & -1.5 &     &      &      &     &      &      &     &      &      \\
		2016Q1 & 2.9 & 0.8  & 1.2  & 2.5 & -1.5 & -5.1 &     &      &      &     &      &      \\
		2016Q2 & 2.9 & 1.2  & 1.2  & 2.6 & -2.8 & -7.5 &     &      &      &     &      &      \\
		2016Q3 & 2.9 & 1.7  & 3    & 2.6 & -2   & -5.9 &     &      &      &     &      &      \\
		2016Q4 & 2.9 & 1.8  & 3    & 2.5 & -1.1 & -4.2 &     &      &      &     &      &      \\
		2017Q1 & 2.7 & 1.8  & 3.9  & 2.4 & 0    & -2.2 & 2.2 & -1.5 & -5.1 &     &      &      \\
		2017Q2	& 2.7 & 1.9  & 3.9  & 2.5 & 1.3  & 0.4  & 2.3 & -2.8 & -7.5 &     &      &      \\
		2017Q3 & 2.6 & 2    & 3.9  & 2.3 & 1.7  & 1.3  & 2.4 & -2   & -5.9 &     &      &      \\
		2017Q4 & 2.6 & 2.2  & 3.9  & 2.3 & 2.6  & 3    & 2.3 & -1.5 & -5.1 &     &      &      \\
		2018Q1 &     &      &      & 2.6 & 2.6  & 3    & 2.4 & -0.5 & -3   & 2.5 & -1.3 & -4.7 \\
		2018Q2 &     &      &      & 2.4 & 3    & 3.9  & 2.4 & 1    & 0    & 2.8 & -3.5 & -8.9 \\
		2018Q3 &     &      &      & 2.3 & 3    & 3.9  & 2.4 & 1.4  & 0.7  & 2.6 & -2.4 & -6.8 \\
		2018Q4 &     &      &      & 2.3 & 3    & 3.9  & 2.3 & 2.6  & 3    & 2.5 & -1.3 & -4.7 \\
		2019Q1 &     &      &      & 2.1 & 3    & 3.9  & 2   & 2.6  & 3    & 2.3 & -0.7 & -3.6 \\
		2019Q2 &     &      &      &     &      &      & 2.1 & 3    & 3.9  & 2.3 & 0.4  & -1.3 \\
		2019Q3 &     &      &      &     &      &      & 2.1 & 3    & 3.9  & 2.1 & 1    & -0.2 \\
		2019Q4 &     &      &      &     &      &      & 2   & 3    & 3.9  & 2   & 2.5  & 2.8  \\
		2020Q1 &     &      &      &     &      &      & 2   & 3    & 3.9  & 2.1 & 2.8  & 3.5  \\
		2020Q2 &     &      &      &     &      &      &     &      &      & 2.1 & 3    & 4    \\
		2020Q3 &     &      &      &     &      &      &     &      &      & 2.1 & 3.2  & 4.2  \\
		2020Q4 &     &      &      &     &      &      &     &      &      & 2.1 & 3.3  & 4.5  \\
		2021Q1 &     &      &      &     &      &      &     &      &      & 2.1 & 3.3  & 4.5 \\
		\hline \hline
	\end{tabular}
			\subcaption*{\textit{Notes:}  For each year between 2015 and 2018 the table reports the baseline, adverse and severely adverse supervisory scenarios for U.S. GDP growth (annualized quarter-on-quarter, in percentage) included in the annual stress test conducted by the Federal Reserve (see Federal Reserve Board 2014, 2016, 2017, 2018).}
\label{tab:fed_scenarios}
\end{table}








\begin{table}[H]
	\caption{Density forecast performance of optimized regime-switching models vs. benchmarks}% \label{tab:title} 
	\centering
	{
	\begin{tabular}{l|ll|ll}
		\hline \hline
		forecasting method & APD   & KS   & LB1  & LB2   \\
		\hline
		AR				         & 0.27 & 0.00 & 0.61 & 0.01 \\
		AR - rolling windows        & 0.33 & 0.10 & 0.59 & 0.00 \\
		MSAR - view with max marg. lik.      & 0.35 & 0.03 & 0.73 & 0.84 \\
		MSAR - equal forecast weights   & 0.31 & 0.01 & 0.39 & 0.34 \\
		MSAR - Equal prior probabilities        & 0.35 & 0.02 & 0.70 & 0.83 \\
		\textbf{MSAR - Optimal weights} $\mathbf{w}_{1}^*$ & 0.35 & 0.08 & 0.69 & 0.81 \\
		\textbf{MSAR - Optimal priors }$\boldsymbol{\pi}_{1}^*$  & 0.35 & 0.06 & 0.74 & 0.75 \\
	\textbf{MSAR - Optimal weights} $\mathbf{w}_{2}^*$ & 0.32 & 0.21 & 0.26 & 0.80\\
		\textbf{MSAR - Optimal priors} $\boldsymbol{\pi}_{2}^*$  &0.33 & 0.32 & 0.36 & 0.89\\
		\hline \hline
	\end{tabular}
	}
			\subcaption*{\textit{Notes:} The table reports the density forecast performance of the Markov-switching autoregressive (MSAR) model for U.S. GDP using optimal pools of views and compares it with several benchmark methods. The optimal pools include log-score-based forecast combinations (optimal weights $\mathbf{w}_{1}^*$), log-score-based Bayesian averaging (optimal prior probabilities $\boldsymbol{\pi}_{1}^*$), PIT-based forecast combinations (optimal weights $\mathbf{w}_{2}^*$), where PIT stands for probability integral transform, and PIT-based Bayesian averaging (optimal prior probabilities $\boldsymbol{\pi}_{12}^*$). Please refer to Section \ref{subsec:results} in the paper for further details on the forecasting methods compared here. APD denotes the average predictive density, KS denotes the p-value of the Kolmogorov-Smirnov test of uniformity of the probability integral transforms. LB1 and LB2 denote the p-values of the Ljung-Box test of serial independence in the first and second moment of the PITs, respectively. All statistics are computed over the period 1978Q1-2017Q2.
			 }
\label{tab:results}
\end{table} 


\begin{table}[H]
		\caption{Density forecast performance of Student-\textit{t} AR, AR-ARCH and AR-GARCH models}%  
	\centering
	{
	\begin{tabular}{l|ll|ll}
		\hline \hline
		forecasting method & APD   & KS   & LB1  & LB2   \\
		\hline
		AR(5) with \textit{t} errors (recursive)  & 0.30 & 0.00 & 0.56 & 0.06 \\
		AR(5) with \textit{t} errors (rolling 80) & 0.37 & 0.50 & 0.76 & 0.04 \\
		AR(5) with \textit{t} errors (rolling 40) & 0.37 & 0.32 & 0.96 & 0.06 \\
		AR(5)-ARCH(1) (recursive)        & 0.27 & 0.00 & 0.57 & 0.00 \\
		AR(5)-ARCH(1)  (rolling 80)      & 0.32 & 0.12 & 0.82 & 0.00 \\
		AR(5)-ARCH(1)  (rolling 40)      & 0.33 & 0.69 & 0.94 & 0.00 \\
		AR(5)-GARCH(1,1) (recursive)     & 0.20 & 0.00 & 0.92 & 0.00 \\
		AR(5)-GARCH(1,1) (rolling 80)    & 0.29 & 0.00 & 0.79 & 0.00 \\
		\hline \hline
	\end{tabular}
}
			\subcaption*{\textit{Notes:} The table reports the density forecast performance of autoregressive models non-normal (Student-$t$) or heteroskedastic (ARCH/GARCH) errors. APD denotes the average predictive density, KS denotes the p-value of the Kolmogorov-Smirnov test of uniformity of the probability integral transforms (PITs).  LB1 and LB2 denote the p-values of the Ljung-Box test of serial independence in the first and second moment of the PITs, respectively. The AR-GARCH model on rolling windows of length 40 quarters is not supported by the data and is therefore not reported. All statistics are computed over the period 1978Q1-2017Q2. 
			Please refer to Section \ref{subsec:results} in the paper for details on the forecasting methods compared in the table.}
\label{tab:art_garch}
\end{table}



\begin{figure}[H]
	\caption{Calibrated density forecasts of U.S. GDP growth: evolution of p.d.f. over time}
	\centering
	\includegraphics[scale=0.7]{pdf_time_.png}
	\includegraphics[scale=0.6]{pdf_time_fanchart_.png}
				\subcaption*{\textit{Notes:} For each quarter from 1978Q1 to 2017Q2, the upper part of the figure plots the probability density function of the 1-quarter-ahead forecasts of U.S. GDP growth (in percentage) produced in the previous quarter using the optimal priors based on the PIT-based optimization procedure.
				The lower part shows the corresponding \textit{fan chart}, in which different shades of color identify different percentiles of the forecast distribution (1\%, from 5\% to 95\% in steps of 5\%, and 99\%). The red line is the realized time series of GDP growth.}
\label{fig:pdf_time}
\end{figure}


%\begin{landscape}
	%	\vspace*{\fill}
	\begin{figure}[H]
		\caption{Optimal log-score-based forecast combination weights ($\mathbf{w}_1^{*}$) over time}
		\centering
		\includegraphics[scale=0.15]{w1.png}
		\subcaption*{\textit{Notes:} The area chart in the left panel shows the time-varying forecast combination weights for all the 13 views used to estimate the Markov-switching AR model. The chart goes from 1978Q1 to 2017Q2. The weights ($\mathbf{w}_1^{*}$) are obtained using the log-score-based optimization procedure described in the paper. The right panel plots the cumulative weight assigned to the views derived from Fed supervisory scenarios (views 6-13).  See Table \ref{tab:views} for the list of views.}
		\label{fig:w1}
	\end{figure}

\begin{figure}[H]
	\caption{Optimal PIT-based forecast combination weights ($\mathbf{w}_2^{*}$) over time}
	\centering
	\includegraphics[scale=0.15]{w2.png}
	\subcaption*{\textit{Notes:} The area chart in the left panel shows the time-varying forecast combination weights for all the 13 views used to estimate the Markov-switching AR model. The chart goes from 1978Q1 to 2017Q2. The weights ($\mathbf{w}_2^{*}$) are obtained using the PIT-based optimization procedure described in the paper, where PIT stands for probability integral transform. The right panel plots the cumulative weight assigned to the views derived from Fed supervisory scenarios (views 6-13).  See Table \ref{tab:views} for the list of views.}
	\label{fig:w2}
\end{figure}


	\begin{figure}[H]
		\caption{Optimal log-score-based posterior probabilities (prior $\boldsymbol{\pi}_1^{0*}$) over time}
		\centering
		\includegraphics[scale=0.15]{pi1.png}
		\subcaption*{\textit{Notes:} The area chart in the left panel shows the time-varying Bayesian posterior probabilities for all the 13 views used to estimate the Markov-switching AR model. The chart goes from 1978Q1 to 2017Q2. The underlying prior probabilities $\boldsymbol{\pi}_1^{0*}$ are obtained using the log-score-based optimization procedure described in the paper. The right panel plots the cumulative weight assigned to the views derived from Fed supervisory scenarios (views 6-13).  See Table \ref{tab:views} for the list of views.}
		\label{fig:pi1}
	\end{figure}


	\begin{figure}[H]
		\caption{Optimal PIT-based posterior probabilities (prior $\boldsymbol{\pi}_2^{0*}$) over time}
		\centering
		\includegraphics[scale=0.15]{pi2.png}
		\subcaption*{\textit{Notes:} The area chart in the left panel shows the time-varying Bayesian posterior probabilities for all the 13 views used to estimate the Markov-switching AR model. The chart goes from 1978Q1 to 2017Q2. The underlying prior probabilities $\boldsymbol{\pi}_2^{0*}$ are obtained using the PIT-based optimization procedure described in the paper, where PIT stands for probability integral transform. The right panel plots the cumulative weight assigned to the views derived from Fed supervisory scenarios (views 6-13).  See Table \ref{tab:views} for the list of views.}
		\label{fig:pi2}
	\end{figure}



\begin{appendices}
	\section{Prior on the regime-switching variance}\label{sec:appendix}
	Based on the properties of the Gamma and inverted Gamma distributions, it holds that:
	\begin{gather}
	\text{E}(\sigma^2_k|C_0) = \frac{C_0}{c_0-1}\\[0.5em]
	\text{Var}(\sigma^2_k|C_0)=\frac{C_0^2}{(c_0-1)^2(c_0-2)}\\[0.5em]
	\text{E}(C_0) = \frac{g_0}{G_0} = 1\\[0.5em]
	\text{Var}(C_0) = \frac{g_0}{G_0^2} = 2\\[0.5em]
	\text{E}(C_0^2) = \left(\frac{g_0}{G_0}\right)^2  + \frac{g_0}{G_0^2}= 3 \\
	\end{gather}
	
	Given the values for the hyperparameters, $c_0=3$, $g_0=0.5$ and $G_0=0.5$, it follows that:
	%
	\begin{gather}
	\text{E}(\sigma^2_k) = \frac{\text{E}(C_0)}{c_0-1} = 0.5
	\end{gather}
	\begin{align}
	\text{Var}(\sigma^2_k) &= \text{E}(\text{Var}(\sigma^2_k|C_0)) + \text{Var}(\text{E}(\sigma^2_k|C_0)) =\\[0.5em]
	&= \frac{\text{E}(C_0^2)}{(c_0-1)^2(c_0-2)} + \frac{\text{Var}(C_0^2)}{(c_0-1)^2}  = \\[0.5em]
	&= \frac{3}{4} + \frac{1}{2}=  1.25
	\end{align}
\end{appendices}

\end{document}

%%%%%%   A

    	\bibitem{}
		Alessandri, P., \& Mumtaz, H. (2017). Financial conditions and density forecasts for US output and inflation. \textit{Review of Economic Dynamics}, 24, 66–78.
		
%%%%%%   B

		\bibitem{}		
		
		Bauwens, L., Carpantier, J.F., \& Dufays, A. (2017). Autoregressive Moving Average Infinite Hidden Markov-Switching Models. \textit{Journal of Business and Economic Statistics}, 35(2), 162-182.


%%%%%%   C

		\bibitem{}				
			Corradi, V., \& Swanson, N.R. (2006). Predictive Density Evaluation. In \textit{Handbook of Economic Forecasting}, Vol. 1, Elliott, G., Granger,  C.W.J., \& Timmermann, A. (eds.), pp. 197–284, Elsevier.
		
		
%%%%%%   D

		\bibitem{}		
		Diebold, F. X., Gunther, T.A., \& Tay, A.S. (1998). Evaluating density forecasts. \textit{International Economic Review}, 39(4), 863–883.
%%%%%%   E

		\bibitem{}
		Elliott, G., \& Timmermann, A. (2016), \textit{Economic Forecasting}. Princeton, Princeton University Press.


%%%%%%   F

		\bibitem{}
		Federal Reserve Board (2014). 2015 Supervisory Scenarios for Annual Stress Tests Required under the Dodd-Frank Act Stress Testing Rules and the Capital Plan Rule. Federal Reserve Board report.

		\bibitem{}
		Federal Reserve Board (2016). 2016 Supervisory Scenarios for Annual Stress Tests Required under the Dodd-Frank Act Stress Testing Rules and the Capital Plan Rule. Federal Reserve Board report.
		
			\bibitem{}
		Federal Reserve Board (2017). 2017 Supervisory Scenarios for Annual Stress Tests Required under the Dodd-Frank Act Stress Testing Rules and the Capital Plan Rule. Federal Reserve Board report.

		\bibitem{}
		Federal Reserve Board (2018). 2018 Supervisory Scenarios for Annual Stress Tests Required under the Dodd-Frank Act Stress Testing Rules and the Capital Plan Rule. Federal Reserve Board report.

		\bibitem{}
		Fr{\"u}hwirth-Schnatter, S. (2006). \textit{Finite Mixture and Markov Switching Models}. Springer Series in Statistics, Springer, New York.
	
		\bibitem{}
		Fr{\"u}hwirth-Schnatter, S. (2008). \textit{Finite Mixture and Markov Switching Models. Implementation in MATLAB using the package
		\texttt{bayesf Version 2.0}}. Springer Series in Statistics, Springer, New York. http://statmath.wu.ac.at/\textasciitilde{}fruehwirth/monographie/.



%%%%%%   G
		\bibitem{}
		Ganics, G. (2017). Optimal Density Forecast Combinations. Banco de España Working Paper N. 1751.
	
		\bibitem{}	
		Geweke, J., \& Amisano, G. (2011). Optimal prediction pools. \textit{Journal of Econometrics}, 164(1), 130–141.


%%%%%%   H


		\bibitem{}
		Hall, S.G., \& Mitchell, J. (2007). Combining density forecasts. \textit{International Journal of Forecasting}, 23, 1–13.
		
		\bibitem{}		
		Hansen, B.E. (1994). Autoregressive conditional density estimation. \textit{International Economic Review}, 35(3), 705–30.
		
		\bibitem{}
		Hamilton, J.D. (1989). A new approach to the economic analysis of nonstationary time series and the business cycle. \textit{Econometrica}, 57, 357–384.
		
		\bibitem{}		
		Hamilton, J.D. (2018). Macroeconomic Regimes and Regime Shifts. In \textit{Handbook of Macroeconomics}, Vol. 2, Taylor, J.B. \& Uhlig, H. (eds.), pp. 163–201, Amsterdam, North-Holland.


%%%%%%   M

		\bibitem{}
		Moody's (2018). U.S. Macroeconomic Outlook Alternative Scenarios. Moody's Analytics. https://www.economy.com/.
		
		
%%%%%%   P

		\bibitem{}
		Pesaran, M.H., Pettenuzzo, D., \& Timmermann, A. (2006). Forecasting time series subject to multiple structural breaks. \textit{Review of Economic Studies}, 73, 1057–84.

%%%%%%   R
    	\bibitem{}
		Rossi, B., \& Sekhposyan, T. (2014). Evaluating predictive densities of US output growth and inflation in a large macroeconomic data set. \textit{International Journal of Forecasting}, 30(3), 662–682.
		
%%%%%%   Y
		
		\bibitem{}
		Yuen, K. (2013). Determining the Severity of Macroeconomic Stress Scenarios. Federal Reserve Bank Supervisory Staff Reports.