# Perfects foresight: lmmcp works, standard solver does not

Dynare_Forum.zip (806.2 KB)

Hi, I am having troubles solving the perfect foresight path for small shocks in this model. For some reason, the lmmcp algorithm works, but the standard solver does not.

To replicate the results that lmmcp works , run the matfile RUN_0_Replicate_Error.m

To replicate the result that the standard solver does not work, go to .mod file, and exchange line 349 for “perfect_foresight_solver;”. Then RUN_0_Replicate_Error.m

Any idea of why this might be happenning ?

Best,
Pablo

Could it be that the steady state file is missing?

There is a singularity in the stacked Jacobian that throws off the standard solver. For some reason, this does not throw off the lmmcp-solver, most probably due to the least-squares formulation it employs. A similar thing happens in Dynare failed to do the deterministic simulation - #2 by jpfeifer

Is there a specific reason why this might happen ? The model seems to be stable, and the stochastic simulation works.

How come then the non linear perfect foresight solver finds this singularity and the lmmcp or the stochastic simulation does not ?

I tried simplifying the model further to the point where the model is just a simple Gertler Karadi. Do you have any idea of why this model does not work with standard perfect foresight ?

Best,
Pablo

It works with standard perfect foresight, just not with the standard numerical solver. I don’t have a good intuition for this. Maybe @MichelJuillard has an idea.

I have only intuitions:

1. this seems to occur when the matrix of derivatives with respect to the current values of the endogenous variables is singular
2. perfect foresight simulation imposes only the return to steady state when stoch_simul imposes the return to the steady state and a unique way of setting y_t as a function of y_{t-1} and u_t. Therefore more constraints on the solution
3. The fact that in this case the Jacobian of the perfect foresight problem is singular suggests the existence of several trajectories. This singularity breaks the possibility to use a pure Newton like algorithm. LMMCP is a Levenberg-Marquardt algorithm. It is possible that it can find one of the several solutions.

Did you manage to figure out why lmmcp worked and the default Newton-like solver didn’t? I’m facing a similar problem. Thanks.

I tried using the Dynare version 4.6.1 and it worked with both. Using Dynare 5.4 instead, no. Maybe is a simple bug.

Can you provide the file for testing?

The file is the one attached by Pabs138 (i just commented “addpath” lines 10 and 11), so you can download that.

However, this morning i checked again and in reality using Dynare 5.4 (i tried also with Dynare 5.1 and same error) i’m getting the error either using the newton solver as well as the lmmcp. The error is the following:

Unrecognized field name “initval_series”.

Error in make_ex_ (line 40)
if isempty(oo_.initval_series)
Error in perfect_foresight_setup (line 67)
oo_ = make_ex_(M_,options_,oo_);
Error in KN_stripped_down.driver (line 634)
perfect_foresight_setup;
Error in dynare (line 281)
evalin(‘base’,[fname ‘.driver’]);
Error in RUN_0_Replicate_Error (line 17)
eval(['dynare ’ ‘KN_stripped_down’ ’ ’ opt{:}])

However, this doesn’t happen with Dynare 4.6.1 (both solvers work fine).

You also need to change the mod-file.

``````load('./matfiles/Calibration_new.mat') ;
``````

needs to be

``````load('./matfiles/Calibration_new.mat','params') ;
``````

Ahh, didn’t know. So, it is not the version of Dynare. It doesn’t work.