CTW(2011) and its steady state model

Hello, everyone on the Dynare Forum,

I am an undergraduate student currently studying DSGE models. Until recently, I had only worked with linear models, but I have just started to explore nonlinear models. Right now, I am trying to replicate the model from “Introducing Financial Frictions and Unemployment into a Small Open Economy Model,” and I have finished writing my code for it.

I attempted to use Dynare’s built-in solver to find the steady state solutions. However, I ran into problems because several variables were initialized to zero. Below is the output from model_diagnostics;:

dynare_solve: starting value results in nonfinite/NaN value. Randomize initial guess…
Nonlinear solver routine returned errorcode=-10.

STEADY: The Jacobian at the initial values contains Inf or NaN. The problem arises from:

Derivative of Equation 61 with respect to Variable h (initial value of h: 3.4523)
Derivative of Equation 58 with respect to Variable H (initial value of H: 3.4523)
Derivative of Equation 46 with respect to Variable pitildaw (initial value of pitildaw: 1.0078)
Derivative of Equation 47 with respect to Variable pitildaw (initial value of pitildaw: 1.0078)
Derivative of Equation 48 with respect to Variable pitildaw (initial value of pitildaw: 1.0078)
Derivative of Equation 49 with respect to Variable pitildaw (initial value of pitildaw: 1.0078)
Derivative of Equation 46 with respect to Variable wO (initial value of wO: 1)
Derivative of Equation 47 with respect to Variable wO (initial value of wO: 1)
Derivative of Equation 49 with respect to Variable wO (initial value of wO: 1)
Derivative of Equation 58 with respect to Variable wO (initial value of wO: 1)
Derivative of Equation 61 with respect to Variable wO (initial value of wO: 1)
Derivative of Equation 46 with respect to Variable piw (initial value of piw: 1)
Derivative of Equation 47 with respect to Variable piw (initial value of piw: 1)
Derivative of Equation 48 with respect to Variable piw (initial value of piw: 1)
Derivative of Equation 49 with respect to Variable piw (initial value of piw: 1)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
STEADY: If you are using model-local variables (# operator), check their values as well.

STEADY: numerical initial values or parameters incompatible with the following equations
58

Please check for example
i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
MODEL_DIAGNOSTICS: The steady state cannot be computed

I would like to ask for advice on how to address this issue. I plan to use the parameter estimates from the paper as my initial parameter values. As for the variables, I am considering solving the steady state equations using MATLAB’s fsolve first, then supplying those solutions in the initval block. I am wondering if this is a suitable approach when dealing with a nonlinear DSGE model.

I have attached my code and the paper I consulted.

Introducing financial frictions and unemployment into a small open economy model.pdf (2.3 MB)
CTW2011.mod (18.8 KB)
Ch_Latex.mod (12.9 KB)

Ch_Latex.mod is the one which contains model_dignostics; command.

Thank you for your help.

For models of that size it is almost always necessary to compute the steady state analytically. That also provides a natural consistency check between dynamic equations and steady state computations. At a minimum, you need to initialize all variables that cannot be 0. Currently,

Kw = 0;
Fw = 0;

is infeasible for example.

Thank you, Professor.

Your kind replies are always helpful.
I will adjust the initial values as you advised.
I truly appreciate how you always provide such kind and detailed answers whenever I post a question.

Have a nice day :smile: !!

Dear Professor Pfeifer,

I am writing in follow-up regarding the replication of the paper, as I have some additional questions.

Since Professor Christiano’s code does not run on Dynare version 6.3, I have been attempting to develop a new code based on his work. I wrote the steady state code, but I have encountered an issue. When I ran “dynare my_baseline.mod” in Matlab, an error occurred in the steady state file. The error appears to be related to the parameter “sigmab,” and I am unable to understand why Matlab fails to recognize it.

In my_baseline_steadystate.m, on line 324, I defined “sigmab” using parameters that were already defined, so I expected its value to be properly set. Could this assumption be mistaken? In this code, after using fsolve to determine AL, delta, and varphi, I proceed to identify the remaining unknown parameters (this includes not only the model parameters but also steady state values of endogenous variables—for instance, denoting lrkbarU as a parameter similar to rkbar). Is it possible that Matlab’s error, stating that “sigmab” is an unrecognized function, is due to fsolve failing to find AL, delta, and varphi?

I have given this matter considerable thought but have been unable to reach a satisfactory conclusion. Therefore, I humbly ask for your guidance.

Thank you very much for your continued assistance.

Very respectfully,

c.f.) First three files are my work
my_baseline_steadystate_find_AL_delta_varphi.m (2.6 KB)
my_baseline_steadystate.m (19.3 KB)
my_baseline.mod (24.7 KB)

I downloaded professor Christiano’s dynare codes from: https://faculty.wcas.northwestern.edu/lchrist/course/Korea_2012/CTW.html

Professor,

I think that I finally find a way to solve my problem.
Thank you so much for your support.
Over the course of my posts on this forum, the consistently kind and thoughtful responses you have provided have greatly contributed to my personal growth. I am sincerely and deeply grateful for this, and I must express my heartfelt thanks. This forum has been an immense help to me in my studies.
Now I am so happy right now…

Anyway, Thank you so much!!

I am glad you found the solution.