View source: R/confidence_bands.R
| bootstrap_irf_bands | R Documentation |
Constructs confidence bands for structural impulse responses via a recursive
residual bootstrap. For each bootstrap replicate, the idiosyncratic residuals
are resampled (by time index, preserving the contemporaneous correlation
across variables), a new panel is generated recursively from the
estimated VAR dynamics and the (fixed) estimated common component, the full
pvarife model is re-estimated, and IRFs are computed. This is
computationally expensive but does not rely on asymptotic approximations.
bootstrap_irf_bands(
fit,
n_periods,
shock = 1L,
diff_vars = integer(0),
identification = c("short_run", "long_run"),
n_boot = 200L,
level = 0.95,
seed = NULL
)
fit |
An object of class |
n_periods |
Positive integer. Number of IRF horizons. |
shock |
Positive integer. Index of the structural shock (default 1). |
diff_vars |
Integer vector. Variables to cumulate (default none). |
identification |
Character. |
n_boot |
Positive integer. Number of bootstrap replicates (default 200). |
level |
Numeric in (0, 1). Confidence level (default 0.95). |
seed |
Optional integer seed for reproducibility. |
Each bootstrap panel is generated as
y^*_{i,t} = c + \sum_{l=1}^{\ell} \Theta_l y^*_{i,t-l}
+ \hat F_t \hat\lambda_i + e^*_{i,t},
where (c, \Theta_l) are the estimated coefficients, the common
component \hat F_t \hat\lambda_i is held fixed at its estimate, the
first \ell periods are initialised at the observed data
y^*_{i,t} = y_{i,t}, and e^*_{i,t} are residuals resampled with
replacement (whole time rows, so the cross-variable correlation is kept).
Because the path is generated recursively, the bootstrap correctly
propagates the VAR dynamics — unlike a fixed-design scheme that reuses the
original lags.
Scope of the bands. Only the idiosyncratic errors are resampled;
the common component \hat F_t \hat\lambda_i and the reduced-form
covariance structure are held at their estimates. The resulting bands
therefore capture idiosyncratic-error uncertainty only and under-cover
when the common factors account for a large share of the variation (as they
do in the simulation design of Tugan 2021). This routine is intended as a
robustness check; for coefficient inference use asymptotic_var
or summary.pvarife_result, and for the paper's IRF bands use
irf_bands.
An object of class "pvarife_bands" with components
irf, lower, upper, level, and
method = "bootstrap".
irf_bands, compute_irf
sim <- sim_pvarife(n_units = 20, n_time = 15, n_vars = 2,
n_lags = 1, n_factors = 1, seed = 1)
fit <- pvarife(sim$y, n_lags = 1, n_factors = 1, n_out = 5, n_in = 3)
bands <- bootstrap_irf_bands(fit, n_periods = 6, n_boot = 20, seed = 42)
plot(bands)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.