Page 2 of 2
Re: help looping over two parameters
Posted:
Fri Apr 24, 2015 8:30 am
by jpfeifer
Your X is
X =
0 0.5000 1.0000 0 0.5000 1.0000 0 0.5000 1.0000
0 0 0 0.5000 0.5000 0.5000 1.0000 1.0000 1.0000
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
Using X(1,i) and X(2,i) with i=1 uses phiinf=0, phier=0. Maybe you are confusing rows and columns.
Re: help looping over two parameters
Posted:
Fri Apr 24, 2015 8:55 am
by pito
I am not confusing rows and columns. My matrix X is this up to 3rd row after loop is made, I am not showing other rows, sorry for bad formatting. But you see the cell (3,2) which is -36626165419.0826 under phiinf=0.5, phier=0.
0 0.5 1 0 0.5 1 0 0.5 1
0 0 0 0.5 0.5 0.5 1 1 1
-430628478299.734 -36626165419.0826 -5438549262240.73 -1.75290881843188e+15 -916705959054391 -2.86385007585544e+15 -716948367993135 -654920144499515 -2.23270232124789e+15
Now let's change my looping range as if my first iteration starts from that phiinf=0.5, phier=0. The three rows of matrix X will look like this then, showing that the correct number should be -229862535943.196.
0.5 0.75 1 0.5 0.75 1 0.5 0.75 1
0 0 0 0.5 0.5 0.5 1 1 1
-229862535943.196 -181712327817.607 -5438549262240.73 -3.82907414291894e+15 -1.48502741146982e+15 -2.86385007585544e+15 -1.10183224485801e+15 -829356745047734 -2.23270232124789e+15
Re: help looping over two parameters
Posted:
Fri Apr 24, 2015 9:26 am
by jpfeifer
You rely on stochastic simulations. Without fixing a seed with
- Code: Select all
set_dynare_seed('default')
before calling stoch_simul, you will be using different random numbers. The reason is that when calling Dynare, a seed is set. When only calling stoch_simul, this is not the case. You need to do this manually.
Re: help looping over two parameters
Posted:
Fri Apr 24, 2015 10:08 am
by pito
I got it now, thank you so much! Such a great opportunity to clarify things on this forum. Success in your further work!
Re: help looping over two parameters
Posted:
Tue Jun 30, 2015 3:36 pm
by pito
Hi everyone,
Let me continue on this, but in a perfect foresight model. I remember that set_dynare_seed command, as you've suggested earlier, helped me to fix my issue in a stochastic model.
Now I am looping over one parameter which affects my exogenous shocks path that I am feeding into a perfect foresight model. I observe that shocks path is replaced properly, yet the results of simulation are not correct after the second iteration of a parameter, if I check just the way I described in my previous post here. Obviously, set_dynare_seed is not a solution as before. What should I control for to deal with basically the same problem, but in a perfect foresight framework?
Would appreciate any helpful reply.
Thank you,
Aliya
Re: help looping over two parameters
Posted:
Mon Jul 06, 2015 5:17 am
by jpfeifer
Dear Aliya,
I would need to see the codes for this.