Error using chol - The matrix must be positive definite

I am trying to estimate the DSGE model in Meh and Moran(2010) featuring more shocks. Since the model is derived by eight, shocks, I am trying to estimate it using the following eight series:
(output ,investment, consumption, earnings, inflation, nominal interest rate, banks’ net worth, non-financial business’s net worth) I also have the option to replace one of the series with banks’ total lending.

I read the guide written by Pfiefer and specified observation equations accordingly. When I estimate the model with real data, however, I get the following error:

Error using chol - The matrix must be positive definite.
Note that by comparing simulated data with real data, the only difference is the range of the variables. For example, in real data deviation from zero is expressed in percentage (eg. 0.02) and it runs from -0.01 to 0.04 while for simulated data it runs from -10 to 10.
I tried the following to figure out the cause of the problem:
1 - I used simulated data from the model, good estimation results were obtained by using mode_compute = 6.
2 - I ran model diagnostics and there was no obvious problems.
3 - I tried different mode_compute (4,6,9) and the same error message is given.
4 - I tried the option mcmc_jumping_covariance=identity_matrix, I obtained some results but they don’t make any sense.
5 - I tried to rescale observation equations by dividing them by 100. the range in real data and simulated data is the same but again I get the same error message.
6- I tried to run everything on the snapshot unstable version of Dynare and the problem is the same.

I am wondering what might be the cause of this problem! any suggestion is highly appreciated. I attached the mod file and the data file.

First of all, my last name is Pfeifer, not Pfiefer.

Second, it seems you did not read my Guide thoroughly enough.
It clearly stated you should not use a two-sided HP-filter. It also never recommends HP-filtering growth rates. Why would you do that? And why do you match filtered growth rates, which are log differences, to the absolute deviation of model variables from their steady state? You must of course also use logged model variables in this case as otherwise the scaling will matter (which is what you report). Similarly, you do not divide your data by 100. Why are you doing so with your model variables?

Also, are you sure that there is no issue of stochastic singularity coming from the fact that you seem to potentially observe all elements of the resource constraint (I don’t know the model so I cannot say this definitely. You need to check.)?

Thanks a lot for your help, I addressed the issues that you pointed out and the problem is fixed using mode_compute = 6.

Regarding stochastic singularity, my understanding is that it causes problems for Bayesian estimation when the number of endogenous(observed) variables exceeds the number of exogenous shocks. I limited the number of observables to eight to avoid problems caused by stochastic singularity in particular. Of course the choice of these variables matter as it is explained, among other work in the literature, by Canova et al. (2014). For this reason, I am going to estimate the model with different set of observables. I am already using the identification diagnostic tools in Dynare as a guidance in the choice of observables but I am wondering if there are other available tools?


Having at most as many observables as shocks is a necessary, but not a sufficient condition. Aditionally, you need that you are not observing a perfect linear combination of observed variables. For example, take the resource constraint:

Even if you have three shocks and observe all three variables, you will have stochastic singularity. The reason is that upon observing any two variables of this equation, the third one immediately follows, i.e. the implied forecast error is 0.