mh_recover:No stored previous proposal density found

Dear Prof.Pfeifer

I was running a RWMH and my computer crashed somehow.I tried to restart RWMH but the error message showed that

Estimation::mcmc: Recover mode!
Estimation::mcmc: No stored previous proposal density found, continuing with the one implied by the mode_file

Is it a bug ? or Did i miss something in my estimation command? I thank you for your help inadvance.

estimation(datafile='obs_consumption_37.mat',conf_sig=0.95,diffuse_filter,mode_compute=0,fast_kalman_filter,mode_file='Sector37_model_mode',prior_trunc=0,plot_priors=0,mh_replic=1500000,mh_jscale=0.12405,mh_nblocks=5,mh_recover) c;

jason

Is there a mh_history_0.mat file in your metropolis-subfolder. If yes, please provide it here.

Sector37_model_mh_history_0.mat (21.7 KB)

yes, I upload the file here

It seems there is bug here, see Store field necessary for mh_recover (!2062) · Merge requests · Dynare / dynare · GitLab
That being said, it should still work.

Hi,Prof.Pfeifer

I modifed the posterior_sampler_initialization.m as instructed but still got the same error.I set a breakpoint at

[line 301] record.ProposalCovariance=d;

to see what actually happened.I found it skip the first part of the loop which begins from

[line 86 ] if ~options_.load_mh_file && ~options_.mh_recover, to

[line 322]elseif options_.load_mh_file && ~options_.mh_recover

so d is not assigned to record.ProposalCovariance.

The problem is that in your first run, record.ProposalCovariance was not saved. In the else-clauses you refer to, that is tried by set_proposal_density_to_previous_value, but it will not work. You cannot fix that ex-post. The bug fix makes sure that in the future that will not happen again.

Thank you professor, I understand the code right now