This page documents the Dynare interface to the Markov Switching VAR code from Sims, Waggoner and Zha (SWZ).

Existing interface

Two commands are already available from MOD files (in Dynare unstable version):

These two commands accept the options listed on the MarkovSwitchingOptions page: fourth column of the table gives the name of the option from Dynare standpoint, and last column is the default value.

Proposal for extending the interface

SVAR identification

  1. SVAR identification scheme is described in svar_identification block:

    svar_identification;
    ...
    ...
    end;
  2. Well-know schemes are identified by simple keywords. Currently:
    svar_identification;
    upper_cholesky;
    end;
    or
    svar_identification;
    lower_cholesky;
    end;
  3. More sophisticated schemes are described by listing exclusion restrictions on $A_0$ or $A_+$:

    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;
    This generates
    options_.ms.Qi
    options_.ms.Ri

    See detail of the implementation in SvarExclusionInterface

  4. The constant can be excluded in every equation:
    svar_identification;
     exclusion constants;
     exclusion lag 0;
     equation 1, y, pi;
     equation 2, pi, r;
     ...
    end;
    or
    svar_identification;
     exclusion constants;
     upper_cholesky;
    end;

    Note that options_.ms.Ri doesn't reflect exclusion of constants. This is added later on the fly by ./matlab/ms-sbvar/identification/exclusion.m when computing Vi

  5. Syntax for linear restrictions:
    • Example
    •    svar_identifications;
         ...
         restriction equation 1, coeff(y,-1)-coeff(pie,-1)=0;
         restriction equation 2, coeff(y,-2) = 0;
         ...
         end;
    1. coeff(y,-1) returns a pair with symbol_id for y and lead_lag=-1

    2. the constraint is in the form EXPRESSION = EXPRESSION, the preprocessor must form an homogeneous equation.

    3. the homogeneous equation must be derived with respect to the coeff() terms.

    4. options_.ms.Qi and options_.ms.Ri are filed with these partial derivatives.

    5. it is possible to use this richer syntax to enter the simpler exclusion restrictions above.
  6. svar_identification MUST BE indicated BEFORE sbvar or ms_sbvar statement!

The SVAR model is written as:

 \[
  y_tA_0(s_t) = x_tA_+(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.

Restrictions on SVAR Markov-switching processes

SWZ introduce a restriction on the lagged coefficients in the SVAR. It can be called by svar_restriction(SWZ). The restriction is essential to overparameterization by preventing an excessive number of parameters from changing from one state to another. The restrictions take the following form:

 \[
  A_+(i, j, l, s_t) = g(i, j, l)\delta(i, j, s_t),
 \]

where $i$ stands for the $i^{th}$ variable, $j$ for the $j^{th}$ equation, and $l$ for the $l^{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.

Prior specification on SVAR coefficients

The Sims and Zha (1998) prior applies to $A_0(s_t)$ for all $s_t$ and $g(i,j,l)$ (in the original article by Sims and Zha (1998), the hyperparameter $\lambda_2$ is always set to 1). There are six hyperparameters controlling the tightness of this prior:

  1. $\mu_1$ controls overall tightness of the random walk prior (same as $\lambda_0$ in Sims and Zha (1998)).

  2. $\mu_2$ controls relative tightness of the random walk prior on the lagged coefficients (same as $\lambda_1$ in Sims and Zha (1998)).

  3. $\mu_3$ controls relative tightness of the random walk prior on the constant term (same as $\lambda_4$ in Sims and Zha (1998)).

  4. $\mu_4$ controls tightness of the prior that dampens the erratic sampling effects on lag coefficients (lag decay) (same as $\lambda_3$ in Sims and Zha (1998)).

  5. $\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 (same as $\mu_5$ in Sims and Zha (1998)).

  6. $\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 (same as $\mu_6$ in Sims and Zha (1998)).

Note that while smaller values of $\mu_i$ for $i = 1,...,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. We provide the following benchmark values of these hyperparameters, although one should vary the values for sensitivity check. For quarterly data, Sims and Zha (1998) suggest $\mu_1=1$, $\mu_2=1$, $\mu_3=0.1$, $\mu_4=1$, $\mu_5=1$, and $\mu_6=1$. For monthly data, Sims and Zha (2006) suggest $\mu_1=0.57$, $\mu_2=0.13$, $\mu_3=0.1$, $\mu_4=1.2$, $\mu_5=10$, and $\mu_6=10$.

The prior on $\delta(i,j,s_t)$ for each $i,j$ and $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.

The prior on each element of the diagonal of $\Xi^2(s_t)$ (denoted as Zeta in our output file) is a gamma distribution, represented by Gamma($\bar{\alpha},\bar{\beta}$) with $\bar{\alpha}=1$ and $\bar{\beta}=1$.

Prior specification on Markov Switching processes

  1. Original Markov Switching Bvar syntax. Priors on Markov Switching processes are specified through average duration of each regime markov_switching(chain=i, regime=j, duration=d) specifies that regime $j$ in chain $i$ lasts on average $d$ periods. Alternatively, if all the regimes have the same average duration, it is possible to simply declare the number of regimes in the chain with option number_of_regimes. A duration equal to infinity means an absorbing state. Example:

    markov_switching(chain=1, regime=1, duration=3);
    markov_switching(chain=1, regime=2, duration=0.5);
    markov_switching(chain=2, regime=1, duration=1);
    markov_switching(chain=2, regime=2, duration=4.5);
    markov_switching(chain=2, regime=3, duration=Inf);
    markov_switching(chain=3, number_of_regimes=2, duration=2.5);
    Matlab implementation:
    options_.ms.ms_chain(1).regime(1).duration = 3;
    options_.ms.ms_chain(1).regime(2).duration = 0.5;
    options_.ms.ms_chain(2).regime(1).duration = 1;
    options_.ms.ms_chain(2).regime(2).duration = 4.5;
    options_.ms.ms_chain(2).regime(3).duration = Inf;
    options_.ms.ms_chain(3).regime(1).duration = 2.5;
    options_.ms_ms_chain(3).regime(2).duration = 2.5;
    For each chain, Matlab code will use this information to build the corresponding transition matrix.

    Please NOTE the following:

    1. The change from state to regime and number_of_states to number_of_regimes took place on 21/12/11.

    2. The removal of the regime option took place on 21/12/11.

    3. The correct way to specify an absorbing state is through the restrictions statement outlined below and not by passing Inf to the duration option. The ability to pass the restrictions argument was added on XX/XX/XX. The possibilty to pass Inf to the duration argument was removed on XX/XX/XX.

  2. Markov Switching DSGE syntax is a superset of the new Markov Switching Bvar syntax. The Markov Switching Bvar syntax does NOT contain the parameter and number_of_lags options but is otherwise the same as the Markov Switching DSGE syntax. Specifying a Markov Switching process for the DSGE code takes the following form

    markov_switching(chain=1, number_of_regimes=3, duration=2.5, parameter=[alpha, rho, phi], number_of_lags=2, restrictions=[[1,3,0],[3,1,0]]);
    markov_switching(chain=1, number_of_regimes=3, duration=[0.5, 2.5, 2.5], parameter=[alpha, rho, phi], number_of_lags=2, restrictions=[[1,3,0],[3,1,0]]);

    The chain option takes an integer value. Chains must be consecutive, positive integers, beginning at 1. The number_of_regimes option specifies the total number of regimes in the markov chain. The duration, when passed a real number, specifies the average duration for all regimes in this chain. When passed a vector of size equal number_of_regimes, it specifies the average duration of the associated regime (1:number_of_regimes) in this chain. The parameters option shows which parameters are controlled by this markov chain. The number_of_lags option provides the number of lags that each parameter can take within each regime in this chain. The restrictions option provides restrictions on this chain's regime transition matrix. Its vector argument takes three inputs of the form: [current_period_regime, next_period_regime, transition_probability] (the first two entries are positive integers, and the third is a non-negative real in the set [0,1]). Needless to say, if restrictions are specified for every transition for a regime, the preprocessor should check that the sum of the probabilities is ==1. Otherwise, if restrictions are not provided for every transition for a given regime, the preprocessor should check that the sum of the provided transition probabilities is <1. Regardless of the number of lags, the restrictions are specified for parameters at time t since the transition probability for a parameter at t is equal to that of the parameter at t-1. Preprocessor Matlab output would look like (only implemented for SBVAR version):

    options_.ms.ms_chain(1).regime(1).duration = 0.5;
    options_.ms.ms_chain(1).regime(2).duration = 2.5;
    options_.ms.ms_chain(1).regime(3).duration = 2.5;
    options_.ms.ms_chain(1).restrictions(1) = [1,3,0];
    options_.ms.ms_chain(1).restrictions(2) = [3,1,0];

    Preprocessor C output (only implemented for DSGE version) would consist of one object for every markov_switching statement of the MarkovSwitching Class.

  3. Transition matrix specification (for future use):
    ms_chain(1) = [ 0.25*a, d, 0; a, e, 0; ., ., 1 ];
    ms_chain(2) = [ a, 0; ., . ];
    The sum of the column must be equal to 1. The dot (.) represents the complement to 1.

Associating Markov processes with coefficient matrices

  1. Default in the case of one chain: all the coefficient matrices change
  2. Specific matrices are linked to specific chains:
    svar(coefficients, chain=1);
    svar(variances, chain=1);
    svar(constants, chain=2);         // not available yet
    Matlab implementation:
    options_.ms.ms_chain(1).svar_coefficients.equations = 'ALL';
    options_.ms.ms_chain(1).svar_variances.equations = 'ALL';
    options_.ms.ms_chain(2).svar_constants.equations = 'ALL';
  3. Specific equations are linked to specific chains:
    svar(coefficients, equations=1, chain=2);
    svar(variances, equations=[3, 5], chain=1);
    svar(constants, equations=3, chain=1);           // not available yet
    Matlab implementation:
    options_.ms.ms_chain(2).svar_coefficients.equations = 1;
    options_.ms.ms_chain(1).svar_variances.equations = [3; 5];
    options_.ms.ms_chain(1).svar_constants.equations = 3;

DynareWiki: MarkovSwitchingInterface (last edited 2011-12-21 17:22:00 by HoutanBastani)