Smets/Wouters (2007) in Dynare 4.2.5

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Sun Mar 16, 2014 8:57 pm

Thank you for your answer. I have tried to run in Mathlab the us_model file too, by writing dynare us_model, as suggested, but the result was similar, as described bellow:
*.mod not found.
Error using dynare (line 117)
dynare:: can't open us_model.mod
Can you, please, help me with a suggestion regarding the cause of the occurred error?

Thank you very much!
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Mon Mar 17, 2014 6:21 am

There is no us_model.mod, only a usmodel_shock_decomp. It must be
Code: Select all
dynare usmodel_shock_decomp
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Mon Mar 17, 2014 10:03 pm

Hello!
Thank you very much for the explanation, it works.

Alina,
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Sat Apr 12, 2014 9:21 am

Hello everyone!

I have a question regarding the way to calibrate the parameters in Smets&Wouters (2007) DSGE model.
I have tried to apply the mod file, by using the observable variables from my country's economy. As a result, the initial values of the parameters should be changed.
The error that occurred in Dynare was the one described above.
Can you, please, help me, by telling me how can I choose the initial values of parameters, taking into account the error message from Dynare 4.4.0?

Thanks a lot for your support and have a nice day!


Description of error occurred in Dynare
POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the "mode" is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!
> In dynare_estimation_1 at 711
In dynare_estimation at 84
In eu71 at 504
In dynare at 162
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Mon Apr 14, 2014 8:13 am

It seems you require extended runs of mode_compute=6 or 9 or even an extended combination of the two. But foremost, make sure your data matches the model, i.e. is in the right form for the observation equation including potential demeaning and seasonal adjustment.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Tue Apr 22, 2014 9:08 pm

Hi everyone and thanks a lot for your answer, dear professor.

I have tried to use mode_compute=6 and, distinctly, 9 and the results are significantly better than the previous time, in case of mode_compute=6.
I want to ask you how can I use the mode_compute 6 combined with mode_compute 9? I use Dynare 4.4.0 and I wrote the optimization commands recommended by you (mode_compute=6 and, respectively 9) in the estimation command. I would really appreciate if you would give some help by telling me how can I write the command to combine both of these optimization methods (if possibly).

In addition, I have some question regarding the results of the estimation obtained:
1.regarding the variance decomposition, based on the independent contribution of each particular shock, I have obtained a graph that doesn't seem correct in comparison with the one of the original model of Smets&Wouters (the graph that I hope will be attached Graph 1). In my case, the initial values of the observed variables are very significant in the explanation of the variance. Can you please have a look at it and tell me whether you find this situation is correct, that the variance of the initial value have such a big influence?
[img][url]http://C:\Users\gionita\Desktop\GRAPHIC[/url][/img]
2.regarding the convergence of Markov chain obtained, as resulted from Graph2-with the hope to be attached, there are some problems of convergence. Do you have any suggestion for solving them?
[img][url]http://C:\Users\gionita\Desktop[/url][/img]
3. the last question is about the graphs of the apriori and, respectively, aposteriori distributions of the parameters from the model. As results from Graph3-attached there is a big difference between the graph of the apriori distribution and that of the aposteriori distribution. This situation is not for all the parameters, I have attached you the ones with the higher differences. I am not sure that this is correctly, could this would mean that the observed variables bring additional information to the model?
[img][url]http://C:\Users\gionita\Desktop[/url][/img]

Thanks a lot for your support!
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Thu Apr 24, 2014 10:41 am

Hello, everyone!

Can anyone please help me with an answer to my questions?
I really need to know it.

For a clear understanding it would also help to know how to attach the graphs that I mentioned about.

Thanks a lot!
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Mon May 05, 2014 6:18 pm

Hi,

Thanks a lot for your answer.
I am afraid that the answer was referring to the to the version of Dynare 4.2.5.

The version of Dynare that I am using is 4.4.0.
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Wed May 07, 2014 9:44 am

