23. Impulse responses from an observed history
An impulse response is the difference between a path with the impulse and a path without it. Where both paths start matters whenever the responses are not the same everywhere: in a solution of order two or more, when an occasionally-binding constraint may bind, or when the regimes switch with probabilities that depend on the state. In a first-order solution with constant parameters and no constraint, the response does not depend on the starting point.
irf starts both paths from the values in
irf_initial_conditions.endogenous. That field takes one number per
variable, or an observed history: the values of the variables on the
dates before the impulse, each lag the model holds read at its own date.
23.1. The call
initial = struct('endogenous', db, 'date', '2000Q4');
[r, retcode] = irf(m, irf_type = 'irf', irf_shock_list = {'E'}, ...
irf_periods = 4, irf_initial_conditions = initial);
Field of |
Meaning |
|---|---|
|
the history: a |
|
the date before the impulse, in the history and with its frequency.
Default: the last date of the history. For an undated history, a
number on the history’s own dates: in a history built with
|
|
the regime at that date. Optional: a history with a series named
|
The date before the impulse is date 0 of the responses; with the default
irf_shock_date = 1 the impulse hits at date 1 (later dates: see
Surprises and announcements).
The responses are a ts that starts at 0, not on the dates of the
history: entry 1 is date 0, where every response is zero, and entry 2 is
the impact. The response of a variable declared in logs is a log
deviation from the path without the impulse; for a small response, 100
times it is close to a percent deviation. The other responses are in the
units of their variables.
A structure of numbers keeps its meaning: each variable it names starts
at that value, and every lag the model holds beyond the first, like the
variables not named, starts at the steady state. A structure that mixes
numbers and ts is an error (RISE:irf:mixedInitialConditions),
and so is a date given without a history
(RISE:irf:dateWithoutHistory).
23.2. What is read from the history
Each declared endogenous variable of the history starts at its value at the date before the impulse.
Each lag the model holds is read at its own date. With
Z{-3}in an equation,Zis read at that date and at the two dates before it; the lags that only the transition probabilities hold (@transition_functions) are read the same way.The lags of an exogenous variable of the history (
D{-1}orD{-2}in an equation) are read the same way. Its values at the date before the impulse keep their announcement pages; a nonzero value announced beyond the shock’s own anticipation horizon (solve_shock_horizon) is an error (RISE:irf:historyExceedsShockHorizon).Only page 1 of the history supplies endogenous values.
Both paths, with and without the impulse, start from these values. For a
generalized response (irf_type = 'girf') the draws are the same on the
two paths, as from any other starting point. At order two or more with
irf_draws above one, the default irf_type is 'girf': ask for
'irf' to get the response without draws.
Not read:
the series of the history that are not variables of the model, and the auxiliary variables the model creates for its lags, even when the history has a series of that name: the lags come from the variable itself;
the variables absent from the history: they start at the steady state;
the states that are not declared variables, such as the multipliers of a policy problem, even when the history has a series for them: they start at the steady state. The history sets initial values; it does not filter or estimate the states it does not observe.
In a switching model, the starting regime is the regime field, else
the value of the history’s regime series at the date before the
impulse, else it is drawn or set by simul_regime. A starting regime
needs irf_regime_specific = false; regime-specific responses hold each
regime in every period and do not read the regime series. See
Regimes in generalized responses for the regime at impact.
23.3. Missing values and other refusals
A value the model needs and the history lacks is an error that names the
variable and the date: a history shorter than the deepest lag, or a
NaN at a date the model reads. Such a value is not left at the steady
state. A NaN at a date the model does not read is ignored.
Error |
When |
|---|---|
|
a value the model needs is missing or not finite |
|
|
|
|
|
the history has none of the variables of the model |
|
a variable declared in logs has a value at or below zero at a date read |
|
an exogenous value is announced beyond its shock’s horizon |
|
a starting regime with |
23.4. An example with a closed form
The tutorial rise-modern-tutorials/WorkingWithAModel/irf_from_history
uses a state whose response to its innovation E depends on its own
last three values and on the last two values of an exogenous driver D:
The model is quadratic, so its second-order solution is exact. From a
history that ends at date \(T\), the impact response to one standard
deviation of E is
\(s + c_1 Z_T + c_2 Z_{T-1} + c_3 Z_{T-2} + d_1 D_T + d_2 D_{T-1}\),
and the response decays at the rate \(\rho\) afterwards. With
\(\rho = 0.5\), \(c = (0.2, -0.3, 0.7)\), \(d = (0.15, -0.25)\),
\(s = 0.1\) (scale in the model file) and five quarters of
history,
\(Z = (0.9, -1.1, 0.4, 1.3, -0.6)\) and
\(D = (0.3, -0.2, 0.5, -0.7, 0.8)\) from 2000Q1 to 2001Q1, RISE
returns, in the units of Z:
Starting point |
Impact response |
Closed form |
|---|---|---|
the history, to 2001Q1 (the default) |
0.1650 |
0.1650 |
the history, |
-0.7600 |
-0.7600 |
one number, |
-0.0200 |
\(s + c_1 Z_T = -0.0200\) |
From 2001Q1 the response is 0.0825 at date 2, half the impact.
Starting at 2000Q4 gives the same numbers as the history cut at that date.
The single number leaves \(Z_{T-1}\), \(Z_{T-2}\) and the driver
at the steady state. X follows the law of Z in logs; its history
is given in levels, and its response, a log deviation, is the same as
that of Z.
The tutorial ends with a two-regime model whose transition probabilities
depend on a driver two dates back, a lag that only
@transition_functions holds: the regime the impulse hits in, and with
it the response, is decided by the history.