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 thei
-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 seriestreatment::Union{Symbol, Int}
: column indicating the treatment variablep::Int
: number of lags to includehorizons::AbstractVector{<:Int}
: forecast horizons for the projectionsinclude_constant::Bool
: whether to include an intercept in each regressioncoeffs::AbstractArray{<:Number}
: coefficient estimates per horizonY::AbstractArray{<:Number}
: dependent variables for each horizonX::AbstractMatrix{<:Number}
: common regressor matrixU::AbstractArray{<:Number}
: residuals per horizonYhat::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 datasettreatment
: the treatment variable (column index or name)p
: number of lags to includehorizons
: forecast horizons to compute IRFs for
Keyword Arguments
include_constant
: whether to include a constant in the regressors