09 March 2011

SSTATE function and SSTATE objects

by Jaromir Benes

Calculating the steady state of a non-linear model – or its balanced-growth path, for that matter – is sometimes a bit of challenge in which you can (and often really need to) play all sorts of tricks. In IRIS, there are two basic ways how to handle and tame steady states.

The first option is running the sstate function on the model object itself. You can do this as soon as you load the model and assign parameters. The function uses the steady-state versions of the model equations whenever they are provided (that's what you specify after a double exclamation point, !!, at the end of any equation), and has a few options that allow you to tailor the procedure to a particular model:

  • you can switch on a recursive structure analyser to re-arrange the equations and variables into separate blocks that can be solved recursively, reducing thus the computational burden (option 'blocks');
  • you can choose to compute only the steady-state levels, or also steady-state growth rates (option 'growth');
  • you can exogenise some of the variables and endogenised a corresponding number of parameters (the pair of options exogenise and endogenise);
  • you can fix some of the levels or growth rates to given numbers (options fix, fixlevel, fixgrowth).

The sstate function works usually fine for not-so-large or not-so-unusual models. But what about if it keeps failing? You can resort to the other option: creating a separate steady-state file. Despite its name, steady-state files have, in fact, no direct relation to the model files. They are just a user-friendly tool for conveniently writing and solving systems of equations, allowing you to play around with the equations, splitting them into blocks, re-ordering them, and combining both numerical and symbolic types of solutions. But you really need to re-write everything (or copy-paste chunks of the original code) in a separate file, using similar yet distinct syntax.

After you write a steady-state file, you load it as a steady-state object. The object can be then compiled into a stand-alone m-file function -- either as a whole, or just selected blocks of it. How does then such a function work? You simply create a database with input information (typically, with steady-state parameters), and call the m-file function with this database passed in as an input argument. What you get out of it (provided the function succeeds to compute the solution) is a new database with the solution of the equations -- i.e. the steady state of the model for given input parameters.

Both the sstate function run directly on model objects, and the separate sstate files and objects have full support for multiple parameterisations. In other words, you can use them to compute the steady state corresponding to more than one set of parameters at once.

Remember also that after you find a steady state, it's a good idea to perform a check that it really is a valid steady state by calling chksstate.

Finally, what about linear models? The steady state is not an issue whatsoever in linear models. You don't even have to calculate, or know anything about, the steady state before you solve the model. In fact, it's the other way around: The steady state is backed out using the reduced-form representation of the model after it's been solved.

3 comments:

  1. what did mean by exo/endogenising when computing steady state? does it mean that i can interchange roles of variables and parameters when doing that?

    ReplyDelete
  2. Yes. You can for example define a variable tracking the labour-to-GDP ratio. Then, when computing steady state, you tell the sstate function to find one of the production function parameters so to match a particular labour-to-GDP.

    ReplyDelete
  3. can you show me a steady state file?

    ReplyDelete