This function constructs GIRFs for an threshold VAR (from the tsDyn package) using variation of the method from Koop, Pesaran and Potter (1996).

GIRF(tvar, shock, horizon = 20, H = 200, R = 500, restrict.to = NA)

Arguments

tvar

An estimated tvar (from the tsDyn package) for which you wish to calculate a GIRF.

shock

A column specifying which (reduced form) shock you wish to impose.

horizon

(default 20) How many periods to simulate after the shock?

H

(default 200) How many histories to sample.

R

(default 500) How many times to replicate the forward simulation for each history.

restrict.to

(integer) Do you want to restrict to a particular regime in the shock period (histories that lead to starting in any other regime will be ignored). Should be a single integer, corresponding to the regime number in your estimated TVAR (e.g. should be an integer in 1:(1+nthresh)). Regime numbers correspond to the order the regimes are listed when you print() your estimated TVAR.

Details

Specifically, the method bootstraps a history and then simulates the TVAR forward. First it does so by imposing that the shock in the first period is equal to the supplied (reduced form) shock. Shocks in all periods subsequent are bootstrapped from the distribution of reduced form shocks, _conditional on the current regime_. It repeats the simulation a second time, but with a bootstrapped shock in place of the imposed shock (and then randomly bootstrapping shocks to simulate the TVAR as before). Since the TVAR is allowed to endogenously change regime, the shock series will differ between the two simulations - both because each is randomly selected, and because the two simulations will not necessarily have the same path for the regime. The difference between the two simulations is then saved as the response of each of the variables in the TVAR to the shock.

This process is repeated a number of times for each history, and for a number of histories and then averaged to construct the GIRF.

Importantly, the supplied shock (and the shocks that are sampled) are reduced form. This means you are responsible for supplying a sensibly identifited initial shock. But after that, by using reduced form shocks, there is no need to take a stand about identifying structural shocks for all of the monte carlo simulation periods.

Examples

if (FALSE) { library(tsDyn) data(zeroyld) exampleTVAR <- TVAR(zeroyld, lag=2, nthresh=1, thDelay=1, mTh=1, plot=FALSE) girfs <- GIRF(exampleTVAR, c(0,1)) # Show GIRF conditional on the shock occurring in the `Bdown` regime (see the # regimes by running print(exampleTVAR)) conditional_girf_bdown <- GIRF(exampleTVAR, c(0,1), restrict.to = 1) }