How to generate certain paths of endogenous variable under perfect foresight simulation

Hello everyone,

In this exercise, I am interested in making sure endogenous variable “a” to be 1 throughout 40 quarter period under perfect foresight simulation. I use

initval;
a=1;
end;

endval;
a=1;
end;

and later use

perfect_foresight_setup(periods=100);
perfect_foresight_solver(maxit=1000,stack_solve_algo=7,solve_algo=0);

Is it possible to have a var a =1 throughout 40 quarter?
example1.mod (1.7 KB)

Thanks,
Amina

You cannot fix an endogenous variables, only exogenous ones. Of course, you can try to find a shock path that makes an endogenous constant, e.g. https://github.com/JohannesPfeifer/DSGE_mod/tree/master/NK_linear_forward_guidance

Thank you for your reply and example!

Why do you have two

perfect_foresight_setup(periods=100);

in the code? Is distance.m file important to find a shock path to make endogenous variables constant?

I used your code as an example and got this error message from using distance.m

oo_ = perfect_foresight_solver_core(M_,options_,oo_);
Index in position 2 exceeds array bounds.

Error in sim1 (line 40)
y0 = endogenousvariables(:, M.maximum_lag);

Error in perfect_foresight_solver_core (line 102)
sim1(oo_.endo_simul, oo_.exo_simul, oo_.steady_state, M_, options_);

  1. The first call sets up the structure for doing the distance minimization. The second call is for conducting the actual simulation after that.
  2. Without the full codes it is impossible to tell.