When you run the mode-finding, Dynare will save the found mode in a mode-file. What you can do then is load this mode with the mode_file option and continue from that point with a different mode-finder.

You can attach graphs in the pdf-format. Just specify the graph_format=(pdf) option.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Thu May 08, 2014 7:06 pm

Hi,
Thanks a lot for your answer.

I have attached bellow the graphs, as mentioned in the previous message:
Graph1- Variance decomposition
Graph 2- Graph of apriori and aposteriori distribution
Graph 3- Graph of the Markov Chain Monte Carlo convergence

The questions related to the attached graphs are:
1.regarding the variance decomposition, based on the independent contribution of each particular shock, I have obtained a graph (the Graph 1) that doesn't seem correct in comparison with the one of the original model of Smets&Wouters. In my case, the initial values of the observed variables are very significant in the explanation of the variance. Can you please have a look at it and tell me whether you find this situation is correct, that the variance of the initial value have such a big influence?
2. regarding the graphs of the apriori and, respectively, aposteriori distributions of the parameters from the model, as resulted from the attached Graph2-there is a big difference between the graph of the apriori distribution and the graph of the aposteriori distribution. This situation is not for all the parameters, I have attached you the ones with the higher differences. I am not sure that this is correctly, could this would mean that the observed variables bring additional information to the model?
3.regarding the convergence of Markov chain obtained, as resulted from Graph3, there are some problems of convergence. Do you have any suggestion for solving them? I have tried to increase the number of MCMC simulations, by using an mh_replic=250.000 (as resulted from the axis of graph 3).

Thanks a lot for all your understanding and support,

Have a nice evening,
Attachments
Graph3.pdf
(9.94 KiB) Downloaded 333 times
Graph2.pdf
(6.41 KiB) Downloaded 249 times
Graph1.pdf
(12.48 KiB) Downloaded 306 times
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Fri May 09, 2014 8:14 am

1. In short samples, this is not uncommon. However, your data (the black line) looks weird.
2. If the prior is updated, this suggests that the data is informative. Note that the shape of your posterior is still ugly. It should by asymptotically normal, suggesting that there are insufficient draws.
3. Again, use more draws. There are more involved methods (e.g. the Chib/Ramamurthy algorith), but they are hard to implement.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Sun May 11, 2014 7:04 am

Professor Jpfeifer,

Firstly, I want to thank your for all the help, I really appreciate all your support.

Regarding the use of both mode_compute-6 and, respectively, mode_compute=9, I have tried to use a combination of both of them, as you indicated.
I haves started with a mode_compute=6 in the estimation function:

estimation(datafile=db, xls_sheet=dbs, xls_range=A1:G56, first_obs=1, presample=4,lik_init=2,prefilter=0,mh_replic=350000, mh_nblocks=2,mh_jscale=0.30, mode_compute=6, smoother, mh_drop=0.5,tex,bayesian_irf);

Afterwards, I have introduced in the mode_compute=9 and the mode_file option in the estimation function, keeping the same name of the mode file:

estimation(datafile=db, xls_sheet=dbs,xls_range=A1:G56,first_obs=1, presample=4,lik_init=2,prefilter=0,mh_replic=350000, mh_nblocks=2,mh_jscale=0.30, mode_compute=9, mode_file=db_mode, mh_drop=0.5,tex,bayesian_irf);

The error message that occurred is described above. Do you have any suggestion for solve this error? Or maybe, there is something wrong in the way I introduce the mode_file option?

Many thanks!

The Output was the following:

