LP

LP <: Model

Local Projection (LP) model for estimating impulse response functions (IRFs) in a flexible and semi-parametric manner.

Each LP regression estimates the dynamic response of an outcome variable at future horizon h to a one-period change in a treatment variable at time t, controlling for contemporaneous and lagged covariates.

The regression model is specified as:

\[ w_{i,t+h} = \mu_{i,h} + \theta_{i,h} x_t + \gamma_{i,h}' r_t + \sum_{l=1}^p \delta_{i,h,l} w_{t-l} + \xi_{i,h,t} \]

where \(w_t = (r_t', x_t, q_t')\) and:

  • \(x_t\) is the treatment variable
  • \(r_t\) contains contemporaneous controls (all variables before x_t)
  • \(p\) is the number of lags included
  • \(\theta_{i,h}\) is the relative IRF of x_t on the i-th variable at horizon \(h\).

The treatment variable may be endogenous. Structural interpretation of IRFs can be achieved using valid instruments—see ExternalInstrument for one such method. If the treatment satisfies a conditional ignorability assumption (a recursive assumption in macro), then the coefficient has a structural interpretation even without the use of instruments. For this to hold, \(x_t - E(x_t|r_t, w_{t-1}, ..., w_{t-p})\) must be equal to the structural shock.

Fields

  • data::DataFrame: the dataset containing the time series
  • treatment::Union{Symbol, Int}: column indicating the treatment variable
  • p::Int: number of lags to include
  • horizons::AbstractVector{<:Int}: forecast horizons for the projections
  • include_constant::Bool: whether to include an intercept in each regression
  • coeffs::AbstractArray{<:Number}: coefficient estimates per horizon
  • Y::AbstractArray{<:Number}: dependent variables for each horizon
  • X::AbstractMatrix{<:Number}: common regressor matrix
  • U::AbstractArray{<:Number}: residuals per horizon
  • Yhat::AbstractArray{<:Number}: fitted values per horizon
LP(data::DataFrame,
   treatment::Union{Symbol, Int},
   p::Int,
   horizons::Union{Int, AbstractVector{<:Int}};
   include_constant::Bool=true)

Constructs a LP model object for estimating local projections with specified horizons, treatment variable, and lag length p.

All variables before the treatment variable in the dataset are used as contemporaneous controls.

Arguments

  • data: the time series dataset
  • treatment: the treatment variable (column index or name)
  • p: number of lags to include
  • horizons: forecast horizons to compute IRFs for

Keyword Arguments

  • include_constant: whether to include a constant in the regressors