Using my own estimate of the mode and Hessian matrix

Hello,

I’m trying to start a chain from a particular mode of my choice, and would also like the use my estimate of the Hessian matrix. The mode file I am using is a .mat file which contains two elements: xparam1 (with the mode) and hh (the hessian).

However, when I try to run the estimation command below

estimation(datafile=us_dat,mode_file=LOWW_benchmark_5_estimate_mode,mode_compute=0,nobs=188,presample=12,mh_replic=500000,mh_nblocks=4,mh_jscale=0.18,mh_init_scale=0.01);

I get the following error message:

??? Output argument “info” (and maybe others) not assigned during call to “C:\Dynare\dynare_v3\matlab\DsgeLikelihood.m (DsgeLikelihood)”.

Error in ==> DsgeLikelihood at 5
global bayestopt_ exo_nbr dr_ estim_params_ Sigma_e_ options_ xparam1_test

Error in ==> initial_estimation_checks at 20
[fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data);

Error in ==> dynare_estimation at 253
initial_estimation_checks(xparam1,gend,data);

Error in ==> LOWW_benchmark_5_estimate at 500
dynare_estimation(var_list_);

Error in ==> dynare at 26
evalin(‘base’,fname) ;

If I suppress the mode_file=… from the estimation options and set mode_ compute=1 then the estimation works fine.

Is there a way to load the mode that will be used to start the chain, and can I also load the Hessian used for the jumping distribution? The files I am using are attached.

Thank you so much for your help.

Kind regards,
Daniel Beltran
Federal Reserve Board
Model_mode_and_data_files.zip (15 KB)

did you check whether the size of xparam1 you enter and the number of parameters dynare has been instructed to estimate are the same?
also check if the sequence of parameters that you entered in the xparam1 vector conforms to the sequence of parameters you defined in the estimated_params block.

reuben

Hi Reuben,

Thanks for your reply. The size of xparam1 is 31 x 1 and I am estimating 31 parameters. The order in which they are specified is also the same as in the estimate parameters block. The hessian (hh) matrix is 31 x 31.

The files I am using are attached as a zip to the first message I posted.

Kind regards,
Daniel

Hi,

you should go inside the code “initial_estimation_checks.m” and then in “DsgeLikelihood.m” (use a dbstop command) and then see what the error is. One possibility is that the initial mode_file you load could be outside the bounds of the priors.

Cosmin

Thanks for the tip, I’ll try that.

Daniel

Hey dbeltran17, can you tell me how to calculate my own Hesse matrix?

That thread is 16 years old. I doubt you will get an answer. What exactly is your question? There are various functions available to compute numerical Hessians for an objective function.

I added some formulas to Volha Audzei’s code and added nine parameters. A TC_july21_no_mode.mat file containing hh is needed for estimation. Adding parameters means e

code.zip (229.9 KB)
xpanding this file, I don’t know how to get this file

In this case, you need to run mode-finding again. Simply use the posterior mode for those parameters and pick some initial values for the newly introduced parameters.

Thank you, prof. jpfeifer !

Dear professor, I used the code the author provided, and changed the code

estimation(mode_compute=0, mode_file=TC_july21_no_mode,
prior_trunc=0,graph_format=pdf, plot_priors=0, datafile=data, xls_sheet=Sheet1, xls_range=A1:CB102, first_obs=1,presample=15, 
prefilter=0,
mh_replic=0, mh_nblocks=10, 
//mh_replic=100000, mh_nblocks=10, 
//, load_mh_file ,mh_jscale=0.20, 
mh_drop=0.2, lik_init=2, nodisplay 
//, mh_recover
//, load_results_after_load_mh //,silent_optimizer 
//, mode_check
 );

to

(optim=('MaxIter',200),mode_compute=5, prior_trunc=0,graph_format=pdf, plot_priors=0, datafile=data, xls_sheet=Sheet1, xls_range=A1:CB102, first_obs=1,presample=15, 
prefilter=0,
mh_replic=0, mh_nblocks=10, 
//mh_replic=100000, mh_nblocks=10, 
//, load_mh_file ,mh_jscale=0.20, 
mh_drop=0.2, lik_init=2, nodisplay 
//, mh_recover
//, load_results_after_load_mh //,silent_optimizer 
//, mode_check
 );

but I can’t get the same mode.mat file(TC_july21_no_mode) the author provided.
I changed the range of stderr ea_ch (change the upper bound to 4) for matlab told it’s out of the range.
I don’t know how to solve the problems

You should always try to start from the previous mode. The original authors may have spent a long time trying to find the actual mode.

Thank you, Prof. Jpfeifer