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

T_x1 vector containing the shock variable, see Plagborg-Moller and Wolf (2021) for details

y

T_x1 vector containing the response variable, see Plagborg-Moller and Wolf (2021) for details

r

(optional) vector or matrix with T_ rows, containing the "slow" variables, ones which do not react within the same period to a shock, see Plagborg-Moller and Wolf (2021) for details(NULL by default)

q

(optional) vector or matrix with T_ rows, containing the "fast" variables, ones which may react within the same period to a shock, see Plagborg-Moller and Wolf (2021) for details (NULL by default)

state_variables

(optional) matrix or data frame with T_ rows, containing the variables that define the states. Each column should either represent a categorical variable indicating the state of each observation, or each column should be a binary indicator for one particular state; see 'Details'.

y_predetermined

(optional) boolean, true if the response variable y is predetermined with respect to x, i.e. cannot react within the same period to the shock. If true, the impulse response at horizon 0 is 0 (false by default)

cumulate_y

(optional) boolean, true if the impulse response of y should be cumulated, i.e. using the cumulative sum of y as the dependent variable (false by default)

hmax

(optional) integer, the maximum horizon up to which the impulse responses are computed. Should not exceed the T_-lags (24 by default)

lags

(optional) integer, the number of lags to be included in the local projection model. Should not exceed T_-hmax(12 by default)

alphas

(optional) vector of significance levels (0.05 by default)

penalize_x

(optional) boolean, true if the parameter of interest should be penalized (FALSE by default)

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 parallel=TRUE. Default is to use all but two.

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 alphas

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)

[Package desla version 0.3.0 Index]