Page 1 of 1

Trouble computing moments

PostPosted: Mon Apr 30, 2012 8:37 pm
by olena7
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

Re: Trouble computing moments

PostPosted: Tue May 01, 2012 8:26 am
by jpfeifer
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.

Re: Trouble computing moments

PostPosted: Tue May 01, 2012 4:46 pm
by olena7
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

Re: Trouble computing moments

PostPosted: Tue May 01, 2012 6:41 pm
by jpfeifer
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.

Re: Trouble computing moments

PostPosted: Tue May 01, 2012 7:30 pm
by olena7
Thank you for your help!