# How to build confidence intervals and how to decide how many n-ahead periods in VAR?

I am fitting my VAR model and I have a few questions about it.

It is better to explain my doubts with a concrete example (the code is produced using R). The dataset is monthly data on a variety of economic and financial variables over the period 1979:7 to 2012:6. The external instrument identification strategy is pursued.

I have three questions:

1) For the MA representation of the VAR - ma_representation - the n-ahead horizon period has been set up to 50. My question is: is there a formal rule to decide, on the basis of the length of your sample, how long should the n-ahed horizon be?

2) in the paper, the author writes: "we are using wild bootstrap that generates valid confidence bands under heteroskedasticity and strong instruments. The estimation errors related to the instrumental variable regression is incorporated in the reported confidence bands, because both stages of the estimation are included in the bootstrapping procedure. Thereby, we avoid any potential “generated regressor” problem." Does he compute confidence intervals from the residuals of the 2SLS regression for instrument? If I am right, any idea on how to do it in R? As you see the function externalinstrument gives back only the instantaneous response of each of the variables in the VAR to a shock to the monetary policy indicator and nothing else.

It would be great if you could clarify these points to me.

Thanks a lot!


data(GKdata)

View(GKdata)

gkvar <- VAR(GKdata[, c("logip", "logcpi", "gs1", "ebp")], p = 12, type = "const")
shockcol <- externalinstrument(gkvar, GKdata\$ff4_tc, "gs1")
shockcol

ma_representation <- Phi(gkvar, 50)
ma_representation

irfs <- apply(ma_representation, 3, function(x) x %*% shockcol)
irfs <- as.data.frame(t(irfs))
colnames(irfs) <- names(shockcol)