Mode_file from mode=6 means high acceptance

Sorry, but this question was really tricky (and dates some time back, see [Option mh_recover; problem with acceptance rate)). The thing seems to be that the variable “Scale” (the mh_jscale estimated from mode_compute=6) is stored in a different file [ModelName ‘_optimal_mh_scale_parameter.mat’]. However, in the sequential MH-algorithm, this value is currently not loaded from the file. Instead, Dynare uses the default value of mh_jscale=0.2, resulting in either too high or too low acceptance rates, depending on whether “Scale” was smaller or larger.

A potential solution that seems to work is to change lines 121-130 of random_walk_metropolis_hastings_core.m to:

if any(isnan(bayestopt_.jscale)) || (options_.mode_compute==0 && ~isempty(options_.mode_file)) if exist([ModelName '_optimal_mh_scale_parameter.mat'])% This file is created by mode_compute=6. load([ModelName '_optimal_mh_scale_parameter']) proposal_covariance_Cholesky_decomposition = d*Scale; else error('mh:: Something is wrong. I can''t figure out the value of the scale parameter.') end else proposal_covariance_Cholesky_decomposition = d*diag(bayestopt_.jscale); end

This also fixes a typo in line 124.

I hope this helps.