HDLP {desla} | R Documentation |
State Dependent High-Dimensional Local Projection
Description
Calculates impulse responses with local projections, using the desla function to estimate the high-dimensional linear models, and provide asymptotic inference. The naming conventions in this function follow the notation in Plagborg-Moller and Wolf (2021), in particular Equation 1 therein. This function also allows for estimating state-dependent responses, as in Ramey and Zubairy (2018).
Usage
HDLP(
x,
y,
r = NULL,
q = NULL,
state_variables = NULL,
y_predetermined = FALSE,
cumulate_y = FALSE,
hmax = 24,
lags = 12,
alphas = 0.05,
penalize_x = FALSE,
PI_constant = NULL,
progress_bar = TRUE,
OLS = FALSE,
parallel = TRUE,
threads = NULL
)
Arguments
x |
|
y |
|
r |
(optional) vector or matrix with |
q |
(optional) vector or matrix with |
state_variables |
(optional) matrix or data frame with |
y_predetermined |
(optional) boolean, true if the response variable |
cumulate_y |
(optional) boolean, true if the impulse response of |
hmax |
(optional) integer, the maximum horizon up to which the impulse responses are computed. Should not exceed the |
lags |
(optional) integer, the number of lags to be included in the local projection model. Should not exceed |
alphas |
(optional) vector of significance levels (0.05 by default) |
penalize_x |
(optional) boolean, true if the parameter of interest should be penalized ( |
PI_constant |
(optional) constant, used in the plug-in selection method (0.8 by default). For details see Adamek et al. (2021) |
progress_bar |
(optional) boolean, true if a progress bar should be displayed during execution (true by default) |
OLS |
(optional) boolean, whether the local projections should be computed by OLS instead of the desparsified lasso. This should only be done for low-dimensional regressions (FALSE by default) |
parallel |
boolean, whether parallel computing should be used. Default is TRUE. |
threads |
(optional) integer, how many threads should be used for parallel computing if |
Details
The input to state_variables
is transformed to a suitable matrix where each column represents one state using the function create_state_dummies
. See that function for further details.
Value
Returns a list with the following elements:
intervals |
list of matrices containing the point estimates and confidence intervals for the impulse response functions in each state, for significance levels given in |
Thetahat |
matrix (row vector) calculated from the nodewise regression at horizon 0, which is re-used at later horizons |
betahats |
list of matrices (column vectors), giving the initial lasso estimate at each horizon |
References
Adamek R, Smeekes S, Wilms I (2021).
“LASSO inference for high-dimensional time series.”
arXiv preprint arXiv:2007.10952.
Plagborg-Moller M, Wolf CK (2021).
“Local projections and VARs estimate the same impulse responses.”
Econometrica, 89(2), 955–980.
Ramey VA, Zubairy S (2018).
“Government spending multipliers in good times and in bad: evidence from US historical data.”
Journal of Political Economy, 126(2), 850–901.
Examples
X<-matrix(rnorm(50*50), nrow=50)
y<-X[,1:4] %*% c(1, 2, 3, 4) + rnorm(50)
s<-matrix(c(rep(1,25),rep(0,50),rep(1,25)), ncol=2, dimnames = list(NULL, c("A","B")))
h<-HDLP(x=X[,4], y=y, q=X[,-4], state_variables=s, hmax=5, lags=1)
plot(h)