Estimates impulse response functions (IRFs) using recursive zero
restrictions combined with local projections (Jorda, 2005). The shock of
dimension e is identified by regressing the outcome at horizon h by OLS
on the contemporaneous value of the e-th variable in y, controlling for
the contemporaneous values of variables 1, ..., e - 1 in y, lags of the
information set, and deterministic terms. This is the local-projection
analogue of a Cholesky decomposition and serves as a benchmark for the
heteroskedasticity-based estimator hetiv().
Usage
recols(
y,
O,
X = NULL,
Ind,
P,
H,
E = 1,
norm = 1,
cum = FALSE,
cov_type = "HC3",
hpredict = 0,
pooled = FALSE,
details = FALSE
)Arguments
- y
Numeric matrix of stationary outcome variables (T x N). The effect on the
e-th variable in each dimensioneis normalized tonormat horizon 0. The firstEvariables are also used to impose the recursive zero restrictions.- O
Numeric matrix of information set variables (T x M). May be identical to
y. Included as lags 1 throughP.- X
Numeric matrix of deterministic variables (T x K). For example, time trend, seasonal dummies or other deterministic controls. Included as is (no lags). A constant is included by default.
- Ind
Integer vector of length T, event indicator:
0Control day (no event)1Policy day (event)2Contaminated control day (excluded from estimation)
At least one policy day is required.
- P
Integer. Maximum lag order for the information set. Set to
0for no lags (regression on deterministic terms only).- H
Integer. Maximum horizon (in periods) up to which IRFs are estimated.
- E
Integer. Number of shock dimensions to identify via recursive ordering.
- norm
Numeric scalar. Normalize the impact response of the
e-th variable to shocketo a specific value. Set to1for standard unit-effect normalization.- cum
Logical vector of length N. For each variable in
y, whether to report the cumulative impulse response instead of the level response. If only one provided, applied to all impulse responses.- cov_type
Covariance estimator for local-projection standard errors:
"HC3"(default) for heteroskedasticity-robust standard errors or"NW"for Newey-West HAC standard errors."HC3"is the default because Montiel Olea et al. (2025) show that heteroskedasticity-robust standard errors suffice for local-projection impulse responses under weak conditions, even though multi-step forecast errors are typically serially correlated."NW"remains available as an optional HAC robustness check.- hpredict
Integer. Horizon of the responses and forecast errors used for shock prediction, on the same scale as the row labels of
irf. Defaults to 0 (impact response and one-step-ahead residual). Must lie between 0 andH - 1.- pooled
Logical. If
FALSE(default), the shock prediction uses the forecast errors and responses at horizonhpredictonly. IfTRUE, the forecast errors of all horizons0, ..., hpredictare stacked and used jointly (pooled prediction), which weights every horizon by its signal-to-noise ratio; seekfpredict(). Withhpredict = 0both options coincide.- details
Logical. If
TRUE, saves detailed OLS results and extracts shocks, which is slightly slower. IfFALSE, returns only impulse responses and standard errors (e.g. for bootstrap).
Value
A named list. If details = FALSE, it contains irf, se, and
Method. If details = TRUE, it contains:
irfArray (H x N x E) of estimated impulse responses.
seArray (H x N x E) of local-projection standard errors.
ShocksOutput of
kfpredict(): predicted structural shocks.OLSResList of
lmmodel objects, one per horizon, variable, and shock dimension.ObsData frame with observation counts:
Tp(policy days),Tc(control days),To(contaminated days),Tt(total used).MethodCharacter string
"Recursive-OLS".etMatrix of forecast errors on event days used for shock prediction, one column per variable and horizon (
y1.h0, ...,yN.h0,y1.h1, ...): horizonhpredictonly ifpooled = FALSE, horizons0, ..., hpredictifpooled = TRUE.SigCovariance matrix of
eton event days.SigRCovariance matrix of the same residuals on control days, or
NAif unavailable. A control day enters horizon h only if no event occurs in its windowt + 1, ..., t + h.PsiResponse matrix used for shock prediction, with rows matching the columns of
et:irf[hpredict + 1, , ](N x E) ifpooled = FALSE, the rows1, ..., hpredict + 1ofirfstacked ifpooled = TRUE. With the defaulthpredict = 0this is the impact response.
Details
For E > 1, identification is recursive and order-dependent: the
column order of y defines both the shock ordering and the normalization
variable for each shock dimension. By construction, the impact response
of variable e to shock e equals norm, and the impact responses of
variables 1, ..., e - 1 to shock e are zero.
Unlike hetiv(), the distinction between policy days (Ind == 1) and
control days (Ind == 0) does not affect the IRF estimates: both enter
the local projections, and only contaminated days (Ind == 2) are
dropped. The distinction matters only for the shock extraction returned
when details = TRUE.
References
Jorda, O. (2005). Estimation and inference of impulse responses by local projections. American Economic Review, 95(1), 161-182.
Montiel Olea, J. L., M. Plagborg-Moller, E. Qian, and C. K. Wolf (2025). Local projections or VARs? A primer for macroeconomists. NBER Working Paper No. 33871.
Plagborg-Moller, M. and C. K. Wolf (2021). Local projections and VARs estimate the same impulse responses. Econometrica, 89(2), 955-980.
Examples
set.seed(1)
y <- matrix(rnorm(80), ncol = 2)
Ind <- rep(0L, nrow(y))
Ind[seq(5, nrow(y), by = 5)] <- 1L
res <- recols(y = y, O = y, Ind = Ind, P = 1, H = 3, E = 2)
res$irf[1, , ] # impact responses: unit diagonal, zero above it
#> [,1] [,2]
#> [1,] 1.0000000 -4.26246e-17
#> [2,] 0.2783758 1.00000e+00
