Uribe & Schmitt-Grohe

According to the identification command, you cannot estimate all these parameters on just the output series.

So, I have to choose which one I want to estimate? What is the rule for the number of parameters that I could estimate? I wanna know…
Thanks!

There is no rule. You need at least as many independent first and second moments of the observables as parameters you want to estimate. With the identification; you can check whether this is the case.

Pfeifer,

The hint sounds great. I put the “identification;” at the end of the code. At least, the R2014b give me the results like R2014a, but at the end, in command windows, there are:
==== Identification analysis ====

Testing prior mean
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 2
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 3
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 4
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 5
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 6
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 7
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 8
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 9
The number of moments with non-zero derivative is smaller than the number of parameters
Try increasing ar = 10
The number of moments with non-zero derivative is smaller than the number of parameters
up to 10 lags: check your model
Either further increase ar or reduce the list of estimated parameters
Error using identification_analysis (line 102)
IDETooManyParams
Error in dynare_identification (line 280)
[idehess_point, idemoments_point, idemodel_point, idelre_point, derivatives_info_point,
info] = …
Error in uribe_chapter4_peru_bayes2 (line 219)
dynare_identification(options_ident);
Error in dynare (line 180)
evalin(‘base’,fname) ;

What does it mean? Really that I have an identification problem? I have to insert more information to bayesian inference or ask for less estimated parameters?
Thanks a lot!

That is what I told you. Given your one observable there is not enough information in the data to estimate all parameters. If you drop more parameters or add more observables, at some point the error message will vanish.

Great. Now, I insert one more serie, the consumption. But, I have only one shock.
Error using initial_estimation_checks (line 34)
initial_estimation_checks:: Estimation can’t take place because there are less declared
shocks than observed variables!
Error in initial_estimation_checks (line 34)
error(‘initial_estimation_checks:: Estimation can’‘t take place because there are less
declared shocks than observed variables!’])
Error in dynare_estimation_1 (line 179)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in uribe_chapter4_peru_bayes2 (line 226)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ;

I think the best is drop variables from bayesian estimation.

You could add measurement error.

Nice, I am seeing in your Guide, section 7, thanks.
After I understand it, I will report the results.

Pfeifer,
First of all, I would like to thank you, because the errors were vanished by the new code, when I put the measurement errors and the “identification;” command. The results are great and all reasonable. Your guide has helped me a lot.

But, I am curious when I drop the identification command out, the errors return. I have dropped them out because the IR-functions are not showed in the first case (identification command and measurement erros)

Error using chol
Matrix must be positive definite.
Error in metropolis_hastings_initialization (line 68)
d = chol(vv);
Error in random_walk_metropolis_hastings (line 62)
ix2, ilogpo2, ModelName, MetropolisFolder, fblck, fline, npar, nblck, nruns, NewFile,
MAX_nruns, d ] = …
Error in dynare_estimation_1 (line 782)
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in uribe_chapter4_peru_bayes2 (line 230)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ;

Do you could explain me why?
Thanks!
perua.xls (37 KB)
uribe_chapter4_peru_bayes2.mod (2.15 KB)

This partly has to with your steady state. For many draws in the region of the highest posterior, it cannot be computed. Try providing an analytical steady state.

Pfeiffer,

I am trying to incorporate your suggestions. The results are incredible fast now, when I put the analytical steady state.
I really would like, if you want and have some time, that you run my model and see if the results seems to you reasonable.

Thanks a lot,
Raphael
perua.xls (37 KB)
uribe_chapter4_peru_bayes3.mod (2.53 KB)

There are a whole bunch of issues.

  1. You are neglecting parameter dependence. Your calibration only once updates the other parameters depending on the estimated one. That’s why you should use model-local variables (the ones with the pound operator) or a steady state file. See Remark 4 (Parameter dependence and the use of model-local variables) in Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf. I corrected this in the attached file.
  2. Your investment FOC looks wrong. Why is there an I when only K is inside the adjustment costs in the budget constraint? You need to check/fix this. I presume you try to replicate columbia.edu/~mu2166/closing/edeir_model.m
  3. Your priors are too narrow for some parameters. I widened them in the attached file.
  4. You should better use a different mode-finder. I use 9 in the attached file
  5. How did you detrend your data?
  6. How did you calibrate the measurement error?
    uribe_chapter4_peru_bayes_corrected.mod (2.67 KB)

[quote=“jpfeifer”]There are a whole bunch of issues.

  1. You are neglecting parameter dependence. Your calibration only once updates the other parameters depending on the estimated one. That’s why you should use model-local variables (the ones with the pound operator) or a steady state file. See Remark 4 (Parameter dependence and the use of model-local variables) in [Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”] (Pfeifer_2013_Observation_Equations.pdf - Google Drive). I corrected this in the attached file.
  2. Your investment FOC looks wrong. Why is there an I when only K is inside the adjustment costs in the budget constraint? You need to check/fix this. I presume you try to replicate columbia.edu/~mu2166/closing/edeir_model.m
  3. Your priors are too narrow for some parameters. I widened them in the attached file.
  4. You should better use a different mode-finder. I use 9 in the attached file
  5. How did you detrend your data?
  6. How did you calibrate the measurement error?[/quote]

