help looping over two parameters

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: help looping over two parameters

Postby jpfeifer » Fri Apr 24, 2015 8:30 am

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.
------------
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: help looping over two parameters

Postby pito » Fri Apr 24, 2015 8:55 am

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
pito
 
Posts: 16
Joined: Mon Feb 21, 2011 6:33 pm

Re: help looping over two parameters

Postby jpfeifer » Fri Apr 24, 2015 9:26 am

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.
------------
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: help looping over two parameters

Postby pito » Fri Apr 24, 2015 10:08 am

I got it now, thank you so much! Such a great opportunity to clarify things on this forum. Success in your further work!
pito
 
Posts: 16
Joined: Mon Feb 21, 2011 6:33 pm

Re: help looping over two parameters

Postby pito » Tue Jun 30, 2015 3:36 pm

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
pito
 
Posts: 16
Joined: Mon Feb 21, 2011 6:33 pm

Re: help looping over two parameters

Postby jpfeifer » Mon Jul 06, 2015 5:17 am

Dear Aliya,

I would need to see the codes for this.
------------
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

Previous

Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests