Skip to content

Commit

Permalink
- Update description
Browse files Browse the repository at this point in the history
  • Loading branch information
AdaemmerP committed Jun 15, 2018
1 parent 8db9148 commit def11b4
Show file tree
Hide file tree
Showing 30 changed files with 77 additions and 74 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,5 +3,6 @@
.RData
.Ruserdata
.httr-oauth
.cran-comments.md
*.o
*.so
6 changes: 1 addition & 5 deletions DESCRIPTION
Expand Up @@ -10,7 +10,7 @@ Authors@R: c(
Maintainer: Philipp Adämmer <adaemmer@hsu-hh.de>
BugReports: https://github.com/adaemmerp/lpirfs/issues
Description: Contains functions to estimate linear and nonlinear impulse
responses based on local projections by Jordà (2005) <doi:10.1257/0002828053828518>
responses based on local projections by Jordà (2005) <doi:10.1257/0002828053828518>.
Nonlinear impulse responses are estimated for two regimes based on
a transition function used in Auerbach and Gorodnichenko (2012) <doi:10.1257/pol.4.2.1>.
License: GPL (>= 2)
Expand All @@ -23,12 +23,8 @@ Imports:
dplyr(>= 0.7.4),
foreach(>= 1.4.3),
ggplot2(>= 2.2.1),
ggthemes(>= 3.4.0),
gtable(>= 0.2.0),
mFilter(>= 0.1-3),
Rcpp(>= 0.12.17),
rlang(>= 0.2.0),
rmarkdown(>= 1.9),
vars(>= 0.7.4)
RoxygenNote: 6.0.1
LinkingTo: Rcpp, RcppArmadillo
Expand Down
2 changes: 1 addition & 1 deletion R/RcppExports.R
Expand Up @@ -2,7 +2,7 @@
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @name find_lag_c
#' @title Determine optimal lag length
#' @title Compute optimal lag length
#' @description Determine optimal lag length based on 'AICc', 'AIC', or 'BIC' criterion.
#'
#' @param y List with left (endogenous) variables
Expand Down
2 changes: 1 addition & 1 deletion R/create_lags.R
@@ -1,5 +1,5 @@
#' @name create_lags
#' @title Create a data frame with lagged exogenous variables
#' @title Compute data frame with lagged exogenous variables
#' @description Create a data frame with lagged exogenous variables
#' @param data A data.frame()
#' @param lags Integer for the number of lags
Expand Down
2 changes: 1 addition & 1 deletion R/create_lin_data.R
@@ -1,5 +1,5 @@
#' @name create_lin_data
#' @title Function to create data for linear model
#' @title Compute data for linear model
#' @description Function to create data for linear model.
#' @param specs A \link{list}(). Inputs are outlined in \link{lp_lin}().
#' @param data_set_df A \link{data.frame}() with all endogenous variables.
Expand Down
2 changes: 1 addition & 1 deletion R/create_nl_data.R
@@ -1,5 +1,5 @@
#' @name create_nl_data
#' @title Function to create data for nonlinear model
#' @title Compute data for nonlinear model
#' @description Function to create data for non-linear model
#' @param specs A \link{list}(). Inputs are outlined in \link{lp_nl}
#' @param data_set_df A data frame with all endogenous variables
Expand Down
4 changes: 2 additions & 2 deletions R/data-documentation.R
@@ -1,4 +1,4 @@
#' A data frame to estimate the effects of interest rate rules for monetary policy
#' A data frame containing data to estimate the effects of interest rate rules for monetary policy
#'
#' @format A data frame with 193 quarterly observations (rows) and 3 variables (columns):
#' \describe{
Expand All @@ -11,7 +11,7 @@
"interest_rules_var_data"


#' A data frame to estimate a standard monetary VAR
#' A data frame containing data to estimate a standard monetary VAR
#'
#'
#' @format A data frame with 494 monthly observations (rows) and 6 variables (clumns):
Expand Down
8 changes: 4 additions & 4 deletions R/lp_lin.R
Expand Up @@ -6,10 +6,10 @@
#' is used for the Cholesky decomposition.
#' @param lags_criterion NaN or character. NaN means that the number of lags
#' will be given at \emph{lags_lin}. The character refers to the corresponding lag length criterion ('AICc', 'AIC' or 'BIC').
#' @param lags_lin NaN or integer. Number of lags for (linear) VAR (if \emph{lags_criterion} = NaN). NaN if lags_criterion is given.
#' @param max_lags NaN or integer. Maximum number of lags (if \emph{lags_criterion} = 'AICc', 'AIC', 'BIC'). NaN otherwise.
#' @param lags_lin NaN or integer. NaN if lag length criterion is used. Integer for number of lags for linear VAR.
#' @param max_lags NaN or integer. Maximum number of lags if \emph{lags_criterion} is character with lag length criterion. NaN otherwise.
#' @param trend Integer. No trend = 0 , include trend = 1, include trend and quadratic trend = 2.
#' @param shock_type Integer. Standard deviation shock = 0, Unit shock = 1.
#' @param shock_type Integer. Standard deviation shock = 0, unit shock = 1.
#' @param confint Double. Width of confidence bands. 68\% = 1, 90\% = 1.65, 95\% = 1.96.
#' @param hor Integer. Number of horizons for impulse responses.
#'
Expand All @@ -20,7 +20,7 @@
#' The last dimension denotes the shock variable. The row in each matrix
#' gives the respones of the \emph{ith} variable, ordered as in data_set_df. The columns denote the horizon.
#' For example, if \emph{results_lin} contains the list with results, results_lin$irf_lin_mean[, , 1] returns a KXH matrix,
#' where K is the number of variables and H the number of horizons. '1' is the variable which shocks, i.e. the
#' where K is the number of variables and H the number of horizons. '1' is the variable shock variable, corresponding to the
#' variable in the first column of \emph{data_set_df}.}
#'
#'\item{irf_lin_low}{A three 3D \link{array}() containing all lower confidence bands of the responses,
Expand Down
21 changes: 11 additions & 10 deletions R/lp_nl.R
@@ -1,31 +1,32 @@
#' @name lp_nl
#' @title Compute nonlinear impulse responses
#' @description Compute nonlinear impulse responses with local projections by Jordà (2005). The
#' data are separated into two states with a smooth transition function as applied in Auerbach and Gorodnichenko (2012).
#' data are separated into two states via a smooth transition function, applied in Auerbach and Gorodnichenko (2012).
#'
#' @param data_set_df A \link{data.frame}() containing all endogenous variables for the VAR. The column order
#' is used for the Cholesky decomposition.
#' @param lags_criterion NaN or character. NaN means that the number of lags
#' will be given at \emph{lags_nl} and \emph{lags_lin}. The lag length criteria are 'AICc', 'AIC' and 'BIC'.
#' @param lags_lin NaN or integer. Number of lags for linear VAR to identify shock. NaN if lag length criterion is given.
#' @param lags_nl NaN or integer. Number of lags for (nonlinear) VAR (if \emph{lags_criterion} = NaN). NaN if lag length criterion is given.
#' @param lags_lin NaN or integer. NaN if lag length criterion is used.
#' Integer for number of lags for linear VAR to identify shock.
#' @param lags_nl NaN or integer. Number of lags for nonlinear VAR (if \emph{lags_criterion} = NaN). NaN if lag length criterion is given.
#' @param max_lags NaN or integer. Maximum number of lags (if \emph{lags_criterion} = 'AICc', 'AIC', 'BIC'). NaN otherwise.
#' @param trend Integer. Include no trend = 0 , include trend = 1, include trend and quadratic trend = 2.
#' @param shock_type Integer. Standard deviation shock = 0, Unit shock = 1.
#' @param confint Double. Width of confidence bands. 68\% = 1; 90\% = 1.65; 95\% = 1.96.
#' @param hor Integer. Number of horizons for impulse responses.
#' @param switching Vector. A column vector with the same length as \emph{data_set_df}. This series can either
#' be decomposed by the Hodrick-Prescott filter (see Auerbach and Gorodnichenko, 2013) or
#' directly plugged into the smooth transition function:
#' directly plugged into the following smooth transition function:
#' \deqn{ F_{z_t}) = \frac{exp(-\gamma z_t)}{1 + exp(-\gamma z_t)} }
#' Warning: \eqn{F_{z_t}} will be lagged in \link{create_nl_data} by one and then multiplied with the data.
#' If the variable shall not be lagged, the vector has to be given with a lead of one.
#' The data for the two regimes are: \cr
#' Regime 1 = (1-\eqn{F(z_{t-1})})*y_{t-p}, \cr
#' Regime 2 = \eqn{F(z_{t-1})}*y_{t-p}.
#'@param gamma Double. Value of \eqn{\gamma} which is used in the transition function.
#'@param gamma Double. Positive number which is used in the transition function.
#'@param hp_filter Integer. No HP-filter = 0. Use HP-filter = 1.
#'@param lambda Double. Value of \eqn{\lambda} for the Hodrick-Prescott filter if \emph{hp_filter} = 1.
#'@param lambda Double. Value of \eqn{\lambda} for the Hodrick-Prescott filter if HP-filter is applied.
#'
#'
#'
Expand All @@ -34,9 +35,9 @@
#'
#'\item{irf_s1_mean}{A three 3D \link{array}() containing all impulse responses for all endogenous variables of the first state.
#' The last dimension denotes the shock variable. The row in each matrix
#' denotes the respones of the \emph{ith} variable ordered as in \emph{data_set_df}. The columns are the horizons.
#' denotes the respones of the \emph{ith} variable, ordered as in \emph{data_set_df}. The columns are the horizons.
#' For example, if the results are saved in \emph{results_nl}, results_nl$irf_s1_mean[, , 1] returns a KXH matrix,
#' where K is the number of variables and H the number of horizons. '1' is the variable which shocks, i.e. the
#' where K is the number of variables and H the number of horizons. '1' is the shock variable, correspondong to the
#' variable in the first column of \emph{data_set_df}.}
#'
#'\item{irf_s1_low}{A three 3D \link{array}() containing all lower confidence bands of the impulse responses, based on
Expand All @@ -47,7 +48,7 @@
#'
#'\item{irf_s2_mean}{A three 3D \link{array}() containing all impulse responses for all endogenous variables of the second state.
#' The last dimension denotes the shock variable. The row in each matrix
#' denotes the respones of the \emph{ith} variable as ordered in data_set_df. The columns denote the horizon.
#' denotes the respones of the \emph{ith} variable, ordered as in data_set_df. The columns denote the horizon.
#' For example, if the results are saved in \emph{results_nl}, results_nl$irf_s2_mean[, , 1] returns a KXH matrix,
#' where K is the number of variables and H the number of horizons. '1' is the first shock variable corresponding to the
#' variable in the first column of \emph{data_set_df}.}
Expand All @@ -60,7 +61,7 @@
#'
#'\item{specs}{A list with properties of \emph{data_set_df} for the plot function.}
#'
#'\item{fz}{A vector containing the values of the transition function F(z_{t-1})}
#'\item{fz}{A vector containing the values of the transition function F(z_{t-1}).}
#'
#' @export
#' @references
Expand Down
4 changes: 2 additions & 2 deletions R/package.R
Expand Up @@ -2,8 +2,8 @@
#'
#' Contains functions to estimate linear and nonlinear impulse
#' responses based on local projections by Jordà (2005) <doi:10.1257/0002828053828518>.
#' Nonlinear impulse responses are based on data separated by
#' a transition function as in Auerbach and Gorodnichenko (2012) <doi:10.1257/pol.4.2.1>.
#' To estimate nonlinear impulse responses the data are separated into two regimes by a
#' a transition function, applied in Auerbach and Gorodnichenko (2012) <doi:10.1257/pol.4.2.1>.
#' @docType package
#' @author Philipp Adämmer
#' @importFrom Rcpp evalCpp
Expand Down
2 changes: 1 addition & 1 deletion R/plot_lin_irfs.R
@@ -1,5 +1,5 @@
#' @name plot_lin_irfs
#' @title Compute and display (linear) impulse responses
#' @title Compute and display plots of linear impulse responses
#' @description Compute and display (linear) impulse responses estimated with \link{lp_lin}.
#' @param results_lin A list with 3D arrays estimated in \link{lp_lin}.
#' @return A list with (gg-)plots for linear impulse responses
Expand Down
2 changes: 1 addition & 1 deletion R/plot_nl_irfs.R
@@ -1,5 +1,5 @@
#' @name plot_nl_irfs
#' @title Compute and display (nonlinear) impulse responses
#' @title Compute and display plots of nonlinear impulse responses
#' @description Compute and display (nonlinear) impulse responses estimated with \link{lp_nl}().
#' @param results_nl A list with 3D arrays estimated in \link{lp_nl}().
#' @return A list with (gg-)plots for nonlinear impulse responses.
Expand Down
4 changes: 2 additions & 2 deletions R/switching_series.R
@@ -1,7 +1,7 @@
#' @name switching_series
#' @title Function to estimate transition values
#' @title Compute values of transition function to separate regimes
#' @description Function to estimate transition values, which uses a smooth transition function as
#' proposed by Auerbach & Gorodnichenko (2012). The time series used in the transition function
#' used in Auerbach & Gorodnichenko (2012). The time series used in the transition function
#' can be de-trended via the Hodrick-Prescott (see Auerbach and Gorodnichenko, 2013).
#' @param switching_data A vector
#' @param specs A list with specifications for \link{lp_nl}()
Expand Down
14 changes: 14 additions & 0 deletions cran-comments.md
@@ -1,6 +1,20 @@
## Release summary

This is a first submission of the package to CRAN.

## Test environments
* local x86_64-pc-linux-gnu (64-bit), R 3.4.4
* ubuntu 12.04 (on travis-ci), R 3.1.2
* win-builder (devel and release)

## R CMD check results

0 errors ✔ | 0 warnings ✔ | 1 note ✖

checking CRAN incoming feasibility ... NOTE
Maintainer: ‘Philipp Adämmer <adaemmer@hsu-hh.de>

Possibly mis-spelled words in DESCRIPTION:
Auerbach (16:44)
Gorodnichenko (16:57)
Jordà (4:12, 14:54)
4 changes: 2 additions & 2 deletions docs/README_docs.Rmd
Expand Up @@ -116,15 +116,15 @@ $$ $$
Estimate nonlinear impulse responses with package function *lp_nl*. Note that the VAR's data set (*data_set_df*) has to be
a data.frame().
```{r, message = FALSE }
results_nl <- lp_nl(data_set_df, lags_lin = 4L, # Number of lags for (reduced) linear VAR
results_nl <- lp_nl(data_set_df, lags_lin = 4L, # Number of lags for (reduced) linear VAR
lags_nl = 4L, # Number of lags
lags_criterion = NaN, # Lag length criterion (AICc, AIC or BIC) or NaN
max_lags = NaN, # If lags_criterion is chosen, maximum number of lags
trend = 1L, # 0 = no trend, 1 = trend, 2 = trend and quadratic trend
shock_type = 0L, # 0 = standard deviation shock, 1 = unit shock
confint = 1.67, # Width of confidence bands: 1 = 68%, 1.67 = 90%,
# 1.96 = 95%
hor = 24, # Length of horizon
hor = 24, # Length of horizon
switching = data_set_df$Infl, # Inflation rate
hp_filter = 1, # 0 = Do not use HP-filter, 1 = use HP-filter
Expand Down
4 changes: 2 additions & 2 deletions docs/README_docs.html
Expand Up @@ -182,15 +182,15 @@ <h2>Example: Nonlinear impulse responses</h2>
\]</span> with <span class="math inline">\(h = 1,..., H.\)</span></p>
<p><span class="math display">\[ \]</span></p>
<p>Estimate nonlinear impulse responses with package function <em>lp_nl</em>. Note that the VAR’s data set (<em>data_set_df</em>) has to be a data.frame().</p>
<pre class="r"><code>results_nl &lt;- lp_nl(data_set_df, lags_lin = 4L, # Number of lags for (reduced) linear VAR
<pre class="r"><code>results_nl &lt;- lp_nl(data_set_df, lags_lin = 4L, # Number of lags for (reduced) linear VAR
lags_nl = 4L, # Number of lags
lags_criterion = NaN, # Lag length criterion (AICc, AIC or BIC) or NaN
max_lags = NaN, # If lags_criterion is chosen, maximum number of lags
trend = 1L, # 0 = no trend, 1 = trend, 2 = trend and quadratic trend
shock_type = 0L, # 0 = standard deviation shock, 1 = unit shock
confint = 1.67, # Width of confidence bands: 1 = 68%, 1.67 = 90%,
# 1.96 = 95%
hor = 24, # Length of horizon
hor = 24, # Length of horizon

switching = data_set_df$Infl, # Inflation rate
hp_filter = 1, # 0 = Do not use HP-filter, 1 = use HP-filter
Expand Down
2 changes: 1 addition & 1 deletion man/create_lags.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_lin_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/create_nl_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/find_lag_c.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/interest_rules_var_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/lp_lin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit def11b4

Please sign in to comment.