Historical shock decomposition

I already did what you suggested before. Still, the mode from the mode.mat and the mh_mode.mat are significantly different.
What I understand is that the mode in mode_mat corresponds to the point that maximises the likelihood for the parameter set without compute the posterior with the metropolis hastings algorithm. On the contrary, the mode in the mh_mode.mat is computed with the metropolis hastings algorithm. Nevertheless I didn’t understand yet why the mode from both files should be almost the same.

The check mode plots, priors, posteriors, mode.mat and mh_mode.mat files are annexed below. Overall shock decompositions are Ok, but the posteriors are not very good and with the same model I didn’t reach convergence after 1000000 draws. I tried the command use_tarb weeks ago but it didn’t work either. Can the problem with the mode explain these non satisfactory results?
output consola.txt (118 KB)

1 Like

You mode_check plots still show that you did not start at the mode. Forcing the MCMC by not using the Hessian just overrides this issue. But then convergence will be hard to obtain as the MCMC will move to regions of higher likelihood. When you start at the mode, the MCMC wanders around this same mode and the two mode-files from mode-finding and from the MCMC will be pretty much the same. But this is not the case here. You need to put more effort and time into finding the mode.

Thank you! Just to confirm what you said. Are you suggesting to not use a small identity matrix instead of the hessian? This is what I am trying to do at moment but it seems almost impossible to estimate by bayesian methods the parameter set of the present model.

I also estimate the same model for the Japanese economy (please, see the annex below ). Here it seems that the mode from the mh_mode.mat and mode.mat are pretty similar. Am I right?

Looking at the mode_check plots you are still having the same problem. You did not find the mode. Theory tells you that your MCMC will asymptotically converge to the ergodic distribution with any positive definite covariance matrix for the proposal distribution. But this might take a long time. The Hessian in principle is more efficient, but only if you are at the mode. What you are currently doing with starting the MCMC far away from the mode is running a very inefficient version of mode_compute=6. Unless you solve the mode-finding/convergence issue, your estimation results will be poor.
What still puzzles me, though, is the small range of feasible points for some of the parameters in the first mode_check plot. You should try to understand what is going on there. Maybe this indicates a mistake or that your prior allows for too wide a parameter range.

The small range of feasible points for some of the parameters in the first mode_check plot and in the sixth mode_check corresponds to growth balance path parameters of oil and technology at the steady state. Perhaps I should not estimate this four parameters but only calibrate them.

There is another thing I do not understand well. I thought that the purpose of the MCMC algorithm was only to compute the integral of the posterior density function. Why should it start at the mode? Is something wrong with my reasoning?

I would try that.

dear professor,
does this mean that i can load the mh_mode.mat as the initial value to run MCMC,until the likelihood does not change too much?

Yes, that is possible. The risk you run is that it will take long and you may get stuck near your local maximum instead of searching for a global one.

Dear all,

I also have a similar error on historical decomposition when running the mod file for the article “Fiscal news and macroeconomic volatility”.

I have tried to estimate and use afterwards the command shock_decomposition(parameter_set=posterior_mode) y; in dynare 4.3.1, 4.4.3 and 4.5.1 and described below the afferent errors.

Can you please help me with some recommendations?

When running with dynare 4.4.3, the following error occurs:

Error using shock_decomposition (line 59)
shock_decomposition: option parameter_set is not specified and posterior mode is not available
Error in BPP_JEDC_2013_baseline (line 1495)
oo_ = shock_decomposition(M_,oo_,options_,var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ;

When running wih dynare 4.3.1, the following error occurs:

Starting Dynare (version 4.3.1).
Starting preprocessing of the model file …
ERROR: BPP_JEDC_2013_baseline.mod:396.22: syntax error, unexpected ‘(’, expecting ‘;’

Error using dynare (line 114)
DYNARE: preprocessing failed

When running with dynare 4.5.1 the following error occurs:

Error using shock_decomposition (line 67)
shock_decomposition: option parameter_set is not specified and posterior mode is not available
Error in BPP_JEDC_2013_baseline (line 1509)
[oo_,M_]= shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

Did you estimate the model yourself? If not, the parameter set should be calibration.

Hi again,
I have tried the option calibration for shock_decomposition function, after stoch_simul function, as described below, but a new error occurs. What do I do wrong?

stoch_simul(irf=30,nocorr,order=1,nofunctions,conditional_variance_decomposition=[4:20]);
shock_decomposition(parameter_set=calibration) y_obs;
plot_shock_decomposition;

Error using makedataset (line 62)
makedataset: datafile option is missing!
Error in dynare_estimation_init (line 538)
[dataset_, dataset_info, newdatainterfaceflag] = makedataset(options_, options_.dsge_var*options_.dsge_varlag, gsa_flag);
Error in evaluate_smoother (line 64)
[dataset_,dataset_info,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] = dynare_estimation_init(var_list, M_.fname, [], M_, options_, oo_, estim_params_,
bayestopt_);
Error in shock_decomposition (line 75)
[oo_, M_, junk1, junk2, Smoothed_Variables_deviation_from_mean] = evaluate_smoother(parameter_set, varlist, M_, oo_, options_, bayestopt_, estim_params_);
Error in BPP_JEDC_2013_baseline (line 1509)
[oo_,M_]= shock_decomposition(M_,oo_,options_,var_list_,bayestopt_,estim_params_);
Error in dynare (line 223)
evalin(‘base’,fname) ;

As the error message says:

makedataset: datafile option is missing!

You need to provide a datafile to shock_decomposition (see the manual):

shock_decomposition(parameter_set=calibration, datafile=mydata) y_obs;

Thanks a lot, it works!
I have one more single question.
If now I want to plot the forecast after the stoch_simul function by using the commands below, no graph is plotted instead and an error is mentioned at row with conditional_forecast. How can I solve it?

Many, many thanks!

ERROR: BPP_JEDC_2013_baselinefct.mod: line 314, col 356: syntax error, unexpected NAME, expecting ‘;’

forecast(periods=4,conf_sig=0.9, graph_format=fig) y;

conditional_forecast(parameter_set=calibration,controlled_varexo=(eps_interestrate,eps_pref,eps_tau_n, eps_tau_k),periods=4,replic=3000) y;
plot_conditional_forecast(periods=4) y;

Please provide me with the file via private message.

Contrary to what is stated in the manual, you must not provide a variable name after the conditional_forecast-command. That means

conditional_forecast(parameter_set=calibration,controlled_varexo=(eps_interestrate,eps_pref,eps_tau_n, eps_tau_k),periods=4,replic=3000) y;

should be

conditional_forecast(parameter_set=calibration,controlled_varexo=(eps_interestrate,eps_pref,eps_tau_n, eps_tau_k),periods=4,replic=3000);