Decomposes a chosen variable's realisation into contributions from each
structural shock, identified via a lower-triangular Cholesky factor K.
Mirrors the MATLAB hist_decmp(y, beta, residuals, c, p, K, series).
Arguments
- y
TxN numeric matrix of original (undemeaned) data.
- fVAR
List returned by
fVAR(), containing at minimumbeta,residuals,sigma_full,p,c, andn_exog.- K
NxN lower-triangular Cholesky factor of the residual covariance matrix (i.e.
t(chol(sigma_full))).- series
Integer (1-indexed) selecting which variable to decompose.
Value
A list with two elements:
- histdec
(T-p) x N numeric matrix. Column
jis the cumulative contribution of structural shockjto the chosen variable at each point in time.- ystar
(T-p) numeric vector of the demeaned realisation of the chosen variable (benchmark series for the plot).
Details
The structural shocks are recovered as $$\varepsilon_t = K^{-1} u_t$$ where \(u_t\) are the reduced-form residuals. The structural MA representation is built by multiplying each Wold matrix by K: $$\Theta_h = \Psi_h K$$ The contribution of shock \(j\) to variable \(i\) at time \(t\) is then the inner product of \(\Theta_{0:t}[i,j]\) with the time-reversed structural shocks \(\varepsilon_{t:-1:0,j}\): $$HD(t,j) = \sum_{h=0}^{t} \Theta_h[i,j]\, \varepsilon_{t-h,j}$$
See also
fVAR, fcholeskyIRF,
fwoldIRF, plothistdec
