Page 1 of 1

Simulated trajectory graphs

PostPosted: Sun Aug 23, 2015 11:44 pm
by hoangkhieu
Hello,
I am currently working on a medium size DSGE model. When I use the rplot command I got trajectory graphs for endogenous variables, but I am not quite sure how to interpret the graphs. Can we compare the graphs with actual data to evaluate the performance of the model?
I also tried plotting policy functions with command
state_range=0.1:0.1:10;
state_name='k';
plot_var_name='c';
plot_dummy='1';
plot_policy_fun(state_name,state_range,plot_var_name,plot_dummy);
but got the error message
??? Error using ==> minus
Matrix dimensions must agree.
Error in ==> simult_ at 52
y_(:,1) = y_(:,1)-dr.ys;
Error in ==> plot_policy_fun at 84
temp=simult_(y0_temp,oo_.dr,shock_mat,options_.order);
Error in ==> simul at 279
plot_policy_fun(state_name,state_range,plot_var_name,plot_dummy);
Again, could you please show me how to interpret the policy function graphs?
I am looking forward to your reply.
Thank you
Hoang

Re: Simulated trajectory graphs

PostPosted: Mon Aug 24, 2015 9:58 am
by jpfeifer
There is no real interpretation. They show a simulated trajectory following an abitrary sequence of shocks. There is no relation to actual data. What people typically do is compare the second moments of this artificial economy with stochastic shocks with the one from the data. If the model is close to the data, it should give similar moments.

Regarding the plot_policy_fun: use the updated version at https://github.com/JohannesPfeifer/DSGE_mod/tree/master/Caldara_et_al_2012 with
Code: Select all
state_range=0.1:0.1:10;
state_name='k';
plot_var_name='c';
plot_policy_fun(state_name,state_range,plot_var_name);

Re: Simulated trajectory graphs

PostPosted: Mon Aug 24, 2015 10:29 am
by hoangkhieu
Thanks. I used the updated file and provided code but still got this message
??? Input argument "plot_dummy" is undefined.

Error in ==> plot_policy_fun at 89
if plot_dummy

Error in ==> simul at 278
plot_policy_fun(state_name,state_range,plot_var_name);

Error in ==> dynare at 180
evalin('base',fname) ;

Could you please figure this out? Thank you
Hoang

Re: Simulated trajectory graphs

PostPosted: Tue Aug 25, 2015 10:14 am
by jpfeifer
Did you adjust the call to the function as described? It should only take three input arguments.

Re: Simulated trajectory graphs

PostPosted: Tue Aug 25, 2015 10:41 am
by hoangkhieu
yes I did. But then I got the error message.

Re: Simulated trajectory graphs

PostPosted: Wed Aug 26, 2015 3:20 pm
by jpfeifer
Then you must have done something wrong in replacing the function. Line 43 clearly sets plot_dummy when you have only 3 input arguments. Use
Code: Select all
which plot_policy_fun

to see which file is accessed and then check whether it is the updated one.

Re: Simulated trajectory graphs

PostPosted: Fri Aug 28, 2015 12:01 am
by hoangkhieu
I fixed the error. A further question: how to plot the policy function of one endogenous variable with all the other states? Thanks!

Re: Simulated trajectory graphs

PostPosted: Fri Aug 28, 2015 7:51 am
by jpfeifer
What do you mean?

Re: Simulated trajectory graphs

PostPosted: Fri Aug 28, 2015 9:30 am
by hoangkhieu
sorry for the confusion. For example, c is a function of state variables k and a. we plotted c with k, and now I wonder how to plot c with k and a. does it make more sense now?

Re: Simulated trajectory graphs

PostPosted: Sun Aug 30, 2015 2:28 pm
by jpfeifer
That is more complicated. You would have to follow the logic of the plot_policy_fun.m to generate a three dimensional graph.

Re: Simulated trajectory graphs

PostPosted: Mon Aug 31, 2015 10:49 am
by hoangkhieu
Thank you. I appreciate your help.