Errors in Hessian function (mode_compute=4)

Hi everyone,

I’m currently working on replicating Figure 4 from the paper by Francesco Bianchi and Leonardo Melosi, “Fiscal Theory of Persistent Inflation”. I’ve attached my mod file, MATLAB script, and datasets.

fig4.mod (37.2 KB)
parameters.mat (675 Bytes)
usdata_S1.xlsx (40.3 KB)

However, I’ve encountered the following error message:

Error using * 
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of
rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise
multiplication.

Error in hessian (line 12)
h1=max(abs(x),sqrt(gstep_)*ones(n,1))*eps^(1/6);

Error in dynare_estimation_1 (line 267)
    hh = hessian(objective_function, xparam1, options_.gstep, dataset_, dataset_info, options_, M_, estim_params_, bayestopt_, bounds,oo_.dr,oo_.steady_state,oo_.exo_steady_state,oo_.exo_det_steady_state);

Error in dynare_estimation (line 105)
    dynare_estimation_1(var_list,dname);

Error in fig4.driver (line 2126)
oo_recursive_=dynare_estimation(var_list_);

Error in dynare (line 310)
    evalin('base',[fname '.driver']);

Error in generate_fig4 (line 12)
dynare fig4

I’m unsure how to resolve this issue, and any guidance would be greatly appreciated.

Additionally, I would like some input on refining the estimation command in the mod file. Here is my current command:

estimation(mh_jscale=0.375,
    mode_compute=4,
    datafile=usdata_S1,
    mh_nblocks=1,
    mode_check,
    diffuse_filter,
    mh_replic=1000, 
    mh_drop=0.25,
    plot_priors=0,
    bayesian_irf, prior_trunc=0);

The goal is to implement MCMC estimation using Chris Sim’s optimization function, csminwel, to search for the mode in line with the authors’ replication files. However, I’m unsure which additional arguments might be required to closely match the results obtained by the authors.

Lastly, in the replication folder provided by the authors, the Phillips curve component of the model block includes cost-push shocks for both the shadow economy and the main economy. However, to generate similar IRFs to those in Figure 4 of the paper, I found that I need to remove the cost-push shocks in the shadow economy from my Dynare code and ensure they only affect the main economy.

To see the difference, you can add unkpchat to the Phillips curve for the shadow economy in the mod file below (you can ran it with the parameter.mat file attached above). When you do so, the IRFs for this shock diverge significantly from those in the paper. However, if you simply run the mod file as provided below (without adding unkpchat), the resulting IRFs exhibit very similar patterns to those in the paper, albeit with some differences in magnitude.
fig4_without_estimation.mod (34.9 KB)

I would greatly appreciate any suggestions or advice.

Link for the replication folders for Bianchi et al (2021): https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/VGBS6F

This is a tough nut to crack.

  1. I cannot replicate your error in Dynare 6.
  2. mode_compute=5 tends to perform better. That being said, the mode_check plots always look poor and suggest corner solutions. There may be something else going wrong with your file or data treatment.
  3. Resolving differences between published results and your own codes requires a step by step comparison. There are many things that can go wrong. Ideally, you need to be able to generate identical results. Anything that is slightly off in shape or size may suggest that you or the original authors did something wrong.
1 Like

Thanks for the answers, Professor.

I will look into them.

I have one more question regarding the observation equations in my model.

My model is log-linearized, and the authors’ data mostly consists of growth rates. Therefore, I’ve defined the observation equations for the variables as follows:

[name='Observable output growth']
yobs = yhat - yhat(-1) + ua;

[name='Observable consumption growth']
cobs = chat - chat(-1) + ua;

[name='Observable investment growth']
iobs = ihat - ihat(-1) + ua;

[name='Observable real wage growth']
wobs = what - what(-1) + ua;

[name='Observable transfers growth']
zobs = zhat - zhat(-1) + ua;

[name='Government Spending Growth']
gobs = ghat - ghat(-1) + ua;

Here, ua = uahat + gamm100 is added to incorporate the steady-state technology growth found in the data.

However, for the debt-to-GDP ratio, inflation, and nominal interest rate, the authors use the levels of these variables. I define the observation equations like below:

[name='Inflation']
piobs = pihat + log(pi_steady);

[name='Interest rate']
rnobs = rnhat + log(rn_steady);

[name='Debt to GDP ratio']
sbobs = sbhat + log(sb_steady);

Is this correct?

Thank you for your help.

I am not sure about the log in e.g.

On the left in the data you have something like 70 for a 70 percent debt-to-GDP ratio. But on the right, you have the log level of debt to GDP. That seems inconsistent.