\documentclass{article}

\begin{document}
\title{Proposal for a Dynare interface to SWZ Markov Switching code}
\author{M. Juillard}
%\date{November 25, 2009, Version 1.4}
\date{December 19, 2009, Version 1.5}
\maketitle


\section{SVAR identification}
\begin{enumerate}
\item well known schemes are identified by option. Currently:
\begin{verbatim}
svar_identification(upper_choleksy);
svar_identification(lower_choleksy);
\end{verbatim}
\item more sophisticated schemes are described by listing exculsion restrictions on $A_0$ or $A_+$:
\begin{verbatim}
svar_identification;
exclusion lag 0;
equation 1, y, pi;
equation 2, pi, r;
exclusion lag 1;
equation 1, y, pi;
equation 2, pi, r;
end;
\end{verbatim}
This generates 

\verb+M_.svar_exclusions{lag}(2xn matrix with equation numbers and restricted variable IDs)+\\

The SVAR model is written as
\[
y_t\, A_0(s_t) = x_t\,  A_+(s_t) + \epsilon_t\, \Xi^{-1}(s_t),
\]
where $y_t$ is an $n \times 1$ vector of endogenous variables, $x_t$ is a vector of all lagged variables plus the constant term, the state $s_t$ follows a Markov process, $\Xi^{-1}(s_t)$ is a diagonal matrix in which the diagonal elements represent the state-dependent shock variances, and $\epsilon_t$ has a Gaussian distribution with mean 0 and variance matrix $I$.  The order of $x_t$ follows this convention.  The ordering of variables in each equation has the following convention.  The $n$ variables at the first lag are order first, followed by the $n$ variables at the second lag, and so on.  The last variable is the constant term.
\end{enumerate}

\section{Prior specification on SVAR coefficients}
The Sims and Zha prior applies to $A_0(s_t)$ and $A_+(s_t)$ for all $s_t$.  There are six hyperparameters controlling the tightness of this prior:
\begin{enumerate}
  \item $\mu_1$ controls overall tightness of the random walk prior.
  
  \item $\mu_2$ controls relative tightness of the random walk prior on the lagged coefficients.
  
  \item $\mu_3$ controls relative tightness of the random walk prior on the constant term.
  
  \item $\mu_4$ controls tightness of the prior that dampens the erratic sampling effects on lag coefficients (lag decay).
  
  \item $\mu_5$ controls weight on the sum of coefficients in each equation through $n$ dummy observations excluding the constant term.  This component of the prior expresses belief about unit roots.  
  
  \item $\mu_6$ controls weight on a single dummy initial observation including the constant term.  This component of the prior expresses belief in cointegration relationships (up to $n-1$) and stationarity.  
\end{enumerate}    
Note that while smaller values of $\mu_i$ for $i=1,\dots,4$ means a tighter random walk prior, larger values of $\mu_i$ for $i=5, 6$ means a tighter prior on unit roots and cointegration.  

The prior on each element of the diagonal of $\Xi(s_t)$ is a normal distribution with mean 0 and standard deviation 50.  This prior is diffuse enough to allow for the possibility that VAR coefficients can have extremely large values for some states.  


\section{Restrictions on SVAR Markov-switching processes}
SWZ introduce a restriction on the lagged coefficients in the SVAR. It can be called by \verb+svar_restriction(SWZ)+. The restriction is essential to overparameterization by preventing an \emph{excessive} number of parameters from changing from one state to another.  The restrictions take the following form:
\[
  A_+(i,j,\ell,s_t) = g(i,j,\ell) \delta(i,j,s_t), 
\]
where $i$ stands for the $i^{th}$ variable, $j$ for the $j^{th}$ equation, and $\ell$ for the $\ell^{th}$ lag.  This expression indicates that the coefficients at the first lag may change with state but the coefficients at other lags in each state are proportional those at the first lag in that state.  


\section{Markov Switching processes}
\begin{enumerate}
\item Priors on Marov Switching processes are specified through average duration of each state
\verb+markov_switching(chain=i,state=j,duration=d)+ specifies that state $j$ in chain $i$ last on average $d$ periods.
Alternatively, if all the states have the same average duration, it is possible to simply declare the number of states in the chain with option \verb+number_of_states+\\
Example:
\begin{verbatim}
markov_switching(chain=1,state=1,duration=3);
markov_switching(chain=1,state=2,duration=0.5);
markov_switching(chain=2,state=1,duration=1);
markov_switching(chain=2,state=2,duration=4.5);
markov_switching(chain=2,state=3,duration=2);
markov_switching(chain=3,number_of_states=3,duration=2.5);
\end{verbatim}
\item Transition matrix specification (for future use)
\begin{verbatim}
ms_chain(1) = [0.25*a d 0; 0.25*b e 0; . . 1];
ms_chain(2) = [a 0; . .];
\end{verbatim}
The sum of the column must sum to 1. The dot (.) represents the complement to 1.
\end{enumerate}

\section{Associating Markov processes with coefficient matrices}
\begin{enumerate}
\item default in the case of one chain: all coefficient matrices change
\item specific matrices are linked to specific chains:
\begin{verbatim}
svar(coefficients,chain=1);
svar(variances,chain=1);
svar(constants,chain=2);
\end{verbatim}
\item specific equations are linked to specific chains:
\begin{verbatim}
svar(coefficients,equation=1,chain=2);
svar(variances,equation=3,chain=1);
svar(constants,equation=3,chain=1);
\end{verbatim}
\end{enumerate}



\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
