Trouble computing moments

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.

Trouble computing moments

Postby olena7 » Mon Apr 30, 2012 8:37 pm

Hi everyone,
I am having trouble computing empirical moments of a model using second order approximation.
When I use the command
stoch_simul(IRF=0,ORDER=1,periods=500) y, ys, c, cs, invt, rer;
the model produces moments and cross-correlations of these variables.
However, when I switch the command to
stoch_simul(IRF=0,ORDER=2,periods=500) y, ys, c, cs, invt, rer;
computation time increases, and all moments, correlations, etc. are reported as NAN.
Finally, if I use the command
stoch_simul(IRF=0,ORDER=2) y, ys, c, cs, invt, rer;
everything works fine again.
Does anyone know what the issue is? More importantly, I am simulating the model using simult_.m file. Since the file uses policy functions which are computed properly in all of the above three examples, does it even matter (for the purposes of generating simulated data) whether I do or do not include the "periods" option?
By the way, I using version 4.2.4
Thank you!
Olena
olena7
 
Posts: 18
Joined: Wed Mar 25, 2009 8:28 pm

Re: Trouble computing moments

Postby jpfeifer » Tue May 01, 2012 8:26 am

Yes, it matters. At first order, simulations will always be stable if the Blanchard-Kahn conditions are satisfied. Moreover, the theoretical moments (i.e. using periods=0) will also be finite at all orders if the BK-conditions are satisfied. However, when simulating the model at orders>1 it is well known that the simulations may explode. Hence the NaNs. For this reason, pruning has been proposed. If you use
Code: Select all
stoch_simul(order=2,periods=500,pruning)

everything should be fine. The only problem is that pruning for orders >2 has not been implemented yet.
------------
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: Trouble computing moments

Postby olena7 » Tue May 01, 2012 4:46 pm

Thank you, everything works great now.
Is it random luck to have simulations explode or not, or do some particular parameter combinations trigger it?
The reason I am asking, is I am simulating a model that I've been using for years, with sticky wages. Up until now, I've always been doing theoretical 1st and 2nd order moments on the version with and without stickiness. Now that I am doing simulations, I find that shutting down stickiness (setting one of the parameters to zero) results in NaN moments.
I would like to run this model using 3rd order approximation too, and so would need to dig deeper into it to fix whatever issues it has.
Olena
olena7
 
Posts: 18
Joined: Wed Mar 25, 2009 8:28 pm

Re: Trouble computing moments

Postby jpfeifer » Tue May 01, 2012 6:41 pm

It is mostly random luck as it depends on shock draws. Consider a case where all shocks are drawn to be 0. Then there is nothing cause the simulation to explode. However, for some parameters the amplification of a given set of shocks is larger, making explosive behavior in simulations more likely.
------------
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: Trouble computing moments

Postby olena7 » Tue May 01, 2012 7:30 pm

Thank you for your help!
olena7
 
Posts: 18
Joined: Wed Mar 25, 2009 8:28 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 5 guests

cron