hd.decomp {BGVAR}R Documentation

Historical decomposition and structural error

Description

A function that calculates historical decomposition (HD) of the time series and the structural error. To save computational time as well as due to storage limits, both functions are based on the posterior median (as opposed to calculating HDs and the structural error for each draw of the MCMC chain). In case the shock has been identified via sign restrictions, a rotation matrix has to be selected to calculate both statistics. If not specified otherwise (via R), the algorithm searches for 50 rotation matrices that fulfill the sign restrictions at the posterior median of the coefficients and then singles out the rotation matrix tha minimizes the distance to the median of the impulse responses as suggested in Frey and Pagan 2011.

Usage

hd.decomp(irf.obj, R=NULL)

Arguments

irf.obj

An item fitted with IRF

R

If NULL and the irf.obj has been fitted via sign restrictions, the rotation matrix is used that minimizes the distance to the median impulse responses at the posterior median, as described above.

Value

hd_array

is a three-dimensional array, with the first dimension referring to the K time series, the second to the T observations and the third dimension containing the contribution of the shocks in explainging historically deviations in the time series from their trend. The third dimension is K+3, since the last three entries contain the contributions of the constant, the initial conditions, and a residual component that ensures that the contributions sum up to the original time series.

struc.shock

Contains the structural shock.

x

is a matrix object that contains the original time series, which is of dimension K times (T-plag).

Author(s)

Martin Feldkircher and Florian Huber

References

Fry, R. and A. Pagan (2011) Sign Restrictions in Structural Vector Autoregressions: A Critical Review. In: Journal of Economic Literature, Vol. 49, No. 4

See Also

See also IRF

Examples

library(BGVAR)
 data(eerData)
  model.ssvs.eer<-bgvar(Data=eer.data,W=W.trade0012,saves=100,burns=100,plag=1,Cpu=1,prior="SSVS",save_thin=1,eigen=TRUE, trim=1.05)
  # US monetary policy shock
  shocks<-list();shocks$shock="stir";shocks$ccode<-"US";shocks$ident="chol";shocks$scal=-100
  irf.chol.us.mp<-IRF(gvar.obj=model.ssvs.eer,shockc=shocks,nhor=48)

  HD<-hd.decomp(irf.chol.us.mp)
  # summing them up should get you back the original time series
  org.ts<-apply(HD$hd_array,c(1,2),sum) # this sums up the contributions of all shocks + constant, initial conditions and residual component (last three entries in the third dimension of the array)
  matplot(cbind(HD$x,org.ts[1,]),type="l",ylab="")
  legend("bottomright",c("hd series","original"),col=c("black","red"),lty=c(1,2),bty="n")


[Package BGVAR version 1.1.3 Index]