Estimation of NK_baseline model

I’ve been trying to estimate a model using the NK_baseline mod file found in Dynare examples folder. So far I’ve made progress and thought opening up a new thread exclusively dedicated to this mod file queries will help future users.

This link will refer to my previous queries on the model estimation.

Question: In the mod file the way the shocks are defined is different to FV(2010). For example;

In FV(2010) the shock processes are defined as;

However in the mod file standard deviation terms (i.e. sigmas) and lag terms (in 2nd and 3rd equations) are not included.

[name='Preference Shock']

[name='Labor disutility Shock']

[name='Investment specific technology']

[name='Neutral technology']

[name='Taylor Rule']
  1. I would like to know what is the reason for this set up?
  2. Does it has any consequence on the estimation result?
  1. The standard deviations are in the shocks block, not in the equations. But that setup is equivalent.
  2. You need deal with the trend that renders the mu non-stationary. We do that in the mod-file by defining the growth rate of mu, i.e.
    \tilde \mu_t=\frac{\mu_t}{\mu_{t-1}}
    and entering
    log \tilde \mu_t=\Lambda+z_t

Thank you professor.

Is it possible to define sigma terms as model local variables like below;

#sigma_A = log(sigma_A_trans);
#sigma_d = log(sigma_d_trans);
#sigma_phi = log(sigma_phi_trans);
#sigma_mu = log(sigma_mu_trans);
#sigma_m = log(sigma_m_trans);

So that I can estimate them as per below?;

sigma_A_trans,	inv_gamma_pdf,  0.1,     	2; 	
sigma_d_trans,	inv_gamma_pdf,  0.1,     	2;  	
sigma_phi_trans,inv_gamma_pdf,  0.1,     	2;  
sigma_mu_trans,	inv_gamma_pdf,  0.1,     	2;  	
sigma_m_trans,	inv_gamma_pdf,  0.1,     	2;  

No, that won’t work. You should change the file to look like this:

Thank you professor.

I’m planning on including measurement error terms in the observation equations for wage growth, gdp growth, and inflation using Dynare capabilities. Can you give me a guidance on how to go about determining the shapes of the distribution and standard deviations for these error terms?

I would suggest to have a look at other papers using measurement error. One option is to use a uniform distribution with an upper bound equal to e.g. one quarter of the variance.

Thank you professor.

I’ve noticed estimation works for a certain portion of my data set but for the rest I get “error: chol: input matrix must be positive definite”. I’m using mode compute = 4. Could you tell me what causes this error?

You’re most likely starting to sample the posterior distribution from a flat area. See this explanation of the algorithm behind mode_compute=6 and this post: Error: chol: input matrix must be positive definite - #2 by jpfeifer

Just to be clear, once I’ve have my mod file modified as per above, can I specify sigma terms directly as below in the estimation block?;

sigma_d, inv_gamma_pdf, 0.1, 2;
sigma_phi, inv_gamma_pdf, 0.1, 2;
sigma_A, inv_gamma_pdf, 0.1, 2;
sigma_m, inv_gamma_pdf, 0.01, 2;
sigma_mu, inv_gamma_pdf, 0.01, 2;

Thanks agutieda.

Yes. Can you provide the current version to check?


Dataset.csv (4.4 KB)
NK_baseline.mod (10.4 KB)
NK_baseline_steadystate.m (4.6 KB)

Yes, that looks correct.

Thank you for checking the code professor.

Is there a reason to keep the shocks block in an estimation context?

In your case, it calibrates the unit shocks. If you delete it, the shocks will drop out. More generally, it is advised to fully calibrate the model before estimating it.

Thank you professor.

Could you explain what below warning mean and should I be concerned about that?

warning: gaminv: calculation failed to converge for some values.
warning: called from
    gaminv at line 82 column 7
    prior_bounds at line 92 column 30
    dynare_estimation_init at line 341 column 16
    dynare_estimation_1 at line 109 column 93
    dynare_estimation at line 118 column 5
    driver at line 533 column 14
    dynare at line 278 column 5

That is a warning message by Matlab that the Inverse CDF for the gamma distribution could not be computed numerically. Try using prior_trunc=0.

Thank you.

Is it possible to generate autocorrelation plots of the sigmas when they are directly estimated?

What type of autocorrelation plots?

To inspect MCMC chains of the estimated parameters using mh_autocorrelation_function