LP
LP
Local Projection (LP) model for estimating IRFs.
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.
Properties
data
(table or matrix): Input time series dataset.treatment
(char or integer): Treatment variable.p
(integer): Number of lags.horizons
(vector): Forecast horizons for projections.includeConstant
(logical): Whether to include an intercept.B
(array): Coefficient estimates per horizon.Y
(array): Dependent variables per horizon.X
(matrix): Common regressor matrix.U
(array): Residuals per horizon.Yhat
(array): Fitted values per horizon.
createXY_
Construct regressor matrix X
and response array Y
.
[X, Y] = createXY_(data, treatment, p, horizons, varargin)
prepares the design matrices for local projection estimation.
Arguments
data
(matrix or table): Input time series dataset.treatment
(char or int): Treatment variable.p
(int): Lag length.horizons
(vector): Forecast horizons.varargin
: Name-value pairs for options:includeConstant
(logical): Include constant column inX
(Default is true).
Returns
X
(matrix): Common regressor matrix for all horizons.Y
(3D array): Outcome variables stacked over horizons (along the third dimension).
Notes
X
is structured as [deterministic contemporaneous treatment lagged]Y
stacks future outcomes across selected horizons along the third dimension.- Shape of
Y
: (observations, variables, horizons).
Details
- All variables ordered before the treatment in
data
are included as contemporaneous controls.
fitted
Return the fitted values from the LP model.
Yhat = fitted(obj)
returns the fitted values obtained from the local projection regressions.
Arguments
obj
(LP): LP model object.
Returns
Yhat
(3D array): Fitted values with dimensions:- First dimension: Time.
- Second dimension: Outcome variable.
- Third dimension: Horizon.
See also residuals
, coeffs
, fit
LP
Construct a Local Projection (LP) model object.
obj = LP(data, treatment, p, horizons, varargin)
initializes an LP object for estimating impulse response functions.
Arguments
data
(matrix or table): Input time series dataset.treatment
(char or int): Treatment variable.p
(integer): Lag length.horizons
(vector): Forecast horizons.varargin
: Name-value pairs for options:includeConstant
(logical): Include constant in regressors (Defaults to true).
transmission
Compute transmission effects in an LP model.
effects = transmission(obj, shock, condition, order, maxHorizon, varargin)
computes transmission effects for a shock
satisfying a condition
, based on the ordering order
, up to maxHorizon
.
Arguments
obj
(LP): LP model object.shock
(integer): Index of the shock variable.condition
(Q): Transmission condition object.order
(cell array of char): Variable transmission ordering.maxHorizon
(integer): Maximum horizon.varargin
: Name-value pairs for options:identificationMethod
(optional): Identification method.
Returns
effects
(3D array): Transmission effects over horizons:- First dimension: Endogenous variables (responses).
- Second dimension: Selected shock.
- Third dimension: Horizon.
Notes
- If
identificationMethod
is provided, the LP model is refitted.
See also LP.through
, LP.notThrough
, LP.IRF
fit
Estimate the LP model with an identification method.
fit(obj, identificationMethod)
estimates the LP model, identifying causal effects with respect to the treatment.
Arguments
obj
(LP): LP model object.identificationMethod
(object, optional): Identification method. Must be of typeIdentificationMethod
. Defaults toRecursive
.
See also coeffs
, fitted
, residuals
, Recursive
coeffs
Return coefficient estimates from LP model.
B = coeffs(obj, excludeDeterministic)
returns the estimated coefficients from the fitted LP model.
Arguments
obj
(LP): LP model object.excludeDeterministic
(logical, optional): If true, excludes constant terms from the coefficients. Defaults to false.
Returns
B
(3D array): Coefficients array with dimensions:- First dimension: Outcome variable.
- Second dimension: Regressors.
- Third dimension: Horizon.
See also fit
residuals
Return residuals from the LP model.
U = residuals(obj)
returns the residuals from the local projection regressions.
Arguments
obj
(LP): LP model object.
Returns
U
(3D array): Residuals with dimensions:- First dimension: Time.
- Second dimension: Outcome variable.
- Third dimension: Horizon.
See also fitted
, coeffs
, fit
fitAndSelect
Select optimal lag length for LP model.
[modelBest, icTable] = fitAndSelect(obj, identificationMethod, icFunction)
selects the optimal lag length based on an equivalent VAR model.
Arguments
obj
(LP): LP model object.identificationMethod
(IdentificationMethod
, optional): Identification method. Defaults toRecursive
.icFunction
(function handle, optional): Information criterion function to minimize. Defaults toaic
.
Returns
modelBest
(LP): Best fitting LP model.icTable
(table): Table of lag lengths and IC values.
Notes
- Maximum lag length considered is the lag length of
obj
.
See also fit
, VAR.fitAndSelect
, Recursive
IRF
Compute impulse response functions from LP model.
irfObj = IRF(obj, maxHorizon, varargin)
computes IRFs up to maxHorizon
based on the LP model.
Arguments
obj
(LP): LP model object.maxHorizon
(integer): Maximum forecast horizon.varargin
: Name-value pairs for options:identificationMethod
(optional): Identification method.
Returns
irfObj
(IRFContainer): Container with computed IRFs.
Notes
- If
identificationMethod
is provided, LP is refitted first. - The IRFs have dimensions
(k x k x (maxHorizon+1))
: - First dimension: Responding variables.
- Second dimension: Shocks.
- Third dimension: Horizon.
See also fit
, IRFContainer