Provides functions to estimate and plot linear as well as nonlinear impulse
responses based on local projections by Jordà (2005)
An R-package which estimates linear and nonlinear impulse responses with local projections by Jordà (2005).
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("AdaemmerP/lpirfs")
The package compiles some C++ source code for installation, which is why you need the appropriate compilers:
On Windows you need Rtools available from CRAN.
On macOS you need the Clang 6.x compiler and the GNU Fortran compiler from macOS tools. Having installed the compilers, you need to open a terminal and start R via ‘PATH=/usr/local/clang6/bin:$PATH R’. Yo can then install the package via devtools::install_github(“AdaemmerP/lpirfs”)
Examples can be found here.
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 benefit from the helpful and critical remarks by Jon Danielsson and from 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.
Philipp Adämmer
GPL (>= 2)
Fixed a bug for lp_lin_panel() and lp_nl_panel() regarding the construction of the endogenous and exogenous variables.
Fixed a bug for lp_nl_panel() when using the switching variable.
Fixed a bug for lp_lin_panel() and lp_nl_panel() when a pooling model is specified.
New checks for lp_lin_panel() and lp_nl_panel() to see whether shock variable has been dropped during estimation, potentially because of co-linearity or identification issues.
lp_nl_panel() now returns the (transformed) switching variable as a tibble along with the original data for comparabaility.
Updated documentation.
Updated examples.
Added two functions to estimate linear and nonlinear irfs for panel data.
Added an option to choose whether to use lagged values of the switching variable in nonlinear models.
Added an option to use a dummy approach for the nonlinear models.
Deleted messages about how models are estimated (e.g. with or without exogenous data).
Changed input name in lp_lin_iv()
for consistency:
function | old input name | new input name |
---|---|---|
lp_lin_iv() |
twosls |
use_twosls |
Included an option to conduct 2SLS with lp_lin_iv.
Included an option to set the lag length of the endogenous variables in lp_lin_iv and lp_nl_iv to zero.
Deleted the deprecated plot functions plot_lin_irfs and plot_nl_irfs.
Improved documentation.
Changed input names in lp_lin_iv()
and lp_nl_iv()
for consistency:
function | old input name | new input name |
---|---|---|
lp_lin_iv() |
instr |
shock |
lp_nl_iv() |
instr |
shock |
Fixed an error in lp_nl()
when lags are chosen by a lag length criterion.
Version 0.1.1 chooses lags based on linear instead of
nonlinear data.
Removed the dependency on the vars package.
lp_lin()
and lp_nl()
now allow to include exogenous variables and exogenous variables
with contemporaneous impact.
plot_lin_irfs()
and plot_nl_irfs()
are deprecated and have been
replaced by plot_lin()
and plot_nl()
.
Two new functions named lp_lin_iv()
and lp_nl_iv()
allow to estimate
linear and nonlinear impulse responses with identified shocks (instrument variables).
Input names in lp_lin()
and lp_nl()
have been changed for consistency:
function | old input name | new input name |
---|---|---|
lp_lin() |
lags_lin |
lags_endog_lin |
lp_nl() |
lags_lin |
lags_endog_lin |
lp_nl() |
lags_nl |
lags_endog_nl |
lp_nl() |
hp_filter |
use_hp |
The dependency on the mFilter package is removed. hp_filter()
is now written in C++ to improve efficiency.
A problem with a C++ function is resolved so that the package can also be installed on Oracle Solaris.
Renamed functions:
original name | new name |
---|---|
lm_function |
get_resids_ols |
reduced_var |
get_mat_chol |
find_lag_c |
get_vals_lagcrit |
newey_west_c |
newey_west |
switching_series |
get_vals_switching |