I am estimating permanent shocks in a perfect foresight model by fitting the model to the data.

Is there any command like set_param_value that I can use to reset the shock variables (or exogenous variables)? I have tried to assign new values to oo_.endo_simul, but it didn’t work. (which I mean the computed deterministic path didn’t change after the assignment of values. )

Or can I allow some parameters to enter shock blocks such that I can go back to use set_param_value?

Really appreciate it if anyone could offer me some suggestions!

Thank you very much for your reply! Your suggestion is most helpful. I had set the entry in oo_.exo_simul before calling perfect_foresight_setup. I guess it was where the problem came from.

I am using matlab optimization routines to loop over a parameter to optimize the value function in a deterministic model. In each loop, it calls perfect_foresight_solver.

Q1: fmincon did not give the right value. In the first loop (initial value that I gave), dynare turns to homotopy and successfully solve the path. Then fmincon just took it as the answer. When I changed the initial guess, this happened again. Why is the case? It doesn’t happen to fminsearch. But I do need to set a bound for the parameter.

Q2: Where is the option inside perfect_foresight_solver stored? I want to change maxit and no_homotopy settings mannually in different cases.

I set the value to be zero if oo_.deterministic_simulation.status ~= 1 in the called function. Is this what you suggested? The problem still exists. Each time fmincon just reports the initial guess that I gave. Thanks!

I also changed the Algorithm for fmincon to sqp, and it doesn’t work either. Attached are the log information under two cases: initial guess is -10 and -5. fmincon admits both are local optimum. The bound is between -200 and 0. The correct number should be around -200, a corner solution, indicated by a rough grid search.