1.7. Perturbation types for regime-switching models
A perturbation of a constant-parameter model names one thing, the scale \(\sigma\) of the shocks, and expands the policy function around the deterministic steady state, the point the economy rests at when \(\sigma = 0\). A regime-switching model adds a second source of variation, the Markov chain, and when the switching parameters move the steady state there is no longer one point to expand around. Each perturbation type in RISE is a different answer to that problem, and the answers differ in three places:
What is perturbed. The shock scale alone (
'm','bm',{'m','scl'}), the shock scale and the off-diagonal transition probabilities ('mw'), or the shock scale and the switching parameters themselves ('frwz').What the economy is at the origin of the perturbation. The switching economy without shocks (
'm',{'m','scl'},'bm'), the regimes in isolation ('mw'), or one economy with common parameters ('frwz').Where the derivatives are taken. At the isolated steady states with the lead of the pair \((i,j)\) evaluated at regime \(j\)’s steady state (
'm','mw'), at the P-weighted anchors of Barthélemy and Marx ('bm'), at the rest points of the shock-free switching economy with the lead at the transition point ({'m','scl'}), or at the steady state of the common-parameter economy ('frwz').
The type is selected with the solve_perturbation_type option of
solve (or set); the syntax of each value is given in its
section below. With a common steady state across regimes, or on a
constant-parameter model, every type returns the same solution, the
standard perturbation: the differences below are about what happens
when the steady state switches.
1.7.1. The types at a glance
Value |
Perturbed |
Economy at the origin |
Anchors |
Lead of pair \((i,j)\) at |
First-order constant |
|---|---|---|---|---|---|
|
\(\sigma\) |
switching, shock-free |
isolated steady states \(\bar x_i\) |
\(\bar x_j\) |
none |
|
\(\sigma\) and \(P(\sigma)=(1-\sigma)I+\sigma P\) |
regimes in isolation |
isolated steady states |
\(\bar x_j\) |
from the tilt of \(P\) |
|
\(\sigma\) and \(\theta_i(\chi)=\bar\theta+\chi(\theta_i-\bar\theta)\) |
common parameters \(\bar\theta\) (ergodic mean) |
one steady state \(\bar x(\bar\theta)\) |
\(\bar x\) |
from the parameter gap |
|
\(\sigma\) |
switching, shock-free |
P-weighted anchors (their Assumption 2) |
\(\bar z_j\) |
none |
|
\(\sigma\) |
switching, shock-free |
rest points \(\hat x_i\) of that economy |
transition point \(T_j(\hat x_i)\) |
none (certainty equivalence) |
|
\(\sigma\) |
switching, shock-free |
isolated steady states |
transition point |
carries the rest-point residual |
|
\(\sigma\) and \(P(\sigma)\) |
regimes in isolation |
isolated steady states |
transition point |
from the tilt |
Two relations hold between them and are checked in the test suite.
With a common steady state 'm', 'bm', {'m','scl'} and 'mt' are
identical at every order, and 'frwz' with an empty partition is
'm'. With P = I (regimes that never communicate) {'m','scl'} is
'mw' at first order, and {'mw',{'*none'}} is 'm'.
1.7.2. Perturbation M ('m')
The default. Only the shock scale is perturbed, the transition matrix
stays active in the first-order slopes, and regime \(i\)’s policy is
expanded around its own isolated steady state \(\bar x_i\), the
solution of the model with the parameters of regime \(i\) held
forever. The derivatives of the pair \((i,j)\) are evaluated with
next period’s variables at \(\bar x_j\) and the current and lagged
variables at \(\bar x_i\). The first-order solution carries no
constant, and its rest points are therefore the isolated steady states
whatever the switching does. The higher orders are the standard ones,
computed by the hops engine or the recursive engine.
This is exactly right when the steady state does not switch, which is
the case of switching volatilities, switching policy-rule coefficients
and switching persistences, and it is what most of the estimation
literature uses. When a switching parameter moves the steady state (a
productivity level, an inflation target, a tax rate), the isolated steady
state is not a rest point of the switching economy, because agents in
regime \(i\) anticipate the switch: the expansion point is then a
point the reference economy never visits, the first-order solution has a
level error of the order of the gap between steady states, and that
error is a constant that no higher order removes. The Euler-error test
below shows it as a flat verdict.
'm' and 'maih' are the same value. The type takes no partition.
1.7.3. The Maih–Waggoner perturbation ('mw')
Maih and Waggoner (2018) perturb the transition matrix along with the shocks: \(P(\sigma)=(1-\sigma)I+\sigma P\), so that at the origin the regimes are isolated and each has its own deterministic steady state, a valid perturbation in the classical sense. The first-order slopes are then those of the isolated regimes (decoupled across regimes), and the switching enters the first order through a constant that comes from the derivative of the policy with respect to the tilt of \(P\), which RISE computes from the \(\sigma\)-equation of the first-order system. Syntax:
m = solve(m,'solve_perturbation_type','mw'); % tilt every chain
m = solve(m,'solve_perturbation_type',{'mw',{'pol'}}); % tilt the chain 'pol' only
m = solve(m,'solve_perturbation_type',{'mw',{'*none'}}); % no tilt: identical to 'm'
The cell form names the Markov chains whose off-diagonal probabilities
are tilted; the others keep their probabilities at \(\sigma=0\), as
under 'm'. Plain 'mw' tilts every chain. 'mw' and
'maih_waggoner' are the same value.
What to expect. The scheme is the natural one when the regimes are
distinct economies that last long, since each regime’s steady state is
genuinely a point the economy rests at for a long time, and it is the
scheme whose reference economy is deterministic. Two things follow from
the decoupling. The first-order slopes of a regime do not depend on the
transition probabilities, so a regime that is indeterminate in isolation
(a passive monetary policy) has several bounded first-order solutions
under 'mw' even when the switching model as a whole is determinate.
With the default solver setting RISE detects the decoupled system, uses
the eigenvalue solver regime by regime and reports the indeterminacy
(return code 21, as on the FRWZ NK model whose second regime is
passive); naming 'mfi' explicitly returns one of the bounded
solutions, the one the iteration selects. And
along the path \(P(\sigma)\) the rest points of the switching
economy move like \(p/(p+\kappa)\) in the switching probability
\(p\), a saturating function whose Taylor series in \(\sigma\)
converges only when \(p\) is small relative to the speed
\(\kappa\) at which the state adjusts: the higher orders of 'mw'
reconnect with the exact rest points when the regimes last hundreds of
periods and diverge when they last tens. The Euler-error test shows this
as a non-monotone verdict that does not respond to the shock scale.
1.7.4. The Foerster–Rubio-Ramírez–Waggoner–Zha perturbation ('frwz')
Foerster, Rubio-Ramírez, Waggoner and Zha (2016) perturb the switching parameters along with the shocks: \(\theta_i(\chi)=\bar\theta+ \chi(\theta_i-\bar\theta)\), where \(\bar\theta\) is the ergodic mean of the parameters, so that at the origin the regimes are identical and the economy has one steady state \(\bar x(\bar\theta)\). The expansion is a joint Taylor series in \((\sigma,\chi)\) around that point, evaluated at \((1,1)\). Syntax:
m = solve(m,'solve_perturbation_type',{'frwz',{'mu'}}); % perturb mu only
m = solve(m,'solve_perturbation_type','frwz'); % perturb every switching parameter
The cell form is the version the paper recommends: the partition names
the switching parameters that move the steady state, which are perturbed;
the other switching parameters keep their regime dependence, as under
'm'. Plain 'frwz' perturbs every switching parameter, which the
paper calls the naive perturbation. The distinction matters: a
persistence or a policy coefficient that switches by a large amount is a
poor perturbation variable, and on a model whose persistence switches
from 0.9 to 0.5 with a common steady state the naive form is
non-monotone in the order while the partitioned form is 'm' and
converges. The partition may be {'*all'}, {'*none'} or
{'*all_but', 'v1', ...}.
What to expect. FRWZ is a valid perturbation whose series converges on every model tested where the gap between steady states is moderate, and at higher orders it is the most accurate scheme on the growth model of the test suite. Its properties come with four consequences to know about.
The first order is regime-blind in the slopes. The parameters in the partition enter the first-order solution only through the regime-specific constants (the terms of order \(\chi\)); the slopes are those of the common-parameter economy and are the same in every regime. Regime-specific dynamics from a switching level, target or tax appear at order 2, through the cross terms in \(\chi x\). Estimation at first order, the common practice, therefore uses a solution in which the regimes differ by their intercepts only. On the growth model with a 5 percent productivity gap the two regimes’ slopes are identical under FRWZ to the last digit, while they differ by 0.13 (
'm'), 0.13 ('mt'), 0.17 ('mw') and 0.26 ({'m','scl'}) in their largest entry.The expansion point is a point no regime visits. The steady state of the ergodic-mean economy is between the regimes’ rest points, and the polynomial has to reach each regime’s rest point through the series in \(\chi\). The rest points are reproduced with an error of order \(g^{k+1}\) in the gap \(g\) at order \(k\), so they are only as good as the order.
The gap is a perturbation variable, with a radius of convergence. A large gap, in the parameter or in the steady state, puts \(\chi=1\) outside the radius and the series stops improving; the Euler-error test shows it as a
non-monotoneverdict that does not respond to the shock scale.The partition is a modeling choice. The user has to say which parameters are perturbed, and there is a version of the scheme for each choice; the steady-state-moving parameters are the recommended one.
One thing the scheme does that none of the others can: it does not need
the isolated steady states to exist. On the FRWZ RBC model with a
negative growth rate in one regime (\(\mu=-0.0337\)), that regime
has no steady state in isolation: the net return the Euler equation
requires, \(\beta^{-1}e^{(1-\upsilon)\mu}-1+\delta\), is
\(-0.038\), the capital stock that would deliver it is complex, and
'm', 'mw', 'bm', {'m','scl'} and 'mt' stop at the
steady-state stage with return code 1. {'frwz',{'mu'}} solves from
the steady state of the ergodic-mean economy (\(\bar\mu=0.0070\)),
which exists. The switching economy itself does have a rest point in
that regime, since agents expect the return of positive growth, and
{'m','scl'} reaches it through its Start option, a homotopy in the
parameter gap from the ergodic-mean steady state: at first order it
converges to rest points of 9.24 and 47.88 for the capital stock. But
with probabilities of staying of 0.75 and 0.5 the regimes last one to
four periods, the economy never gets near a rest point 40 units from
where it lives, and the SCL’s Euler error, \(10^{-2.5}\), is behind
FRWZ’s \(10^{-3.2}\); its higher orders do not converge there. Fast
switching is FRWZ’s domain, persistent regimes with a switching steady
state the SCL’s.
M with the self-consistent linearization ({'m','scl'})
Perturbation M scales only the future shocks and keeps the transition
matrix active in the first-order slopes. Its reference economy is the
shock-free switching economy: parameters switch, shocks are off. When
the steady state differs across regimes, that economy does not rest at
the isolated steady states: after a switch the state moves toward the
new steady state at the rate given by the policy slopes, and agents
anticipate further switches. Expanding around the isolated steady
states, with the lead of the pair \((i,j)\) evaluated at regime
\(j\)’s steady state, is then an expansion around points the
reference economy never visits. The first-order solution of 'm'
carries no constant, so its rest points are the isolated steady states
whatever the switching does, and its forward-looking residual does not
improve with the order of approximation.
The self-consistent linearization (SCL) is an option of perturbation M,
requested as {'m','scl'}. It keeps the same perturbation principle and
moves the expansion configuration: the anchors are the rest points \(\hat x_i\) of the
shock-free switching economy, and the derivatives of the pair
\((i,j)\) are evaluated at the transition point, the value of regime
\(j\)’s policy at regime \(i\)’s rest point. Rest points and
slopes are determined jointly by a fixed point (Anderson-accelerated
functional iteration); the inner problem at each iteration is the usual
coupled quadratic, so every regime-switching solver applies. The
\(\sigma\)-constant is zero by construction (certainty equivalence
at first order). With a common steady state the option returns exactly
plain 'm', at every order and at the cost of 'm': the rest configuration
is the steady state and every transition point is that same point, so the
solve hands over to the standard perturbation without an outer iteration
(report: outer 0, method 'common steady state'). With
P = I it returns 'mw' at first order. On a constant-parameter
model there is nothing to re-anchor: the request is accepted and
solve returns the 'm' solution. Optimal-policy models are
re-anchored like any other (see Optimal-policy models below).
At solve_order 2 and above the default higher orders
(HigherOrders 'curvature', described below) are one pass of the
standard higher-order engine from the first-order configuration: the rest
points stay at their first-order values, and an order-K solve costs the
first-order stage plus one standard order-K solve, the cost of 'm'’s
higher orders. The refinement 'joint' re-expands regime \(j\)’s
polynomial at regime \(i\)’s rest point (the Taylor shift) and solves
rest points, slopes and all higher-order coefficients as one fixed point,
through the toolbox’s recursive engine; under it the first-order block of
an order-2 solution is not the order-1 solution, because the rest
points and slopes are outputs of the closure and improve with the order.
The higher-order stages run only if the first-order block is mean-square
stable (return code 25 otherwise), and the returned solution passes the
same test at every order.
The options of the method live in one object,
rise.options.scl_options, and nowhere else: they are not fields of the
model options and they are refused with any other perturbation type. The
object is built with name-value pairs (tab completion works) and travels
inside the perturbation type, as the option of 'm':
m = solve(m,'solve_perturbation_type',{'m','scl'}); % defaults
o = rise.options.scl_options('MaxIter',500,'Display','iter');
m = solve(m,'solve_perturbation_type',{'m',o});
m = solve(m,'solve_perturbation_type',o); % same thing
The stored form is {'m',o}. The earlier spellings 'scl' and
{'scl',o} are accepted and mean the same thing.
Its properties follow MATLAB’s optimization options where a name exists:
MaxIter (300) and TolFun (1e-8) for the outer fixed point,
Algorithm ('anderson', the default, or 'picard'),
InitDamping (initial step of the Picard iteration), Display
('off', 'final', 'iter'), Continuation, Start and
HigherOrders (see below). The
previous solve’s rest configuration and policy jets are always reused as
the starting point when their dimensions match, which is what estimation
needs; there is no option for it. The solver report is in
model_data.state_space{1}.scl: outer iterations, method, residual of
the rest-point equations, displacement of the anchors, whether the warm
start was used, and the rest configuration xhat.
Because the steady state is the rest configuration, an output of the
solve, a steady-state-only request (solve_order 0 or
solve_derivatives_only) is refused under the SCL; solve at order 1
or above, or use plain 'm' for the isolated steady states. After a solve,
get(m,'sstate') returns the rest points.
Limits known at the time of writing: with very large gaps between rest
points (a quarter of the capital stock in the test model), or with
transition probabilities whose curvature is on the scale of the gap, the
outer fixed point may fail to converge from a cold start at order 3 and
above. The Continuation option (default true) then walks the
displacement carried by the higher-order feedback from 0 to 1 with
adaptive steps; if the fixed point disappears before the full shift the
solve returns retcode 29 (SCL_OUTER_NOT_CONVERGED) and the report
records the displacement fraction reached (mu_reached). Order 2
converges without continuation in all cases tested. Anticipated shocks
are supported at every order.
Where the rest-point iteration starts is the Start option: 'auto'
(the default) starts from the isolated steady states and, when a regime
has none and the steady-state stage fails, from the unique steady state
of the ergodic-mean economy, the point FRWZ expand around; 'isolated'
and 'ergodic' force one or the other. From the ergodic-mean point the
rest points can be far away, so the solve walks the switching parameters
from their ergodic mean, where the SCL is the standard perturbation, to
their regime values, warm-starting the outer fixed point at each step (a
homotopy in the parameter gap, with the same adaptive steps as the
displacement continuation). The report records the start (start),
whether the homotopy ran (gap_continuation) and the fraction of the
gap reached (mu_gap_reached). Start also accepts a numeric matrix
(endogenous variables by regimes, in the order of the endogenous
variables): an explicit starting rest configuration, which takes
precedence over the warm start and is reported as 'given'. It is the
device for exploring the branches of the rest-point equation, which can
have several solutions on a model with a peg regime (two, both
mean-square stable at first order, on the ZLB model of the SCL note with
two-quarter spells); a start of the wrong size is refused. On the growth model the two starts
reach the same fixed point to \(10^{-9}\); on FRWZ’s RBC model, where
the contraction regime has no isolated steady state, the first order
converges to rest points of 9.24 and 47.88 for the capital stock, 40
units from the start, while the higher orders do not converge.
What the solve does once and what it repeats: the isolated steady states are solved once, in the steady-state stage every perturbation type runs, and never again; they start the outer iteration, and the rest points move inside it by one Newton step per iteration at a negligible cost. What every outer iteration recomputes is the derivatives of the model at the transition configurations, the first-order block and, at order 2 and above, the higher-order engine. Profiled on the growth and NK models, the derivatives are 16 to 24 percent of a first-order solve (the inner first-order solves 23 to 38 percent), a third at order 2, and 15 to 20 percent at orders 3 and 4, where the engine’s right-hand sides and Sylvester solves are 50 to 75 percent. The cost is the number of outer iterations, 7 to 80, times the coefficient solves inside each.
How the higher orders are computed is the HigherOrders option;
'curvature' is the default and 'joint' the refinement.
'joint' is the Taylor-shift construction above: the rest points,
the first order and every higher order are one fixed point, each order
re-expanded at the transition points with the feedback of the orders
above it, which is what makes the residual fall with the order (growth
model with a 5 percent gap: \(-4.8\), \(-6.1\), \(-7.1\),
\(-8.1\) at orders 1 to 4, in \(\log_{10}\) of the Euler
error). Its cost is the number of outer iterations, 20 to 70 on the
models tested, each one a full order-K solve; the outer tolerance is a
modest lever (1e-6 instead of 1e-8 saves 10 to 30 percent of the
iterations at no cost in accuracy; at 1e-4 the growth model needs 48
instead of 72 iterations at order 4 and loses 0.7 of a decade).
'recursive'
solves the rest points and the first order as at order 1, then computes
the higher orders once, conditional on them, each order using the orders
below it re-expanded at the transition points and no feedback from
above: one order-K solve (order 4 of the NK model with capital: 18
seconds against about an hour and a half). What it buys is the accuracy
of order 1 with curvature added, not convergence in the order: on the
growth model \(-4.8\), \(-4.5\), \(-4.5\), \(-4.5\); on
FRWZ’s NK model \(-2.5\), \(-3.3\), \(-3.7\), \(-3.6\)
against \(-2.5\), \(-3.4\), \(-4.6\), \(-6.4\) joint; on
FRWZ’s RBC model its higher orders are not finite; on the NK model with
capital and a switching target it matches the joint scheme at order 2
(\(-4.07\) against \(-4.08\)) and falls behind from order 3
(\(-4.6\) against \(-6.0\) at order 4), and with a switching
capital tax (a 40 percent gap in the capital stock) it is behind from
order 2 (\(-3.2\) against \(-3.9\)). The feedback of the
higher orders into the rest points, about one percent of the capital
stock on the growth model, is what the joint fixed point pays for. The
report records the choice (higher_orders) and, for the recursive
variant, stages [1 K] with a single evaluation at the second
stage; the accuracy report labels the variant m{scl,recursive}.
'curvature' (the default) keeps that feedback and still costs one order-K solve: it
computes the higher orders as a perturbation in the curvature of the
model around the first-order SCL configuration. The rest points and the
first order are solved as at order 1 (first derivatives only), the
derivatives up to the solve order are evaluated once at the converged
transition points, and one pass of the standard higher-order engine
computes the orders 2 to K with the displacement between the rest points
carried by the \(\sigma\) column of the pair’s state transition for
the orders above 1, the first-order lead slope being composed without it
since its shift is part of the transition point (hops by default,
the recursive engine above order 5 or on request through
solve_perturbation_engine; the two agree to \(10^{-8}\)). The feedback of each order on the
constant and the slopes then comes out in the \(\sigma\) slots of
that order, as a variance correction does in the standard perturbation,
and the anchors stay at the first-order rest points: the held fixed point
of the polynomial moves where the joint fixed point moves its rest
points. The construction is a perturbation in the strict sense (the
model linearized at the SCL configuration is solved exactly by the
first-order SCL, and the corrections are linear at every order), it has
the same consistency order as the joint fixed point, it nests the
standard perturbation with a common steady state, and it has no fixed
point to fold; what can fail is the series, and the report gives the
largest coefficient by order (coefficient_norm), which falls with the
order when the series converges. On the growth model with a 5 percent gap
it gives \(-4.8\), \(-6.2\), \(-7.1\), \(-8.0\) at orders
1 to 4 against \(-4.8\), \(-6.1\), \(-7.1\), \(-8.1\)
joint, in about one second at every order instead of 74 outer
iterations at order 4; with a 20 percent gap it is monotone through order
4 (\(-5.2\)) where the joint fixed point folds; on FRWZ’s NK model it
trails the joint scheme by 0.3 to 0.9 of a decade at orders 2 to 4
(\(-5.5\) against \(-6.4\) at order 4) and stays three decades
ahead of FRWZ’s own partitioned expansion; on FRWZ’s RBC model, whose
regimes last two to four periods, its series diverges at order 4, where
the joint scheme does not solve above order 1 and FRWZ’s is the scheme to
use. The report records higher_orders 'curvature', stages
1 and the outer iterations of the first-order stage; the accuracy
report labels the variant m{scl}.
Note
Under the default 'maih' perturbation, RISE auto-declares
several auxiliary parameters (iota_frwz_*, ss_frwz_*,
perturbator, …) that are not used in the model. Their
absence from your calibration triggers a benign
"1(incomplete!)" warning at parse time. This warning is not
an error; do not chase it. Chase the retcode.
The Barthélemy–Marx perturbation ('bm')
Barthélemy and Marx (2016, Solving endogenous regime switching models)
perturb the shock scale only, as 'm' does, and define a
regime-dependent steady state by the P-weighted condition of their
Assumption 2: for every regime \(i\),
the lead of the pair \((i,j)\) at regime \(j\)’s own steady
state, the current variables at regime \(i\)’s, and the lag at the
steady state of any regime \(k\). Their expansion is then the
ordinary perturbation at that configuration: pairwise derivatives at
\((\bar z_j,\bar z_i,\bar z_i)\), the coupled first-order solve
without a constant, the standard higher orders. In RISE, 'bm' is
exactly that: a steady-state stage that solves the condition by Newton
from the isolated steady states (with the lag at the current regime’s
anchor), writes the anchors into the steady-state slot, and hands over to
the 'm' machinery. The self-consistent linearization is not involved,
there is no Taylor shift, and 'bm' takes no partition.
Two facts locate the scheme. With a common steady state it is 'm' to
the last digit (and so on a constant-parameter model, like {'m','scl'}).
When no lagged variable has a switching steady state, or when the
lagged variables enter only through combinations invariant to the lag
regime (their own model divides the lagged rate by the lagged regime’s
target), the transition point of a pair is the next regime’s steady
state, the depth-zero and depth-one closures coincide, and 'bm'
equals {'m','scl'} (checked at orders 1 and 2 on a three-equation NK model
with a switching target). Outside that class the clause “for any regime
\(k\)” of Assumption 2 cannot hold, which the authors state; the
report model_data.state_space{1}.bm carries the residual of that
clause as an \(h\times h\) matrix (assumption2_residual, entry
\((i,k)\) the largest residual of regime \(i\)’s equations with
the lag at regime \(k\)’s anchor), so the distance from their class
is visible. The condition with the lag at the current regime’s anchor may
also have no solution: on the growth model with a switching productivity
level it disappears at a gap of 2 to 3 percent, and the solve then returns
retcode 30 (BM_ANCHOR_NOT_FOUND). solve_derivatives_only is
refused under 'bm', since the derivatives belong at the P-weighted
anchors, which the solve computes; sstate returns the isolated steady
states, the starting point, and get(m,'sstate') after a solve returns
the anchors.
Optimal-policy models
A perturbation type does not depend on where the equations come from. The
first-order conditions that RISE derives from an @optimization_problem
are equations in the variables and the multipliers like any others, and
{'m','scl'} and 'bm' re-anchor them as they re-anchor any model:
under commitment, under discretion and wherever the commitment parameter
switches, at every order. When a switching
parameter moves the steady state (an inflation target, a loss weight, a
parameter of the constraints), the rest points of the multipliers move
with those of the other variables, and with a common steady state both
types return plain 'm'.
Discretion, and every regime in which the commitment parameter is below
one, adds one object: the first-order conditions carry the policy of next
period’s regime as a function of today’s state variables, and its
derivatives (the policy functions written f1942 in the generated
equations). Under 'm' and 'bm' the lead of the pair \((i,j)\)
sits at regime \(j\)’s own anchor, and so do these policy functions.
Under {'m','scl'} the lead of the pair is regime \(j\)’s policy at
regime \(i\)’s rest point, and the policy functions are taken at that
same point: regime \(j\)’s polynomial is re-expanded there, as every
other function of the variables is evaluated at the pair’s point. At
first order the slopes of a linear policy are the same everywhere and only
its level moves; from order 2 its derivatives move too, by the curvature
of the policy times the gap between the rest points. The replanning loop
of discretion runs around the self-consistent linearization unchanged:
each pass solves the rest configuration and the coefficients given the
previous pass’s policy functions, and the loop stops when they reproduce
themselves.
The first-order solves inside the fixed point use the solver the model is
configured with (rise.engine.dsge_tools.solve.configured_solver), the
one solve uses, whichever it is. A solver with requirements on the
derivatives it is given applies them there as anywhere else, and says so
in its own terms when they are not met: see the limits of each solver in
Optimal policy.
Testing a perturbation: the Euler error against the order
A perturbation is only as good as its convergence: along a simulated
path, the residual of the model’s own equations must fall as the order
of approximation rises. rise.engine.dsge_tools.accuracy.perturbation_report
solves a model at several orders and perturbation types, simulates one
common path of regimes and shocks, measures the Euler residuals with the
paradigm-free accuracy engine, and reports the forward-looking equations
separately from the static ones (static identities gain curvature at
every order under every scheme and would hide a floor):
m = dsge_model('mymodel', 'solve_order', 3);
rep = rise.engine.dsge_tools.accuracy.perturbation_report(m, ...
'types', {'m','mw',{'m','scl'}}, 'orders', 1:3, 'shock_scales', [1 0.5 0.25]);
Per type and shock scale the verdict on the forward-looking column is
one of three: monotone (the error falls with the order), flat (a
level error that no Taylor term removes: the expansion point is not a
rest point of the scheme’s own reference economy), non-monotone (the
error rises at some order or the path blows up). The shock-scaling rerun
simulates the same solutions with the realized shocks scaled down; a
non-monotone verdict that turns monotone at a smaller scale is a
radius-of-convergence problem, a flat verdict that stays flat at every
scale is an expansion-point problem. rep.table holds the numbers,
latex_file writes them as a tabular. The model must be constructed
with a derivative order at least equal to the largest order requested.
1.7.5. Experimental types: 'mt' and 'mwt'
Two types built on the SCL machinery with the anchors frozen at the
isolated steady states, kept for diagnosis and not recommended for
production. 'mt' is perturbation M with every derivative of the pair
\((i,j)\) evaluated at the transition point, the residual of the
rest-point equations carried by the \(\sigma\)-constant, and the
higher orders Taylor-shifted like the SCL’s; it is the consistent
all-order form of a level correction to 'm', and it converges with
the order like FRWZ on the growth model but not on the NK model with a
switching capital tax, where only re-anchoring works. 'mwt' is the
Maih–Waggoner perturbation with the same transition-point evaluation and
shift; the tilt analysis above applies to it unchanged, and it is
non-monotone in the order wherever 'mw' is. Both take the same
syntax as 'm' and no partition, both equal 'm' with a common
steady state, and both are the standard perturbation on a
constant-parameter model.
1.7.6. Which type to use
The steady state does not switch (volatilities, policy-rule coefficients, persistences):
'm'. Every other type returns the same solution at a higher cost, or, for'mw', a different and less accurate one.The steady state switches and the model is solved at first order for estimation:
{'m','scl'}. It is the only scheme whose first order has regime-specific slopes, no level error and no constant, and whose rest points are those of the switching economy; on the models of the test suite it is the most accurate first-order scheme whenever the gap matters. Its cost is a dozen first-order solves, four to six times'm'per draw along an estimation random walk (0.10 to 0.19 s warm against 0.02 to 0.04 s on the test models), the warm start being kept automatically across parameter changes; with a common steady state it costs nothing, since it hands over to'm'.The steady state switches and the higher orders matter:
{'m','scl'}, whose default higher orders cost what'm'’s cost (order 2 up to about 200 variables, order 3 up to about 50, order 4 up to about 16 on a 64 GB machine, the limits of the standard engine), or{'frwz', partition}. FRWZ converges faster with the order on the growth model and wins when regimes switch every few periods; the SCL is ahead on the New Keynesian models and when the real gap is large (a switching capital tax with a 40 percent gap in the capital stock). Run both through the Euler-error test on the model at hand.A regime has no isolated steady state:
{'frwz', partition}, or{'m','scl'}with its defaultStart'auto', which starts from the ergodic-mean steady state and walks the parameter gap (first order only, so far).Regimes that switch every few periods:
{'frwz', partition}. The rest points of the switching economy are then far from where the economy lives, and the ergodic-mean anchoring is the better one, as on FRWZ’s RBC model.Regimes that last decades and are meant as distinct economies:
'mw', whose first order is the isolated regimes’ and whose higher orders reconnect in that limit only.'bm'reproduces the Barthélemy–Marx scheme for comparison; inside their class (no predetermined variable with a switching steady state) it equals{'m','scl'}, outside it its anchors may not exist.
The default. Plain 'm' remains the default of the toolbox. Because
its SCL option returns plain 'm'’s solution at 'm'’s cost
whenever the steady state does not switch, and the rest points of the
switching economy with regime-specific slopes when it does, it is the
candidate for the future default of 'm'. Its higher orders now cost
what 'm'’s cost; what it still lacks is a cheaper first-order stage
(two and a half to ten times 'm' at first order, from the outer
iterations), which a joint Newton on rest points and coefficients is
expected to supply. The experimental 'mt'
is not a candidate: it is not a perturbation in the strict sense, it is
non-monotone on the NK model with the switching tax, and its order-2
iteration fails from about 12 variables on.
1.7.7. The evidence
The verdicts of the Euler-error test on the models of the SCL project and on FRWZ’s own examples, forward-looking equations, full-size shocks, orders 1 to 3 (1 to 4 on the growth model). The numbers are \(\log_{10}\) of the mean absolute residual; the growth model has a switching productivity level (A: common level, switching persistence; B: 5 percent gap; C: 20 percent gap), the NK model with capital a switching inflation target (B) or capital tax (F), the FRWZ NK model a switching growth rate and Taylor coefficient with a passive regime, the FRWZ RBC model a switching growth rate, persistence and volatility with no isolated steady state in one regime, the BM NK model (Barthélemy and Marx, Section 3) a switching Taylor response and target with the targeted rate set by the P-weighted Fisher relation, with constant and with their endogenous, inflation-dependent probabilities.
Model |
|
|
|
|
|
|
|---|---|---|---|---|---|---|
growth A |
monotone, −5.5 to −9.7 |
non-monotone |
= |
= |
monotone, −5.5 to −10.1 |
= |
growth B |
flat, −3.0 |
blows up |
monotone, −5.1 to −9.2 |
no anchor |
monotone, −4.9 to −8.1 |
monotone, −4.3 to −8.5 |
growth C |
flat, −2.6 |
blows up |
monotone, −4.3 to −7.1 |
no anchor |
monotone to order 3, fold at 4 |
monotone, −3.3 to −5.9 |
NK B |
flat, −2.2 |
non-monotone |
monotone, −3.4 to −5.1 |
flat, −2.9 |
monotone, −3.4 to −5.2 |
monotone, −3.4 to −5.2 |
NK F |
non-monotone |
blows up |
monotone, −2.7 to −3.6 |
flat, −1.8 |
monotone, −3.0 to −4.7 |
non-monotone |
FRWZ NK |
flat, −1.2 |
fails (code 21) |
monotone, −1.2 to −2.0 (naive form non-monotone, −2.2 to −1.7) |
flat, −1.2 |
monotone, −2.5 to −4.6 |
monotone, −1.4 to −2.9 |
FRWZ RBC |
no steady state |
no steady state |
monotone, −3.2 to −4.5 |
no steady state |
order 1 only, −2.5 ( |
no steady state |
BM NK, constant P |
flat, −2.4 |
non-monotone |
monotone, −4.7 to −6.3 |
flat, −4.5 to −4.7 |
monotone, −4.8 to −6.5 |
monotone, −4.1 to −5.6 |
BM NK, endogenous P |
flat, −2.3 |
explodes |
fails (code 3) |
monotone, −4.6 to −5.1 |
monotone, −4.8 to −6.1 |
flat, −3.2 to −3.5 |
Two readings. Where the steady state switches, {'m','scl'} is the most
accurate first-order scheme on every model (NK F, FRWZ NK by more than a
decade; growth B and NK B within a few hundredths of FRWZ), and at
higher orders it converges wherever it solves, ahead of FRWZ on the NK
models and behind it on the growth model. And on FRWZ’s own NK model the
rest points of the interest rate under {'m','scl'} and 'mt' converge
with the order to the same pair (1.0402, 1.0298), the rest configuration
of the switching economy, while FRWZ’s partitioned form sits at (1.0225,
1.0114), which is why its Euler error stays two and a half decades behind
at order 3. On FRWZ’s RBC model, whose regimes last one to four periods,
the order is reversed: the SCL reaches the rest points of the switching
economy only through the parameter-gap homotopy, sits 0.6 of a decade
behind FRWZ at first order, and its higher orders fail; fast switching is
FRWZ’s domain. All first-order solutions that solve are mean-square
stable.
1.7.8. First-order solvers and the types
The first-order solve of a switching model is a coupled quadratic system,
and the solver option chooses the algorithm: 'mfi' (functional
iteration, the default), 'mafia' (the same map with Anderson
acceleration), 'mnk' and 'mn' (Newton, with or without the
Kronecker form), 'mfi_full', 'mnk_full' and 'mn_full' (the
same on the full state vector) and 'fwz' (the Newton system of
Farmer, Waggoner and Zha). Every perturbation type runs on every solver,
because the types change the matrices of the coupled system and not the
system itself; {'m','scl'} uses the chosen solver for its initial and final
first-order solves and its own Newton for the coupled solves inside the
outer iteration. What differs across solvers is which solution they land
on when the system has several, and the test suite’s matrix of types by
solvers (models/dsge/solving and the SCL project’s battery) shows
three patterns.
On the growth model with a 5 percent productivity gap, only the functional iterations (
'mfi','mfi_full') return the mean-square-stable solution for'm',{'m','scl'}and'mt'; the Newton solvers and'mafia'converge to a solution that fails the stability test (return code 25). Functional iteration has the contraction that selects the stable solution; Newton converges to the root nearest its start.On the NK model with capital, every solver except
'fwz'returns the same solution for every type (to \(10^{-7}\), the Newton solvers’ tolerance, and \(10^{-10}\) under{'m','scl'}, which tightens the inner tolerance).On the FRWZ NK model whose second regime is passive, the coupled system has more than one mean-square-stable solution under the transition-point types:
'fwz'returns a solution different from the other solvers’ for{'m','scl'},'mt'and'mwt'(and the same one for'm'), and the plain Newton solvers'mn'and'mn_full'do not converge for{'m','scl'}(return code 29). Both solutions pass the stability test. Which one is the relevant equilibrium is a question the solver cannot settle; theContinuationoption of{'m','scl'}and a warm start from a known solution are the tools for keeping a solver on one branch.
The practical rule: keep 'mfi' unless it is slow, check the
return code, and when a model may have several stable solutions,
compare two solvers before trusting one.