two shock in two time in a loop

Archive of Gamsworld Google Group
Post Reply
atabesh
User
User
Posts: 4
Joined: 5 months ago

two shock in two time in a loop

Post by atabesh » 1 month ago

hello my friends

I work in a recursive dynamic CGE model.
my set is
t time /1*20 /;
I want to have one shock from t=1 to t=4 (for example increase tax) and I want to have another shock from t=5 to t=20 (for example increase productivity). But I do not know how I can write a loop for this purpose. please help me

User avatar
Renger
Posts: 494
Joined: 3 years ago

Re: two shock in two time in a loop

Post by Renger » 1 month ago

Hi

You can loop over the whole horizon and change the parameters for the shocks. Here some example code:

Code: Select all

set t Periods /1*20/;

set sc /BAU, SHOCK/;

parameter parshock(sc,t)  Shock some parameters

parshock(sc,t) = 0;
parshock("SHOCK",t)$(t.val < 5) = 2;
parshock("SHOCK",t)$(t.val > 4) = 3;

loop(sc,
   loop(t, 
      myparam = parshcok(sc,t);
      solve model...
      change capital using investments
      );
 );
I usually add for each scenario a set like the following:

Code: Select all

set sc /BAU, SHOCK/,
     BAU(sc)  /BAU/,
     SHOCK(sc)  /SHOCK/;
Now I can run the loop for a specific scenario without having to run all the other scenarios.

Code: Select all

loop(sc$(shock(sc),
    .... 
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

atabesh
User
User
Posts: 4
Joined: 5 months ago

Re: two shock in two time in a loop

Post by atabesh » 3 days ago

Thank you very much

Post Reply