Question about marginal data density "ms_compute_mdd"

Dear all,
I am currently working on a replication of a paper where i should use a markov switching SBVAR, estimate it and compare models with marginal data densities.
The code structure is:


The code is fine finding estimates of A0 and A+ however for the MDD part i am getting the following error. What should be the possible reason of it?

MS-SBVAR Marginal Data Density
Unable to open est_final_testv016.out
Processing posterior draws
Matrix not positive definite.


Is this the full error message? Which matrix is not positive definite? In which line of which function does the crash happen?

This is the error that i get:

Elapsed Time: 452 seconds
Burn-in period - 100 draws
Elapsed Time: 453 seconds
Simulating - 1000 draws
1000 * 1 iterations completed out of 1000 * 1
Elapsed Time: 469 seconds
Total Elapsed Time: 469 seconds
MS-SBVAR Marginal Data Density
Processing posterior draws
Matrix not positive definite.
Error in MS-SBVAR MEX file.
Error using mexErrCheck (line 41)
Error encountered in: ms_compute_mdd.
Error in ms_compute_mdd (line 55)
Error in testv016 (line 129)
[options_, oo_] = ms_compute_mdd(M_, options_, oo_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

For further diagnosis I am providing the command window history so that it can be helpful.
Command Window.pdf (580.9 KB)

From what I can see, there is a problem with mode-finding. The objective values shown are so big that they can only be error codes. You need to find out why your VAR does not fit the data/where the problem lies. What happens if you just do OLS on your data without any Bayesian estimation or regime-switching?

First, one by one equation OLS and lower cholesky identification restrictions seems work fine.
The problem looks related with identification restrictions. The paper that I am trying to replicate is “Were There Regime Switches in U.S. Monetary Policy?” by Sims and Zha.
Additional to the exact zero restrictons, they have stated that they added a prior information as a correlation between two equations. More clearly, they use a prior that makes coefficients of two variables positively correlated with 0.8 in one equation and negatively correlated with -0.8 in another equations.
On their original code, they are providing this by creating a H0multi matrix while defining the priors. After that they are combining asymetric prior with linear restrictions.
Does Dynare support such a corrlation between variables in order to create a specific effect?

Unfortunately, I am not very familiar with this part of Dynare. Maybe @HoutanBastani knows more or who to ask.

1 Like