Next: Calibrated Smoother, Previous: Model Comparison, Up: The Model file [Contents][Index]
Description
This command computes the historical shock decomposition for a given sample based on
the Kalman smoother, i.e. it decomposes the historical deviations of the endogenous
variables from their respective steady state values into the contribution coming
from the various shocks. The variable_names
provided govern for which
variables the decomposition is plotted.
Note that this command must come after either estimation
(in case
of an estimated model) or stoch_simul
(in case of a calibrated
model).
Options
parameter_set = calibration
| prior_mode
| prior_mean
| posterior_mode
| posterior_mean
| posterior_median
| mle_mode
Specify the parameter set to use for running the smoother. Note that the
parameter set used in subsequent commands like stoch_simul
will be set
to the specified parameter_set
. Default value: posterior_mean
if
Metropolis has been run, mle_mode
if MLE has been run.
datafile = FILENAME
See datafile. Useful when computing the shock decomposition on a calibrated model.
first_obs = INTEGER
See first_obs.
nobs = INTEGER
See nobs.
use_shock_groups [= STRING]
Uses shock grouping defined by the string instead of individual shocks in the decomposition. The groups of shocks are defined in the shock_groups block.
colormap = STRING
Controls the colormap used for the shocks decomposition
graphs. See colormap
in Matlab/Octave manual for valid arguments.
nograph
See nograph. Suppresses the display and creation only within the
shock_decomposition
-command, but does not affect other commands.
See plot_shock_decomposition for plotting graphs.
init_state = BOOLEAN
If equal to , the shock decomposition is computed conditional on the smoothed state variables in period , i.e. the smoothed shocks starting in period are used. If equal to , the shock decomposition is computed conditional on the smoothed state variables in period . Default:
Output
The results are stored in the field oo_.shock_decomposition
, which is a three
dimensional array. The first dimension contains the M_.endo_nbr
endogenous variables.
The second dimension stores
in the first M_.exo_nbr
columns the contribution of the respective shocks.
Column M_.exo_nbr+1
stores the contribution of the initial conditions,
while column M_.exo_nbr+2
stores the smoothed value of the respective
endogenous variable in deviations from their steady state, i.e. the mean and trends are
subtracted. The third dimension stores the time periods. Both the variables
and shocks are stored in the order of declaration, i.e. M_.endo_names
and
M_.exo_names
, respectively.
Shocks can be regrouped for the purpose of shock decomposition. The composition
of the shock groups is written in a block delimited by shock_groups
and
end
.
Each line defines a group of shocks as a list of exogenous variables:
SHOCK_GROUP_NAME = VARIABLE_1 [[,] VARIABLE_2 [,]…]; 'SHOCK GROUP NAME' = VARIABLE_1 [[,] VARIABLE_2 [,]…];
Options
name = NAME
Specifies a name for the following definition of shock groups. It is possible
to use several shock_groups
blocks in a model file, each grouping being
identified by a different name. This name must in turn be used in the
shock_decomposition
command.
Example
varexo e_a, e_b, e_c, e_d; … shock_groups(name=group1); supply = e_a, e_b; 'aggregate demand' = e_c, e_d; end; shock_decomposition(use_shock_groups=group1);
This example defines a shock grouping with the name group1
, containing a set of supply and demand shocks
and conducts the shock decomposition for these two groups.
Description
This command computes the realtime historical shock decomposition for a given sample based on the Kalman smoother. For each period , it recursively computes three objects:
presample
.
vintage>0
and smaller than nobs
,
the decomposition is conducted of the forecast revision
.
Like shock_decomposition it decomposes the historical deviations of the endogenous
variables from their respective steady state values into the contribution coming
from the various shocks. The variable_names
provided govern for which
variables the decomposition is plotted.
Note that this command must come after either estimation
(in case
of an estimated model) or stoch_simul
(in case of a calibrated
model).
Options
parameter_set = calibration
| prior_mode
| prior_mean
| posterior_mode
| posterior_mean
| posterior_median
| mle_mode
See parameter_set.
datafile = FILENAME
first_obs = INTEGER
See first_obs.
nobs = INTEGER
See nobs.
use_shock_groups [= STRING]
See use_shock_groups.
colormap = STRING
See colormap.
nograph
See nograph. Only shock decompositions are computed and stored in oo_.realtime_shock_decomposition
,
oo_.conditional_shock_decomposition
and oo_.realtime_forecast_shock_decomposition
but no plot is made
(See plot_shock_decomposition).
presample = INTEGER
Data point above which recursive realtime shock decompositions are computed, i.e. for .
forecast = INTEGER
Compute shock decompositions up to periods, i.e. get shock contributions to k-step ahead forecasts.
save_realtime = INTEGER_VECTOR
Choose for which vintages to save the full realtime shock decomposition. Default: .
Output
Structure storing the results of realtime historical decompositions. Fields are three-dimensional arrays with
the first two dimension equal to the ones of oo_.shock_decomposition. The third dimension stores the time
periods and is therefore of size T+forecast
. Fields are of the form:
oo_.realtime_shock_decomposition.OBJECT
where OBJECT is one of the following:
pool
Stores the pooled decomposition, i.e. for every realtime shock decomposition terminal period
it collects the last period’s decomposition
(see also plot_shock_decomposition). The third dimension of the array will have size
nobs+forecast
.
time_*
Stores the vintages of realtime historical shock decompositions if save_realtime
is used. For example, if
save_realtime=[5]
and forecast=8
, the third dimension will be of size 13.
Structure storing the results of realtime conditional decompositions. Fields are of the form:
oo_.realtime_conditional_shock_decomposition.OBJECT
where OBJECT is one of the following:
pool
Stores the pooled realtime conditional shock decomposition, i.e. collects the decompositions of
for the terminal periods
.
The third dimension is of size nobs
.
time_*
Store the vintages of -step conditional forecast shock decompositions , for
. See vintage. The third dimension is of size 1+forecast
.
Structure storing the results of realtime forecast decompositions. Fields are of the form:
oo_.realtime_forecast_shock_decomposition.OBJECT
where OBJECT is one of the following:
pool
Stores the pooled realtime forecast decomposition of the -step ahead effect of shocks on the -step ahead prediction, i.e. .
time_*
Stores the vintages of -step out-of-sample forecast shock decompositions, i.e. , for . See vintage.
Description
This command plots the historical shock decomposition already computed by
shock_decomposition
or realtime_shock_decomposition
. For that reason,
it must come after one of these commands. The variable_names
provided govern which
variables the decomposition is plotted for.
Further note that, unlike the majority of Dynare commands, the options
specified below are overwritten with their defaults before every call to
plot_shock_decomposition
. Hence, if you want to reuse an option in a
subsequent call to plot_shock_decomposition
, you must pass it to the
command again.
Options
use_shock_groups [= STRING]
See use_shock_groups.
colormap = STRING
See colormap.
nodisplay
See nodisplay.
graph_format = FORMAT
graph_format = ( FORMAT, FORMAT… )
See graph_format.
detail_plot
Plots shock contributions using subplots, one per shock (or group of shocks). Default: not activated
interactive
Under MATLAB, add uimenus for detailed group plots. Default: not activated
screen_shocks
For large models (i.e. for models with more than
shocks), plots only the shocks that have the largest historical contribution
for chosen selected variable_names
. Historical contribution is ranked
by the mean absolute value of all historical contributions.
steadystate
If passed, the the -axis value of the zero line in the shock decomposition plot is translated to the steady state level. Default: not activated
type = qoq
| yoy
| aoa
For quarterly data, valid arguments are: qoq
for
quarter-on-quarter plots, yoy
for year-on-year plots of growth rates,
aoa
for annualized variables, i.e. the value in the last quarter for
each year is plotted. Default value: empty
, i.e. standard
period-on-period plots (qoq
for quarterly data).
fig_name = STRING
Specifies a user-defined keyword to be appended to the
default figure name set by plot_shock_decomposition
. This can avoid to
overwrite plots in case of sequential calls to plot_shock_decomposition
.
write_xls
Saves shock decompositions to Excel-file in the main directory, named
FILENAME_shock_decomposition_TYPE_FIG_NAME.xls
. This option requires your system to be
configured to be able to write Excel files.^{7}
realtime = INTEGER
Which kind of shock decomposition to plot. INTEGER can take following values:
0
: standard historical shock decomposition. See shock_decomposition.
1
: realtime historical shock decomposition. See realtime_shock_decomposition.
2
: conditional realtime shock decomposition. See realtime_shock_decomposition.
3
: realtime forecast shock decomposition. See realtime_shock_decomposition.
If no vintage is requested, i.e. vintage=0
then the pooled objects from realtime_shock_decomposition
will be plotted and the respective vintage otherwise.
Default:
vintage = INTEGER
Selects a particular data vintage in
for which to plot the results from
realtime_shock_decomposition selected via the realtime option. If the standard
historical shock decomposition is selected (realtime=0
), vintage
will have no effect. If vintage=0
the pooled objects from realtime_shock_decomposition will be plotted. If vintage>0
, it plots the shock
decompositions for vintage
under the following scenarios:
realtime=1
: the full vintage shock decomposition for
realtime=2
: the conditional forecast shock decomposition from ,
i.e. plots and the shock contributions needed to get to
the data conditional on vintage
, with
.
realtime=3
: plots unconditional forecast shock decomposition from
, i.e. , where
and
.
Default:
In case of Excel not being installed, https://mathworks.com/matlabcentral/fileexchange/38591-xlwrite--generate-xls-x--files-without-excel-on-mac-linux-win may be helpful.
Next: Calibrated Smoother, Previous: Model Comparison, Up: The Model file [Contents][Index]