"Hardcoding" the steady state in nonlinear model

Hi there.

I am trying to run a medium scale model, and have some doubts as to how I;

  1. Should approach numerical approximation of the steady state. (and how to implement fsolve)
  2. Run a first period temporary productivity shock and at the same time a permanent change of a structural parameter (policy change).

As for the first point, the non-linear model consists of around 60 equations, and Dynare is not able to find the steady state with the steady command, even if I tried adjusting initial guess values provided in an Initval block. However, I am able to provide some of the variables analytically. Given them I can also isolate a smaller system of ten variables in ten equations (to solve by fsolve), and given these in turn provide analytical expressions or isolate other smaller systems of the remaining variables. Do I seem to be on the right track?

The manual states that the easiest way to do it is through a steady_state_model block. It does not, as far as I can see, specify how to call fsolve functions inside. Can I find some guide for that anywhere? I have doubts on both syntax (Matlabs fsolve page not really helpful) and to how approach initial guess values (x0).

Also, in the steady_state_model example in the manual, a temporary variable is created, usefull for long expressions. It does not look like this variable has been declared anywhere else. Will Dynare itself be able to figure out, that a variable name which has not been declared in the variable block is a temporary variable?

As for point two:
I assume the way to do it is through running a deterministic simulation (simul or perfect_forecast, with stack_solve_algo=6), where the system is in steady state in period 0 and then in period 1 hit by contemporaneus shocks.
How do I approach the permanent change to a structural parameter? Do I need to declare it as an exogenous variable and use initval and endval?
Also, the manual reads: β€œNote that if some variables, endogenous or exogenous, are NOT mentioned in the endval block, the value assumed is that of the last initval block or steady command (if present).”
Does this also carry over when the steady state is given by a steady_state_model block instead of calculated by a steady command?

I apologize for the vagueness of the questions. Hopefully, a little guidance can go a long way. I appreciate all suggestions.

Thanks in advance, and nice summer to all!

Hi abrhun,

Concerning how to use fsolve, you can refer to file NK_baseline_steadystate.m in the example folder that conveniently comes with Dynare. There you have an example of its use.
The idea is that you should build a _steadystate file in which you derive expressions sequentially, such that once you have an expression for a variable as a function of parameters and other known steady-state levels of other variables, you can use that variable as known for subsequent expressions. You are on the right track: keep isolating tractable systems of equations which you can find a solution for, and insert them in the steady state file. If you use a ```_steadystate```` file, you will not need initial guesses, and the solution of the model will be updated automatically for each set of parameters that you feed in.
As to point two: I am not sure I understand well, but what you seem to want is to have a one-time shock (with a certain persistence \rho) that hits the economy. If you want that when the shock hits the economy, the economy is characterised by another parameter than the baseline, then set e.g.

set_param_value('PHI',0.3);

just before you call the solver.:slightly_smiling_face:

1 Like
  1. Going for a steady state file like the NK_baseline_steadystate.m is the right way to go.
  2. What is the context you have in mind for your simulations? Do you want to conduct perfect foresight simulations or is a first order stochastic simulation intended?

Hi both.

Thanks a lot for the replies. As for your suggestions:

I had a look at the NK_baseline files in the example directory. There are a few things about the syntax i am doubtfull about, so here goes:

1a)
The s.s. file begins with defining a function:

function [ys,check] = NK_baseline_steadystate(ys,exo)

Exactly what is this telling Dynare? Is the s.s. provided by the s.s. file as a function of vectors?

1b)
The code bit

global M_

Defines variables as global - do i need this bit in all my files? Also the seperate .m files where i define the functions to be called by fsolve in the s.s. file?

1c)
Initialisation of parameters:

NumberOfParameters = M_.param_nbr;
for ii = 1:NumberOfParameters
paramname = deblank(M_.param_names(ii,:));
eval([ paramname ’ = M_.params(’ int2str(ii) β€˜);’]);
end

Did i understand it correctly that these lines loads the parameter names and values as declared in the model file into the s.s. file, making it possible to provide equations that depend on these? Will it need no tweaking to fit in my own s.s. file?

1d)
Can you explain what the snippet below does?

NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
for ii = 1:NumberOfEndogenousVariables
varname = deblank(M_.endo_names(ii,:));
eval([β€˜ys(’ int2str(ii) ') = ’ varname β€˜;’]);
end

cmarch - Yes, it is indeed what i intended. Thanks for the suggestion, i will use set_param_value and see how it goes.

jpfeifer - Perfect forecast simulations was what i had in mind. So in t = 0, the economy is in s.s., then in t = 1 a policy change (permanent change of one or more parameters) and a one-time productivity shock (with persistence <1) hits the economy.

Best regards!
Asger

1a) Dynare will call the steady state file and will provide as inputs ys, which are initial values for the steady states (you can ignore those here) and for the exogenous variables exo, which may be relevant for perfect foresight simulations where they are not necessarily 0. The function is supposed to return a vector of steady state values ys and an indicator check whether a problem was encountered.
1b) This structure M_ is needed here, because it stores the variable names. If you don’t access it in your own files, you don’t need to set it global there.
1c) Yes, this part reads in all parameters, allowing you to address them by their name defined in the mod-file. You are not supposed to change this block.
1d) This part writes back the parameters and the steady state values into the format/structures expected by Dynare. Again, you are not supposed to change this part. It allows you to use the variable names in the steady state file without having to worry about writing them in the correct order to ys for passing them back to Dynare. Writing back the parameter values allows you to modify parameter values in your steady state file, e.g. setting labor to 0.3 in steady state and adjusting the labor disutility parameter accordingly.

  1. In this case, the parameter you want to change becomes an exogenous variable
1 Like