Deterministic Simulation Non-Convergence

I have a model, building on Ghironi and Melitz (2005) where the stochastic simulation solve with no issues, and produces sensible responses, but with the deterministic simulation, no matter how many periods I try to simulate over (I’ve tried up to 20000), the results do not converge with any size of shock >0.

Model_Diagnostics detects no obvious problems with the mod file, and the B-K conditions are satisfied (both rank and eigenvalues>1=forward looking variables).

I’ve tried reducing the model down to its most simple form possible, with no improvements.

Any help would be much appreicated.

MNInterW.mod (23.8 KB)

1 Like

At least one file is missing. The code is crashing because WorkingSteady.mat is missing.

Best,
Stéphane.

Apologies, here is the code without the call to an external file:
MNInterW.mod (23.3 KB)

Have you tried what happens with very small shocks? Does it work then?

1 Like

I’ve tried with very small shocks and the simulation still fails to converge - homotopy fails as well - the only stage of the homotopy that ‘suceeds’ is when the shock size is small enough that dynare treats it as 0 when solving the model. e.g for a 0.1% shock to TFP in one industry this is the output (with maxit =10, given that the error doesn’t change after iteration 3):

MODEL SIMULATION:

Iter: 1, err. = 0.0001, time = 1.805
WARNING : Failed to find a solution to the linear system.
Iter: 2, err. = 0.00022364, time = 0.529
WARNING : Failed to find a solution to the linear system.
Iter: 3, err. = 0.00022365, time = 0.551
WARNING : Failed to find a solution to the linear system.
Iter: 4, err. = 0.00022365, time = 0.516
WARNING : Failed to find a solution to the linear system.
Iter: 5, err. = 0.00022365, time = 0.377
WARNING : Failed to find a solution to the linear system.
Iter: 6, err. = 0.00022365, time = 0.339
WARNING : Failed to find a solution to the linear system.
Iter: 7, err. = 0.00022365, time = 0.34
WARNING : Failed to find a solution to the linear system.
Iter: 8, err. = 0.00022365, time = 0.411
WARNING : Failed to find a solution to the linear system.
Iter: 9, err. = 0.00022365, time = 0.358
WARNING : Failed to find a solution to the linear system.
Iter: 10, err. = 0.00022365, time = 0.37
WARNING : Failed to find a solution to the linear system.

Total time of simulation: 21.293.
Maximum number of iterations is reached (modify option maxit).

Simulation of the perfect foresight model failed!
Switching to a homotopy method…

Iter. | Lambda | status | Max. residual
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 | 0.50000 | failed | 5.000000e-05
2 | 0.25000 | failed | 2.500000e-05
3 | 0.12500 | failed | 1.250000e-05
4 | 0.06250 | succeeded | 6.250000e-06
5 | 0.12500 | failed | 1.250000e-05
6 | 0.09375 | succeeded | 9.375000e-06
7 | 0.12500 | failed | 1.250000e-05
8 | 0.10938 | failed | 1.093750e-05
9 | 0.10156 | failed | 1.015625e-05
10 | 0.09766 | succeeded | 9.765625e-06
11 | 0.10156 | failed | 1.015625e-05
12 | 0.09961 | succeeded | 9.960938e-06
13 | 0.10156 | failed | 1.015625e-05
14 | 0.10059 | failed | 1.005859e-05
15 | 0.10010 | failed | 1.000977e-05
16 | 0.09985 | succeeded | 9.985352e-06
17 | 0.10010 | failed | 1.000977e-05
18 | 0.09998 | succeeded | 9.997559e-06
19 | 0.10010 | failed | 1.000977e-05
20 | 0.10004 | failed | 1.000366e-05
21 | 0.10001 | failed | 1.000061e-05
22 | 0.09999 | succeeded | 9.999084e-06
23 | 0.10001 | failed | 1.000061e-05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Failed to solve perfect foresight model

As soon as homotopy trys a lambda of 0.1 or greater, the step fails.

I’ve also tried very small shocks to each of the exogenous variables on their own, and again the simulation fails to converge.

That is strange. Could you please provide the most recent version of the file?

I have manged to work around the issue, by using a slightly different approach to the derivation of the model, so the file posted above is still the most recent version of the model with this issue. However, I am still unclear as to the theoretical reason why a model would run stochastically, and fullfil all of the BK conditions, and yet not converge deterministically, even with a large number of periods and very small shocks.

I also do not understand how this can happen. @stepan-a @MichelJuillard Do you have any idea?

The problem in your model is that the Jacobian of the contemporaneous endogenous variables is singular. This is not a problem for the stochastic solver, but it is a problem for the way the perfect foresight simulations are conducted.

Dear Prof Pfeifer,
I encounter similar problem. It works fine under stochastic case. But perfect foresight simulations always fail.
Could you be more specific about “Singularity of Jacobian of the contemporaneous endogenous variables”? How can I avoid such singularity?

See Perfect foresight simulation always failed

For future reference, the debug-option should be able to provide some insights starting with Dynare 4.7.
See perfect foresight: provide debugging information for singular Jacobian (!1834) · Merge Requests · Dynare / dynare · GitLab

I saw. Thank you so much!