Pfeifer,

You are correct about these issues. I would like to add some comments:

  1. Sure, I really neglected it. I am reading the remark and I will adjust the code to consider it;
  2. I am reading the FOC and I have to remember what kind of adaptation I had done. I will consider your note about it. Actually, I am trying to replicate some of Uribe’s models, from his manuscripts (columbia.edu/~mu2166/book/oem.pdf), this one is chapter4;
  3. Yes, I put too narrow because I was afraid my computer would take a lot of time to process it, but the case is just the opposite, because too narrow is not solving the problem;
  4. The mode-finder I hadn’t this information. I saw in the Dynare Reference Manual, page 51 (item 13), that this option 9 is not listed. I would like to know about it, if you have references;
  5. I had detrended them by quadratic time. First, I applied logarithm to them and so I have applied quadratic time detrending. I have listened about other methods, but I chose this for all series used;
  6. That is a important question. I do not know to calibrate the measurement error, so, I used it form the book. If you have any reference about, I will be very grateful to know.

I think that’s all. I will take some time to see these points (1, 2, mainly). However, I am following your comments during the job.
Thanks again for help.
Raphael

  1. That is the model where I linked to the codes. There you can look up the correct FOCs.
  2. You can find out more about CMAES in Martin Møller Andreasen (2009): How to Maximize the Likelihood Function for a DSGE Model, DOI:10.1007/s10614-009-9182-6
  3. There is no guidance, but if you are not sure, estimate the standard deviation.

Pfeifer,

I have fixed the investment FOC.

exp(lambda)*(1+phi*(exp(k)-exp(k(-1)))) = beta*exp(lambda(+1))*(alpha*exp(y(+1))/exp(k)+1-delta+phi*(exp(k(+1))-exp(k)));

But, the errors returned.

*Error using chol
Matrix must be positive definite.
Error in metropolis_hastings_initialization (line 68)
d = chol(vv);
Error in random_walk_metropolis_hastings (line 62)
ix2, ilogpo2, ModelName, MetropolisFolder, fblck, fline, npar, nblck, nruns, NewFile,
MAX_nruns, d ] = …
Error in dynare_estimation_1 (line 782)
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);
Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);
Error in uribe_chapter4_peru_bayes_corrected (line 232)
dynare_estimation(var_list_);
Error in dynare (line 180)
evalin(‘base’,fname) ; *

Do you know what possible it will be wrong? It’s again the chol error. Because before, it was an identification problem, but and now?
perua.xls (37 KB)
uribe_chapter4_peru_bayes_corrected.mod (2.67 KB)

It’s funny because when I just write the FOC investment like Uribe did in MatLab code, for example:

e6 = -la* (1+PHI*(kp-k)) + BETTA * lap * (1-DELTA + ALFA * ap * (kp/hp)^(ALFA-1) + PHI * (kfup-kp));
like,

exp(lambda)*(1+phi*(exp(k)-exp(k(-1)))) = beta*exp(lambda(+1))*(alpha*a(+1)*(exp(k)/exp(h(+1)))^(alpha-1)+1-delta+phi*(exp(k(+1))-exp(k)));

I have errors too.
I think write alphaa(+1)(exp(k)/exp(h(+1)))^(alpha-1) or alpha*exp(y(+1))/exp(k), there is not differences, but there is!

Other thing is Dynare stops in Figure 15 - Mode Check plots, and the graphics for phi and omega there are discontinuity points. I do not know whether this can mean the error is in there, but it was an observation of mime.

Well, I still desperate about my model. A little shocked because always the same has showed a mistake.

When using

exp(lambda)*(1+phi*(exp(k)-exp(k(-1)))) = beta*exp(lambda(+1))*(alpha*a(+1)*(exp(k)/exp(h(+1)))^(alpha-1)+1-delta+phi*(exp(k(+1))-exp(k)));

you forgot that there must be an exp() around the a(+1). When you put it there, it is identical.

Regarding the error message you get, you need to play around with different mode-finders. In the current iteration of your file, it works with mode_compute=6 (the default). Regarding the red points, see the description of mode_check in Pfeifer (2014): An Introduction to Graphs in Dynare at sites.google.com/site/pfeiferecon/dynare

Dear Pfeifer,

I think I got it. This is the dynare’s code for Chapter 4 of Uribe,

Sorry for later, but I am waiting for running the code on other computer to verify if it was correct.
Any comments would be appreciate.

Thanks for help!
perua.xls (37 KB)
uribe_chapter4_peru_bayes_corrected.mod (2.69 KB)