Estimation error: negative number of draws

Good afternoon,

I am posting this inquiry because I encountered an issue while estimating parameters using Dynare. I used the following estimation options:

estimation(datafile=ctwdata,
           bayesian_irf, irf=20,
           conf_sig=0.95,
           smoother,
           filtered_vars,
           forecast=8,
           mh_jscale=0.25,
           mode_compute=6,
           presample=4,
           prior_trunc=0,
           mh_replic=400000,
           mh_drop=200000,
           mh_nblocks=3,
           lik_init=2)

After setting these options and executing the estimation, I received the following message:

Log data density [Laplace approximation] is -2387.446472.

Estimation::mcmc: Multiple chains mode.
Estimation::mcmc: Searching for initial values...
Estimation::mcmc: Initial values found!

Estimation::mcmc: Write details about the MCMC... Ok!
Estimation::mcmc: Details about the MCMC are available in CTW/metropolis/CTW_mh_history_0.mat

Estimation::mcmc: Number of mh files: 3 per block.
Estimation::mcmc: Total number of generated files: 9.
Estimation::mcmc: Total number of iterations: 400000.
Estimation::mcmc: Current acceptance ratio per chain:
                                                       Chain  1: 9.845%
                                                       Chain  2: 11.2043%
                                                       Chain  3: 16.704%
Estimation::mcmc: Total number of MH draws per chain: 400000.
Estimation::mcmc: Total number of generated MH files: 3.
Estimation::mcmc: I'll use mh-files 486400 to 3.
Estimation::mcmc: In MH-file number 486400 I'll start at line 10875.
Estimation::mcmc: Finally I keep -79999600000 draws per chain.

Then, during subsequent operations, I encountered the following error:

An error occurred during the following operation: reshape
The elements of the size vector must not be negative.

Error in mcmc_diagnostics (line 83)
    Draws = reshape(Draws, [NumberOfDraws nblck]);
Error in dynare_estimation_1 (line 465)
                oo_ = mcmc_diagnostics(options_, estim_params_, M_, oo_);
Error in dynare_estimation (line 105)
    dynare_estimation_1(var_list, dname);
Error in CTW.driver (line 4351)
oo_recursive_ = dynare_estimation(var_list_);
Error in dynare (line 308)
    evalin('base', [fname '.driver']);

I have 200,000 draws to keep, but the log indicates “Finally I keep -79999600000 draws per chain.” Could someone please explain why the estimation attempts to store a negative number of draws? It seems that storing a negative number of draws is causing the error. How can this issue be resolved?

For context, I did not encounter any problems when I set mh_replic=20000 for testing. However, after slightly modifying the prior distributions and setting mh_replic=400000 (since the paper I referenced used 400000–200000 draws), the issue occurred. Could this change be related to the problem?

I am attaching my code here. By the way, this model is so huge that it takes more than one and half hour even if I made only 20000 draws.

my code:
CTW.zip (34.2 KB)

Thank you very much for your time and for always providing high-quality responses. I appreciate any guidance you can offer.

Very Respectfully,

Now I found the reason my estimation was messed up.

I should have set mh_drop option appropriately.

Sorry for making you confused :frowning:

Have a great day Dynariest :slight_smile:

Yes, mh_drop must be between 0 and 1. We will add a check in future versions that prevents this cryptic error message: initial_estimation_checks.m: ensure that mh_drop has valid value (!2350) · Merge requests · Dynare / dynare · GitLab