Next: , Previous: , Up: The Model file   [Contents][Index]

4.16 Shock Decomposition

Command: shock_decomposition [VARIABLE_NAME]…;
Command: shock_decomposition (OPTIONS…) [VARIABLE_NAME]…;

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 $0$, the shock decomposition is computed conditional on the smoothed state variables in period $0$, i.e. the smoothed shocks starting in period $1$ are used. If equal to $1$, the shock decomposition is computed conditional on the smoothed state variables in period $1$. Default: $0$

Output

MATLAB/Octave variable: oo_.shock_decomposition

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.

Block: shock_groups;
Block: shock_groups(OPTIONS…);

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.

Command: realtime_shock_decomposition [VARIABLE_NAME]…;
Command: realtime_shock_decomposition (OPTIONS…) [VARIABLE_NAME]…;

Description

This command computes the realtime historical shock decomposition for a given sample based on the Kalman smoother. For each period $T=[@code{presample},@dots{},@code{nobs}]$, it recursively computes three objects:

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

See datafile_shock_decomp.

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 $T=[@code{presample+1}@dots{}@code{nobs}]$.

forecast = INTEGER

Compute shock decompositions up to $T+k$ 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: $0$.

Output

MATLAB/Octave variable: oo_.realtime_shock_decomposition

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 $T=[@code{presample},@dots{},@code{nobs}]$ it collects the last period’s decomposition $Y(T\vert T)$ (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.

MATLAB/Octave variable: oo_.realtime_conditional_shock_decomposition

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 $Y(T\vert T)-Y(T\vert T-1)$ for the terminal periods $T=[@code{presample},@dots{},@code{nobs}]$. The third dimension is of size nobs.

time_*

Store the vintages of $k$-step conditional forecast shock decompositions $Y(t\vert T+k)$, for $t=[T@dots{}T+k]$. See vintage. The third dimension is of size 1+forecast.

MATLAB/Octave variable: oo_.realtime_forecast_shock_decomposition

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 $1$-step ahead effect of shocks on the $1$-step ahead prediction, i.e. $Y(T\vert T-1)$.

time_*

Stores the vintages of $k$-step out-of-sample forecast shock decompositions, i.e. $Y(t\vert T)$, for $t=[T@dots{}T+k]$. See vintage.

Command: plot_shock_decomposition [VARIABLE_NAME]…;
Command: plot_shock_decomposition (OPTIONS…) [VARIABLE_NAME]…;

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 $16$ 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 $y$-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:

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: $0$

vintage = INTEGER

Selects a particular data vintage in $[presample,@dots{},nobs]$ 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 $T=@code{vintage}$ under the following scenarios:

  • realtime=1: the full vintage shock decomposition $Y(t\vert T)$ for $t=[1,@dots{},T]$
  • realtime=2: the conditional forecast shock decomposition from $T$, i.e. plots $Y(T+j\vert T+j)$ and the shock contributions needed to get to the data $Y(T+j)$ conditional on $T=$vintage, with $j=[0,@dots{},@code{forecast}]$.
  • realtime=3: plots unconditional forecast shock decomposition from $T$, i.e. $Y(T+j\vert T)$, where $T=@code{vintage}$ and $j=[0,@dots{},@code{forecast}]$.

Default: $0$


Footnotes

(7)

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: , Previous: , Up: The Model file   [Contents][Index]