Estimate local projections
LP( data, horizons = 1, freq = "month", type = "const", p = 1, lag.ic = NULL, lag.max = NULL, NW = FALSE, NW_lags = NULL, NW_prewhite = NULL )
data | data.frame, matrix, ts, xts, zoo: Endogenous regressors |
---|---|
horizons | int: forecast horizons |
freq | string: frequency of data ('day', 'week', 'month', 'quarter', or 'year') |
type | string: type of deterministic terms to add ('none', 'const', 'trend', or 'both') |
p | int: lags |
lag.ic | string: information criterion to choose the optimal number of lags ('AIC' or 'BIC') |
lag.max | int: maximum number of lags to test in lag selection |
NW | boolean: Newey-West correction on variance-covariance matrix |
NW_lags | int: number of lags to use in Newey-West correction |
NW_prewhite | boolean: TRUE prewhite option for Newey-West correction (see sandwich::NeweyWest) |
list object with elements data
, model
, forecasts
, residuals
; if there is more than one forecast horizon estimated, then model
, forecasts
, residuals
will each be a list where each element corresponds to a single horizon
Jorda, Oscar "Estimation and Inference of Impulse Responses by Local Projections" 2005.
# \donttest{ # simple time series AA = c(1:100) + rnorm(100) BB = c(1:100) + rnorm(100) CC = AA + BB + rnorm(100) date = seq.Date(from = as.Date('2000-01-01'), by = 'month', length.out = 100) Data = data.frame(date = date, AA, BB, CC) # local projection forecasts lp = sovereign::LP( data = Data, horizon = c(1:10), lag.ic = 'AIC', lag.max = 4, type = 'both', freq = 'month')#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion#> Warning: NAs introduced by coercion