Issue with Collinearity in a simple Nonlinear NK Model Implementation

Hello everyone,

I’m implementing the nonlinear version of the Chapter 3 New Keynesian model from Understanding DSGE Models by Celso José Costa Junior. I entered the model in its fully nonlinear form and also included a steady_state_model block.

I have a question regarding a problem I encountered when i run the code in the nonlinear form. The model returns an error about “collinear relationships between the variables and the equations”. As a result, the theoretical moments return NaN.

In the code, I replaced the forward-looking price-setting equation (Equation 3.20 from the book):

image

with a recursive formulation that can be used in Dynare’s nonlinear context:

Maybe something in my derivation is not good, but i suspect that the problem could be due to the equations of the firm (production function, demand for capital, demand for labor and marginal cost), since the model detect the collinear equations in those equations (this is showed when i add the “model_diagnostics“ command in the code).

And I noticed that in the book, when Celso log-linearized the equations, he has the equations

image

But in the Dynare code that accompanies the book, the log-linearized MC variable is not included. I’m not sure why this is the case, and I really would appreciate any clarification.

I attach the code here also.

simple_nk.dyn (1.6 KB)

I am not surprised. See the threads at

and