24. Regimes in generalized responses
A generalized impulse response is the average, over many simulations, of
the difference between a path with the impulse and a path without it. In
RISE it is irf with irf_type = 'girf', averaged over irf_draws
simulations; the other shocks are drawn and are the same on both paths of
a simulation, and the constraint-enforcing shocks are not drawn. With
irf_type empty (the default), irf computes a generalized response
when the order of the responses is above one and irf_draws is above
one; at first order, ask for 'girf'. In a switching model the regimes
of the two paths are part of the experiment.
24.1. Dates and the starting regime
Date 0 of the responses is the date before the impulse; with the default
irf_shock_date = 1 the impulse hits at date 1 (later dates: see
Surprises and announcements).
Responses that start from a regime and let the regimes move need
irf_regime_specific = false. The default, true, computes one
response per regime with that regime held in every period.
irf_initial_conditions.regime is the regime at date 0. The regimes of
the following dates are drawn from the transition probabilities, or set
by simul_regime. A starting regime with regime-specific responses is
an error (RISE:irf:startingRegimeIsRegimeSpecific).
24.2. The regime at impact
The regime of date 1 is drawn from the row of the date-0 regime of the
transition matrix, evaluated at the date-0 state. The impulse enters at
date 1, so it cannot move that draw: the impact regime is the same on the
two paths. To fix it, give the regimes as numbers in simul_regime:
start = struct('endogenous', struct('Y', 0), 'regime', 1);
out = irf(m, irf_type = 'girf', irf_draws = 2000, irf_periods = 3, ...
irf_shock_sign = 100, irf_regime_specific = false, ...
irf_initial_conditions = start, ...
irf_girf_regime_uncertainty = true, ...
simul_regime = [1, 2, NaN]);
Entry 1 of simul_regime is date 0, entry 2 is date 1, and dates after
the last entry take its value: [r0, j, NaN] starts in r0, puts the
impulse in regime j and draws the later regimes; a last entry that is a
number holds that regime to the end. With a delayed impulse,
irf_shock_date = s, the impact regime is entry s+1:
[1, NaN, 2, NaN] with irf_shock_date = 2 puts the impulse in
regime 2, in a model solved with solve_shock_horizon of at least 1.
Numbers in simul_regime hold on both paths. A first entry that differs
from irf_initial_conditions.regime is an error
(RISE:irf:startingRegimeConflict); a NaN first entry takes the
starting regime from irf_initial_conditions.
In expectation, the response with the impact regime drawn is the average of the responses with the impact regime fixed, weighted by the probabilities of the impact regimes.
24.3. The regimes of the two paths
irf_girf_regime_uncertainty decides how the path without the impulse
gets its regimes.
Value |
The path without the impulse |
|---|---|
|
is given the regimes of the path with the impulse. The two paths are in the same regime at every date, and whatever the impulse does to the regime probabilities is left out of the response. |
|
takes the same uniform number as the path with the impulse at each date of the joint regime process (all the chains together). Each path turns that number into a regime through its own transition probabilities, evaluated at its own state. |
Under true the two paths part only where the impulse has moved the
transition probabilities: a date at which the two paths draw from the same
row of probabilities gives them the same regime. In a model with several
chains the uniform number selects a regime of the joint process, not one
regime per chain. Each path keeps its own regime law, so the expected
response is that of independent regime draws, while a difference between
the regimes of the two paths comes from the impulse and not from two
unrelated draws. With constant transition probabilities the two paths are
in the same regime at every date under true as well: true and
false are the same experiment. Dates fixed by simul_regime keep
their place among the uniform numbers, so fixing a date does not change
the draws of the others.
Under true the uniform numbers are taken by RISE’s own simulation
engines. A function handle in the simulator option draws its own
regimes and cannot take them: it is refused
(RISE:irf:uncoupledSimulator).
24.4. Draws and units
irf_draws is the number of paired differences averaged; it does not
change the shape of the output. The draws come from MATLAB’s global random
stream: seed it with rng before a call to repeat that call’s draws.
out.E.Y is a ts of the response of Y to the impulse in E,
with one row per date from 0 to irf_periods; at date 0 both paths are
at the same starting point and the response is zero. irf_shock_sign
is the size of the impulse in standard deviations of the shock. In
\(Y_t = c(s_t) + \sigma E_t\) below, the impulse moves \(Y\) by
irf_shock_sign times \(\sigma\) on impact; a loading that switches
would give a different impact in each regime. Responses are in the units
of the variables, and in logs for the variables declared in logs.
24.5. An example that can be counted by hand
The tutorial rise-modern-tutorials/WorkingWithAModel/girf_regimes
uses
with regime 2 absorbing and a probability of entering it of 0.2 where
\(Y\) is below 0.5 and 0.8 above (a steep logistic in
@transition_functions). \(\sigma = 0.01\) and the impulse is
irf_shock_sign = 100 standard deviations of \(E\), so it moves
\(Y\) by exactly one and the other draws of \(E\) never take
\(Y\) across 0.5. The responses start in regime 1 at \(Y = 0\).
Date 1: both paths draw regime 2 with probability 0.2; the response is the impulse itself, 1.
Date 2: from regime 1, the path with the impulse enters regime 2 with probability 0.8 and the path without it with 0.2. The response is \(0.8 \times (0.8-0.2) = 0.48\).
Date 3: \(0.8 \times 0.6 \times 0.8 = 0.384\).
With 2,000 draws (rng(1,'twister') before each call), RISE returns:
Response of Y |
Date 1 |
Date 2 |
Date 3 |
|---|---|---|---|
|
1.000 |
0.000 |
0.000 |
|
1.000 |
0.484 |
0.373 |
|
1.000 |
0.602 |
0.467 |
|
1.000 |
0.000 |
0.000 |
The numbers are in the units of \(Y\). With one draw at a time, each
paired difference under true is 0 or 1, never -1: where the two paths
are in different regimes, the path with the impulse is the one in regime
2, because the shared uniform fell between the two entry probabilities.
Weighting the two fixed-impact rows by 0.8 and 0.2 gives back the row with
the impact regime drawn, up to simulation noise (0.482 and 0.374).
The tutorial also runs a linear model with constant transition probabilities, \(Y_t = c(s_t) + 0.5\,Y_{t-1} + E_t\), on which copied regimes and shared draws give the same response, 1, 0.5 and 0.25 at dates 1 to 3.