1.3. Zero-th order approximation: steady state and balanced-growth path

The most flexible way to approach the solving of the steady state and the balanced-growth path is through the writing of a separate steady-state file. (Setting the steady state inside the model file via @steady_state_model is also supported – see Model file language.)

1.3.1. Anatomy of a steady-state file

A steady-state file is a plain MATLAB function (name of your choice). Its signature:

[y, newp, retcode] = my_ssfile(m, y, p, d, id)

Args:

  • m – model object (not always needed).

  • y – endo_nbr x 1 vector of initial steady state (stationary models) or endo_nbr x 2 matrix of initial steady state and growth rate (non-stationary models).

  • p – parameter structure.

  • d – definitions.

  • id – locations of the variables to calculate.

Returns:

  • y – the updated steady-state vector (or vector + growth rate for non-stationary models).

  • newp – structure of updated parameters, if any (a steady state can pin parameters implied by SS conditions; these belong here, not as numerics in the params file).

  • retcode – 0 if no problems, non-zero otherwise.

Note

The steady-state file is regime-agnostic:

  • The same file is valid whether the model has many regimes or not.

  • The user does not need to know which regime is being computed.

  • It is in sync with the steady-state model.

RISE calls the function twice:

  1. First call with one argument (the model object only). Collects:

    • the list of variables for which the steady state is solved and the order in which the calculations will be returned;

    • the list of parameters whose value is computed in the steady state.

  2. Second call with all input arguments. The user returns the steady state and the steady-state-computed parameters.

A complete listing, for a simple non-stationary model:

function [y, newp, retcode] = simple_ssfile(m, y, p, d, id)

retcode = 0;

if nargin == 1
    % list of endogenous variables to be calculated and the
    % order in which they will appear
    y    = {'Y','Z','h'};
    newp = {};       % list of parameters computed during SS
else
    % steady states and new parameter values
    newp = struct();

    h = [1/3,    0];
    Z = [p.zss,  p.mu];
    Y = [Z(1)*h(1),  Z(2)];

    ys = [Y; Z; h];   % order matches the list above

    if any(isnan(ys(:)))
        retcode = 1;
    else
        y(id, :) = ys;
    end
end

end

1.3.2. Incomplete analytical solution

Sometimes the user’s program does not solve the steady state or the balanced-growth path completely. This can occur because the user can only calculate part of the steady state, or because RISE created auxiliary variables (notably the Lagrange multipliers under optimal policy).

While RISE knows how to handle its own auxiliary variables, it falls back to a numerical solve for the remaining variables given the partial steady state the user supplied.

1.3.3. Steady-state loops

Sometimes the user can compute the steady state conditional on the knowledge of a particular variable. For instance, in an optimal-policy problem where only monetary policy is missing, knowing steady-state inflation may pin every other endogenous variable (Lagrange multipliers excluded).

Write a steady-state file that takes the missing variables as given. RISE proposes values for those missing variables in the second argument of the steady-state file. The locations of the missing variables come from:

get(m, 'endo_list')

Set the option sstate_loop to true to inform RISE that only a subset of variables is unknown.

1.3.4. Facilitators

Several facilitators help the numerical solve and can be combined.

Equation simplification

