Unexpected shocks in Perfect foresight with “Perfect foresight with expectation errors”

Hello,

I’m trying to run an exercise with unexpected shocks. The shock is “eb”. I want to compare two scenarios. Scenario 1 where agents know in advance that the shock will take the value -0.01 from period 11 to 15 and then -0.075.

Then scenario 2, they think at period 1 that the shock will always be -0.01 and then they learn at period 15 that it will be -0.075 from now on. Attached here the lines for both scenarios. My problem is that when I compare the plots, I lose the first 10 or so observations in scenario 2, the variables don’t start from SS as in scenario 1. I’m using the constant_simulation_length option.

SCENARIO 1

steady;

shocks(learnt_in=1);
var eb;
periods 11:15 16:750;
values -0.01 -0.075;
end;

perfect_foresight_with_expectation_errors_setup(periods=750);

perfect_foresight_with_expectation_errors_solver(constant_simulation_length);

SCENARIO 2

steady;

shocks(learnt_in=1);
var eb;
periods 11:750 ;
values -0.01;
end;

shocks(learnt_in=15);
var eb;
periods 16:750;
values -0.075;
end;

perfect_foresight_with_expectation_errors_setup(periods=750);

perfect_foresight_with_expectation_errors_solver(constant_simulation_length);

Thanks for the help

Can you provide me with the full codes?

Sure, here are the files.

To give you some context: in period 1, a negative TFP shock hit the economy and the CB engages in QE. After that unwinding starts: from 11 on. In the first scenatio the QT strategy is announced while in the second one, agents learn at a later period (15) that a more aggresive unwinding will take place. The thing is that in the second one, the economy does not start at the SS, I lose some initial periods.
Forum.zip (1.5 MB)

Are you sure your setup is correct? I don’t see proper initval and endval statements.

Hi Johannes,

When I text the first scenario, to compute the second one, I activate the endval one for bcb=0.2.

The initval is always the SS called at the beginning.

I even simplified the setting: Scenario 2 is

shocks(learnt_in=1);
var eb;
periods 1:10 11:750;
values 0.5 -0.00001;
end;

shocks(learnt_in=15);
var eb;
periods 16:750;
values -0.075;
end;

while the original one is

shocks(learnt_in=1);
var eb;
periods 1:10 11:15 16:750;
values 0.5 -0.000001 -0.075;
end;

The first one works as expected. But for the second one, It “kills” the first ten periods or similar, no variable start at SS. Could there be a bug in the learnt_at command?

Thanks

I got it now. It exactly kill the first 15 periods, that is when shocks(learnt_in=15) period is. To make the sequences comparable, I am interested in the changes along all the path. Is there a way to compare both scenarios?

Sorry, but I am not sure I can reproduce the issue. If you plot eb, e.g. using
rplot eb;
the path looks like expected. Nothing is cut off.

Hi Johannes,

Thanks for the answer. But I still have the same issue. I check the bcb (the shockes variable) series and the first entry is lik 15 periods after the SS. (In scenario 2, in 1 it works well. The code after the end of the model is:

end;

initval;
eb=0;
end;

steady;

shocks(learnt_in=1);
var eA;
periods 1:10;
values -2.5 ;
end;

shocks(learnt_in=1);
var eb;
periods 1:10 11:750 ;
values 0.5 -0.00001;
end;

shocks(learnt_in=15);
var eb;
periods 16:750;
values -0.075;
end;

steady;

perfect_foresight_with_expectation_errors_setup(periods=1000);
perfect_foresight_with_expectation_errors_solver (constant_simulation_length);

Also, rplot eb in my setting says "Brace indexing is not supported for variables of this type.

Error in rplot (line 52)
if ~any(strcmp(s1{k}, M_.endo_names))"

But aside from rplot, the bcb series starts 15 periods after. 0.076 instead of its SS value that is 0.0371

Just to be sure, can you please post or send the final code I am supposed to execute and which provides the wrong results.

Sure. Here is the last one.
Forum.zip (2.3 MB)

In the manual it says:

constant_simulation_length

By default, every time the information set changes, the simulation with the new information set is shorter than the previous one (because the terminal date is getting closer). When this option is set, every new simulation has the same length (as specified by the periods option of [perfect_foresight_with_expectation_errors_setup](https://www.dynare.org/manual-unstable/the-model-file.html#perfect_foresight_with_expectation_errors_setup); as a consequence, the simulated paths as stored in oo_.endo_simul` will be longer when this option is set (if s is the last period in which the information set is modified, then they will contain s+periods-1 periods, excluding initial and terminal conditions).

The problem is that I give the program some values learnt at 1 and then some values learnt at 15. And it cuts the first 15 periods. I wanted to have the whole simulation.

Thank you

Sorry, but I still don’t get the problem. oo_.endo_simul is 1016 periods long. It contains the first 15 periods.