Learn R Programming

lpirfs

About

An R-package which estimates linear and nonlinear impulse responses with local projections by Jordà (2005).

Citation

Please cite the paper by Adämmer (2019) when using the package.

Main features

  • Estimates linear and nonlinear impulse responses with local projections.
  • Estimates linear and nonlinear impulse responses with identified shock and/or with 2SLS.
  • Estimates linear and nonlinear impulse responses with local projections for panel data.
  • Functions to plot linear and nonlinear impulse responses.
  • Functions are partly implemented in Rcpp/RcppArmadillo and partly written for parallel computation to improve efficiency.

Installation

You can install the released version of lpirfs from CRAN:

install.packages("lpirfs")

You can install the development version of lpirfs from GitHub:

# install.packages("devtools")
devtools::install_github("https://github.com/AdaemmerP/lpirfs")

As lpirfs compiles some C++ source code, you will need to have installed the appropriate compilers to build the development version.

How to use

The paper about the package can be found here. The vignette of the package can be found here.

Acknowledgements

I am thankful to Òscar Jordà for encouraging comments and helpful suggestions. I am also indebted to Sarah Zubairy for providing the Matlab code before the publication of their paper.

I greatly benefitted from the helpful remarks by Jon Danielsson and the profound R, Rcpp and GitHub knowledge of Philipp Wittenberg and Detlef (overflow) Steuer. Last but not least, I am grateful to Philipp Dybowski without whom I would have never started this project.

All remaining errors are obviously mine.

Author

Philipp Adämmer

License

GPL (>= 2)

Copy Link

Version

Install

install.packages('lpirfs')

Monthly Downloads

901

Version

0.2.4

License

GPL (>= 2)

Maintainer

Philipp Adämmer

Last Published

March 18th, 2025

Functions in lpirfs (0.2.4)

hp_filter

Decompose a times series via the Hodrick-Prescott filter
lp_lin_panel

Compute linear impulse responses with local projections for panel data
get_vals_switching

Compute values of transition function to separate regimes
lp_lin_iv

Compute linear impulse responses with identified shock and/or with 2SLS
lp_lin

Compute linear impulse responses
get_var_lagcrit

Computes AICc, AIC and BIC for VAR
get_vals_lagcrit

Compute values for lag length criteria
get_std_err_tsls

Compute standard errors for 2SLS
interest_rules_var_data

Data to estimate the effects of interest rate rules for monetary policy
lp_nl

Compute nonlinear impulse responses
monetary_var_data

Data to estimate a standard monetary VAR
lp_nl_iv

Compute nonlinear impulse responses with identified shock
lpirfs_obj-methods-base

Base methods for lpirfs_obj objects
lpirfs-package

Local Projection Impulse Response Functions
plot.lpirfs_lin_iv_obj

Base print() function to plot all impulse responses from linear lpirfs object
newey_west_tsls

Compute 2SLS parameters and robust standard errors based on Newey-West
ols_diagnost

Compute diagnostics for OLS models
newey_west_pw

Compute Newey-West estimator with prewhitened estimation functions
newey_west

Compute OLS parameters and robust standard errors based on Newey-West estimator
plot.lpirfs_nl_panel_obj

Base print() function to plot all impulse responses from linear lpirfs object
plot_lin

Compute and display plots of linear impulse responses
summary.lpirfs_lin_iv_obj

Summary for nonlinear lpirfs object
plot_nl

Compute and display plots of nonlinear impulse responses
plot.lpirfs_lin_obj

Base print() function to plot all impulse responses from linear lpirfs object
plot.lpirfs_lin_panel_obj

Base print() function to plot all impulse responses from linear lpirfs object
summary.lpirfs_nl_iv_obj

Summary for nonlinear lpirfs object
plot.lpirfs_nl_iv_obj

Base print() function to plot all impulse responses from linear lpirfs object
lp_nl_panel

Compute nonlinear impulse responses for panel data
plot.lpirfs_nl_obj

Base print() function to plot all impulse responses from nonlinear lpirfs object
summary.lpirfs_nl_obj

Summary for nonlinear lpirfs object
summary.lpirfs_nl_panel_obj

Summary for nonlinear lpirfs object
var_one

Compute VAR to prewhite estimating functions for Newey West estimator.
summary.lpirfs_lin_panel_obj

Summary for nonlinear lpirfs object
summary.lpirfs_lin_obj

Summary for linear lpirfs object
get_mat_chol

Compute structural shock matrix via Cholesky decomposition
get_robust_cov_panel

Function to get robust covariance matrix for panel data
get_resids_ols

Compute residuals from OLS model
create_panel_data

Prepare data sets for linear and nonlinear panel model
create_lin_data

Compute data for linear model
create_nl_data

Compute data for nonlinear model with instrument variable approach
ag_data

Data to estimate fiscal multipliers
create_lags

Compute a data frame with lagged exogenous variables
get_robust_vcxt_panel

Create and returns a function to estimate hc and clustered standard errors for panel data.
get_std_err

Compute standard errors by standard OLS or Newey and West