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

## two shock in two time in a loop Topic is solved

### Re: two shock in two time in a loop

Hi

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

I usually add for each scenario a set like the following:

Now I can run the loop for a specific scenario without having to run all the other scenarios.

Cheers

Renger

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
);
);
```

Code: Select all

```
set sc /BAU, SHOCK/,
BAU(sc) /BAU/,
SHOCK(sc) /SHOCK/;
```

Code: Select all

```
loop(sc$(shock(sc),
....
```

Renger

____________________________________

Enjoy modeling even more: Read my blog on modeling at The lazy economist

Enjoy modeling even more: Read my blog on modeling at The lazy economist

### Re: two shock in two time in a loop

Thank you very much

### Re: two shock in two time in a loop

I did exactly that, but when I increase the time, for example, from 20 to 30 years, my answer is different.

For example for t /1*20/

I increase the tax rate (t.val<5) then the average GDP decrease 0.5 % from the first year to fifth year

when t is /1*30/

and I increase the tax rate (t.val<5) then the average GDP decrease by 0.8 % from the first year to the fifth year.

I think it is wrong.

For example for t /1*20/

I increase the tax rate (t.val<5) then the average GDP decrease 0.5 % from the first year to fifth year

when t is /1*30/

and I increase the tax rate (t.val<5) then the average GDP decrease by 0.8 % from the first year to the fifth year.

I think it is wrong.