I and co-authors at the IMF have run into a peculiar problem with Dynare not announcing that the rank condition is violated in a deterministic model where debt grows explosively. The trivial examples in the attached files illustrate the problem. In trial_2, tax revenues decrease for five years and then return to their original level. This sets off explosive growth in the debt. Strangely, Dynare does not announce that the rank condition is violated (1 eigenvalue with modulus greater than unity vs. 0 forward-looking variables). Instead we get the perplexing message “Improper assignment with rectangular empty matrix.” More puzzling yet, when we run a stochastic version of the model (trial_1), Dynare does announce that the rank condition fails to hold. But Dynare linearizes around the deterministic steady state in the stochastic program. So why do we get the message we want in this case but not in the deterministic program?
In the more complicated model we are analyzing, the message that the rank condition fails would help us determine when fiscal adjustment is too slow to stabilize the path of debt. In unstable scenarios, however, Dynare sends out the message that it is struggling with an ill-conditioned, nearly singular matrix before aborting the run. Is this broadly similar to the message in the example that it has encountered an empty rectangular matrix?

There are two issues with these examples. Both related to bugs in Dynare.

there is a bug in the check command when used in a deterministic setup (a *.mod file with simul and not stoch_simul)

Dynare doesn’t compute deterministic simulation of purely backward models.

I corrected the bug related to 1) and added an explicit error message in the case of 2). The corrections will be available in tomorrow’s unstable version.

Eigenvalues are computed with the check command and the user has the responsibility for checking the eigenvalues before attempting a deterministic simulation. This can not be included automatically in simul, because with proper initialization of the trajectory (using initval_file for example), it is possible to simulate models with a balanced growth path where the criteria for explosive eigenvalues would not be 1.0

Thanks for clearing this up. Could you answer two other questions for us:

While we wait for the fix in a future stable version of Dynare, is there a command that allows us to extract the linearized coefficient matrix Dynare uses to evaluate the rank condition? If there is, we could feed the matrix into a separate Matlab program to compute the eigenvalues of the system and check the rank condition.

Suppose the model is unstable for T periods and then a regime change occurs that stabilizes the system. Does Dynare evaluate the rank condition at the initial steady state (where the condition does not hold) or at the new steady state (where it does hold)?

All of this is part of a project to build a better framework for debt sustainability analysis at the Fund. Dynare has proven to be a remarkably versatile and powerful tool, but some of the inner workings of the genie remain mysterious to us.

It’s probably easier to use the snapshot in the meantime, since the bug is fixed there.

[quote] 2. Suppose the model is unstable for T periods and then a regime change occurs that stabilizes the system. Does Dynare evaluate the rank condition at the initial steady state (where the condition does not hold) or at the new steady state (where it does hold)?
[/quote]

It depends: if you put the “check” after the “initval” block, it will verify the condition at the initial steady state. If you put it after the “endval” block, it will verify it at the terminal condition. Note that you can put “check” at both places.