hist_decomp {sstvars} | R Documentation |
Compute historical decompositions for structural STVAR models.
Description
hist_decomp
computes historical decompositions for structural STVAR models.
Usage
hist_decomp(stvar)
## S3 method for class 'histdecomp'
plot(x, ..., plot_by_shock = FALSE, which_to_plot)
## S3 method for class 'histdecomp'
print(x, ..., digits = 3, which_vars, which_indices)
Arguments
stvar |
an object of class |
x |
object of class |
... |
currently not in use. |
plot_by_shock |
should the historical decompositions by plotted so that there is one figure for each shock (rather than one figure for each variable)? |
which_to_plot |
a numeric vector with the indices of the variables or shocks
(depending on the argument |
digits |
how many significant digits to print? |
which_vars |
a numeric vector specifying the variables to print. The default is that all the variables are printed. |
which_indices |
a numeric vector specifying the time period indices to print. The default is that all the time periods are printed. |
Details
The historical decomposition quantifies the cumulative effects the shocks to the movements of the variables (see, e.g., Kilian and Lütkepohl, 2017, Section~4.3) The historical decompositions are computed as described in Wong (2018). Note that due to the effect of the "initial conditions" and the "steady state component", which are not attributed to the shocks, the cumulative effects of the shocks do not sum to the observed time series.
Value
Returns a class 'histdecomp'
list with the following elements:
- init_cond_comp
A matrix of size
(T \times d)
containing the contributions of the initial conditions to the movements of the variables at each time point; the elementt, i
giving the contribution at the timet
on the variablei
.- steady_state_comp
A matrix of size
(T \times d)
containing the contributions of the steady state component to the movements of the variables at each time point; the elementt, i
giving the contribution at the timet
on the variablei
.- shock_comp
A matrix of size
(T \times d)
containing the contributions of the shocks to the movements of the variables at each time point; the elementt, i
giving the contribution at the timet
on the variablei
.- contributions_of_shocks
A 3D array of size
(T \times d \times d)
containing the cumulative contributions of the shocks to the movements of the variables at each time point; the elementt, i1, i2
giving the contribution of the shocki1
to the variablei2
at the timet
.- stvar
The original STVAR model object.
Returns the input object x
invisibly.
Functions
-
plot(histdecomp)
: plot method -
print(histdecomp)
: print method
References
Kilian L., Lütkepohl H. 2017. Structural Vector Autoregressive Analysis. 1st edition. Cambridge University Press, Cambridge.
Wong H. 2018. Historical decomposition for nonlinear vector autoregressive models. CAMA Working Paper No. 62/2017, available as SSRN:3057759.
See Also
GIRF
, GFEVD
, linear_IRF
, fitSSTVAR
, cfact_hist
,
cfact_fore
, cfact_girf
Examples
# Recursively identified logistic Student's t STVAR(p=3, M=2) model with the first
# lag of the second variable as the switching variable:
params32logt <- c(0.5959, 0.0447, 2.6279, 0.2897, 0.2837, 0.0504, -0.2188, 0.4008,
0.3128, 0.0271, -0.1194, 0.1559, -0.0972, 0.0082, -0.1118, 0.2391, 0.164, -0.0363,
-1.073, 0.6759, 3e-04, 0.0069, 0.4271, 0.0533, -0.0498, 0.0355, -0.4686, 0.0812,
0.3368, 0.0035, 0.0325, 1.2289, -0.047, 0.1666, 1.2067, 7.2392, 11.6091)
mod32logt <- STVAR(gdpdef, p=3, M=2, params=params32logt, weight_function="logistic",
weightfun_pars=c(2, 1), cond_dist="Student", identification="recursive")
# Calculate the historical decomposition:
histdec <- hist_decomp(mod32logt)
# Print historical decomposition for Variable 1 for the first ten time periods:
print(histdec, which_vars=1, which_indices=1:10)
# Plot the historical decomposition for all variables:
plot(histdec)
# Plot the contributions of Shock 1 on the movements of all the variables:
plot(histdec, plot_by_shock=TRUE, which_to_plot=1)