Initial value of the log posterior (or likelihood): -589.8629
n=36: (7,14)-CMA-ES(w=[36 24 16 11 7 4 1]%, mu_eff=4.3) on function dsge_likelihood
Iterat, #Fevals: Function Value (median,worst) |Axis Ratio|idx:Min SD idx:Max SD
1 , 15 : 1.0000000000000e+08 +(1e-08,4e-08) | 1.03e+00 | 28:9.3e-05 12:9.4e-05
#Fevals: f(returned x) | bestever.f | stopflag
16: 1.00000000000e+08 | 5.89862895442e+02 | equalfunvals
mean solution: +3.0e+00 +5.6e-01 +2.9e+00 +6.2e-01 +2.3e-02 +1.6e-02 +3.0e+00 +9.2e-01 +9.0e-01 +9.9e-01 +9.7e-01 +8.7e-01 +7.1e-01 +4.4e-01 +6.7e-01 +6.8e-02 +6.9e+00 +2.8e-01 +4.4e-01 +3.4e-01 +5.6e+00 +9.5e-01 +6.0e-01 +6.6e-01 +7.9e-01 +1.7e+00 +1.0e+00 +9.8e-01 +1.7e-01 +9.6e-04 +7.0e-01 +5.1e-01 +5.2e+00 +5.1e-01 +1.5e+00 +3.7e-01
std deviation: 9.3e-05 9.4e-05 9.3e-05 9.3e-05 9.3e-05 9.3e-05 9.4e-05 9.4e-05 9.3e-05 9.3e-05 9.3e-05 9.4e-05 9.3e-05 9.3e-05 9.3e-05 9.4e-05 9.3e-05 9.4e-05 9.3e-05 9.4e-05 9.3e-05 9.4e-05 9.3e-05 9.3e-05 9.3e-05 9.3e-05 9.4e-05 9.3e-05 9.4e-05 9.3e-05 9.4e-05 9.4e-05 9.4e-05 9.3e-05 9.4e-05 9.4e-05
use plotcmaesdat.m for plotting the output at any time (option LogModulo must not be zero)

Objective function at mode: 100000000.000000

POSTERIOR KERNEL OPTIMIZATION PROBLEM!
(minus) the hessian matrix at the "mode" is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!
> In dynare_estimation_1 at 711
In dynare_estimation at 84
In db at 497
In dynare at 162
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.574083e-16.
> In dynare_estimation_1 at 726
In dynare_estimation at 84
In db at 497
In dynare at 162

Log data density [Laplace approximation] is -714.040281.

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 799)
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 84)
dynare_estimation_1(var_list,dname);
Error in azi2pol3_pol2final (line 497)
dynare_estimation(var_list_);
Error in dynare (line 162)
evalin('base',fname) ;
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Mon May 12, 2014 3:13 pm

That is strange and should not happen. Could you try again with the same mode-file? If the problem persists, please send me the mod-file, the data, and the mode-file.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby georgiana_alina » Tue May 13, 2014 7:28 am

Thanks a lot, Mr.Professor,

I have tried to run again the same algorithm and the error occurred.
I have attached you the mod file-SmetsWouters, where in the estimation function I have used the optimization function: mode_compute=6, without the mode_file function.
As a result, it was generated the mode file: SmetsWouters.mode, that I have tried to attached. I kindly ask you to tell me how to attach the mode file (as the message received when trying to attach it was that the extension mat is not allowed).
For the seven observed variables, please find attached the Excel document (MATA-incercare) containing the seven quarterly time series for the period 2000q1:2013q4.
The same error occurred when I have tried to introduce the mode_file name and the mode_compute=9 function, as described in the Word document-Error-mode_compute=9.
Attachments
Error-mode_compute=9.doc
(208.5 KiB) Downloaded 262 times
MATA_incercare.xls
(30 KiB) Downloaded 257 times
SmetsWouters.mod
(6.52 KiB) Downloaded 234 times
georgiana_alina
 
Posts: 26
Joined: Sat Mar 08, 2014 5:39 pm

Re: Smets/Wouters (2007) in Dynare 4.2.5

Postby jpfeifer » Tue May 13, 2014 9:03 am

Just put everything into a zip-file and upload it. This allows to attach mat-files.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

PreviousNext

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 7 guests