LP: Estimate local projections

Description Usage Arguments Value References See Also Examples

View source: R/lp.R

Description

Estimate local projections

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
LP(
  data,
  horizons = 1,
  freq = "month",
  type = "const",
  p = 1,
  lag.ic = NULL,
  lag.max = NULL,
  NW = FALSE,
  NW_lags = NULL,
  NW_prewhite = NULL
)

Arguments

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)

Value

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

References

  1. Jorda, Oscar "Estimation and Inference of Impulse Responses by Local Projections" 2005.

See Also

LP()

lp_irf()

RLP()

rlp_irf()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  # 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')

  # impulse response function
  irf = sovereign::lp_irf(lp)

sovereign documentation built on Jan. 5, 2022, 1:08 a.m.