The user provides both a dynamic equation and a steady-state companion (the #-companion form, see Model file language):

log(X{t}) = (1-rho)*log(xss) + rho*log(X{t-1}) + sig*E{t} #
    X{t} = xss;

log(Z{t}/Z{t-1}) = log(muz) + sigz*EZ{t} #
    Z{t} = muz*Z{t-1};

Declaring log and level variables

Besides the economic interpretation, taking log approximations restricts the search domain for log variables to \((0, +\infty)\), which prevents:

  • division by 0;

  • log of zero;

  • log of negative values.

Setting bounds on variables

RISE accepts user-defined bounds on the search space for the steady state and the growth rate of variables under a numerical solve.

When a numerical steady state counts as solved

A numerical solve of the steady state succeeds (return code 0) when the largest residual of the steady-state equations in absolute value, max|r|, is below max(TolFun, 1e-6). TolFun is the function tolerance of the solver (the options of sstate_solver) and 1e-6 is an acceptance floor, fixed for all models: the residual a solver can reach is limited by the accuracy of its Jacobian and differs from model to model (about 1e-13 for a well-conditioned one, 1e-8 for a large or ill-conditioned one with finite differences), and a verdict against a tight tolerance would be a coin-flip. A looser TolFun is honored; a stricter one only decides how far the solver iterates, not what is accepted. A steady state with max|r|=1e-7 is accepted under TolFun=1e-12. The residuals are those of the equations as they are written: they are not scaled by the size of the variables.

What the solver achieved is not in the return code. After a solve, report=rise.engine.diagnose.steady_state(m.model_data) gives the largest residual in report.max_resid, the floor it is judged against in report.accept_floor, the worst equations ranked and a verdict, and diagnose(m) prints the same diagnosis for a model whose steady state fails. Check max_resid before relying on a steady state for derivatives of high order or for welfare comparisons, which are more sensitive to the residual than a simulation. See Failure diagnosis: diagnose(m) and friends.

A solver of your own goes in sstate_solver as a function handle, either x=mysolver(fun,x0,lb,ub) or x=mysolver(fun,x0,lb,ub,options), where options are the solver options that come with the handle (the solvers of RISE declare varargin). A handle of any other number of inputs is refused with rstst:select_solver:invalidUserSolver.

1.3.5. Steady states of growing variables in the dynamic equations

On a balanced growth path the steady state of a growing variable is not a number but a path. When a dynamic equation refers to the steady state of the lead of a variable, stst(V{+1}) (also steady_state(V{+1})), and the variable grows, RISE reads it as an anchor that moves with the variable, not as the value of the path at the date of the expansion. In the coordinates of the dynamic equations (the log of a log variable) it is replaced by the reference that @cognitive_discount uses (see Cognitive discounting):

\[R_{V,t+1} = \mathrm{stst}(V_{t+1}) + \lambda_V\,\big(V_{t}-\mathrm{stst}(V_{t})\big)\]

RISE sets \(\lambda_V\), the parameter cdlambda_<V>, after every steady-state solve. In a model declared nonstationary (solve_bgp true):

  • a variable whose steady-state growth is not zero in some regime gets \(\lambda_V = 1\): the reference is \(V_t + g_V\), the variable’s own current value grown at its own steady-state growth \(g_V\) (for a log variable: \(V_t\) times its gross growth factor);

  • a variable whose growth is zero in every regime and whose level the steady-state system does not pin down (it loads on the null space of the static Jacobian, as a unit root without drift does) gets \(\lambda_V = 1\): the reference is its previous value \(V_t\);

  • any other variable gets \(\lambda_V = 0\): the anchor is its steady state, as before.

In a model not declared nonstationary every anchor is the steady state. The null-space check is computed once, at the first steady-state solve, and reused at every later solve and estimation draw; it is redone only when the set of zero-growth variables changes, not when parameter values change. Nothing in the equations is searched for and nothing else has to be declared.

Why this reference: RISE solves the model at one point of the balanced growth path and uses that solution all along it, so the equations must be unchanged when every growing variable is shifted along its trend. \(V_t + g_V\) shifts one for one with \(V\), under deterministic and stochastic trends alike; a fixed number does not.

For the log price level with p = p{-1} + pi and a target pis:

stst(p{+1}) + m*(p{+1} - stst(p{+1}))

is (1-m)*(p + pis) + m*p{+1}, that is p + pis + m*(pi{+1} - pis): the anchor of p{t+1} is p{t} + pis. The expectation is p{t} + pis when m = 0 and p{t+1} when m = 1. With a unit-root technology A and a consumption C that grows like it at the gross rate gz, stst(C{+1}) is gz*C, so a hand-written discounting stst(C{+1}) + mcd*(C{+1} - stst(C{+1})) keeps the balanced growth path an equilibrium for every mcd. Note that the anchor of consumption follows consumption, not the realized technology A{+1}.

Limits:

  • only leads, stst(V{+1}), are rewritten. stst(V) and the steady states of lags, of expressions and of exogenous variables stay the steady state at the expansion date;

  • \(\lambda_V\) does not switch: a variable that grows in one regime gets the moving reference in every regime, with the growth of each regime (0 in a regime where it does not grow);

  • the steady-state model and files, the @epilogue and the planner objective are not touched. In an optimal-policy model the rewrite applies to the formed system, the first-order conditions included, like the rest of the expectations operator;

  • @cognitive_discount builds the same reference for the leads of the variables it tags: a steady state written by hand and one created by the discounting are treated once, alike, with one cdlambda_<V> per variable. A declared parameter with that name is refused (rise:cognitive_discount:reservedName).

1.3.6. Multiple regimes

The presence of multiple regimes does not add complexity for the steady-state computation. The steady state is computed either:

  • at the ergodic mean of the parameters (Foerster, Rubio-Ramirez, Waggoner and Zha, 2016); or

  • with a different vector of parameters per regime (Maih-Waggoner, 2018; Chang et al., 2021).

Plain 'm' now uses self-consistent expansion points of the shock-free switching economy. On a switching model these rest points are outputs of solve; use get(m,'sstate') afterward. A separate sstate or solve_derivatives_only request is refused for that configuration.

The isolated variant {'m','isolated'} reproduces former plain M, including the existing sstate_unique behavior. Its restrictions when steady states or growth rates switch are described in When the steady state or the growth rate switches, change the type. 'mw' remains available with its existing behavior.

1.3.7. Residual acceptance and iteration targets

sstate_acceptance_tol=[] preserves the default residual verdict threshold, max(solver tolerance,1e-6). A positive finite value can only tighten that verdict threshold: the actual criterion is the minimum of the historical threshold and the supplied value. Larger values leave the historical criterion unchanged. Thus sstate_acceptance_tol=1e-9 can reject a point whose residual the default would accept. This changes acceptance only; it does not tighten the optimizer’s iteration target or improve the returned point. Set appropriate solver tolerances and derivatives when higher precision is needed. Steady-state diagnostics report the same effective threshold. The numerical, block, loop and steady-state-file verdict paths, including the fast estimation kernel, carry the option; imposed-state semantics remain unchanged. WorkingWithAModel/steady_state_acceptance_example compares the default and explicitly stricter verdicts on a supplied model.

1.3.8. Repeated numerical solves

sstate_warm_start = true seeds a repeated numerical steady-state search from the last successful solution of the same model. Current parameters and bounds still prevail; a failed warm solve retries from the cold start. The default is false because the starting guess can affect numerical rounding and, with multiple steady states, the root selected. See Steady-state warm starts for the accuracy qualifications, cache reset and seeded fs2000 comparison.