Bayesian estimation: matrix singularity

Dear Dynare users,

I try to estimate a medium-scale DSGE model but I encounter the following warning:

[code]Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN.

In kalman_filter at 182
In dsge_likelihood at 646
In gmhmaxlik at 108
In dynare_estimation_1 at 418
In dynare_estimation at 89
In Bayes at 770
In dynare at 180
Warning: Matrix is singular to working precision.
In lyapunov_symm at 145
In dsge_likelihood at 374
In gmhmaxlik at 108
In dynare_estimation_1 at 418
In dynare_estimation at 89
In Bayes at 770
In dynare at 180 [/code]

This happens for each iteration. The model seems to be ok. When I run stoch.simul command with given values of parameteres, all variables converge to their st.st. values and the responses are as expected.

However, the estimation does not work. What can I do with this? Is there any solution? I would like to kindly ask you for a help. Please see the model code and data attached.

Thank you very much.

Jan
Code.rar (8.86 KB)

I am not sure what you are doing, but please upgrade to Dynare 4.5.

Your model features a unit root. Therefore, you need to specify

diffuse_filter

When you do that, you will get the message

As the message says, you have stochastic singularity. Could it be that you are observing all components of the budget constraint?

Dear prof. Pfeifer,

thank you very much for reply. Sorry for such a late answer. I was not able to respond.

I tried to estimate the model with all but one time series used in initial estimation. The estimation procedure looks fine now, there are no errors or warnings. However, the posterior distributions do not look good (please see attached file). What could be the reason behind? Can you guess?

I ran the estimation with the following specification: diffuse_filter, mode_check, mh_replic=10000, mh_nblocks=2, mh_drop=0.3, mh_jscale=0.4, mode_compute=6.

Should I try another optimization routine, or the problem lies elsewhere? Thank you very much for helping me!

With kind regards

Jan

Posteriors.zip (59.1 KB)

Dear Jan,

Looking at your plots I have the impression that you should increase the number of iterations in the metropolis, clearly mh_replic=10000 is too small. So you should restart the estimation with the following options:

diffuse_filter,
model_compute=0,
mode_file=<THE_BASE_NAME_OF_YOUR_MOD_FILE>_mode,
mh_replic=100000,
mh_nblocks=2,
mh_drop=.3,
mh_jscale=.4,
load_mh_file

The last option is important. With this option Dynare sets as an initial condition the last state of the MCMC in the previous estimation. Without this option, the draws of the previous MCMC are discarded. You can also check the convergence diagnostics at the end of the estimation… And run again the estimation (with the same options) if more iterations are needed.

Best,
Stéphane.

Dear Stéphane,

thank you very much for useful advice. I thought this could be a problem. I will try to re-estimate the model with more number of replications.

Have a nice day

Jan