Skip to content

Commit

Permalink
write some documentation for irf
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Haan committed Dec 5, 2024
1 parent b192f1f commit 7a0f9a3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 5 deletions.
19 changes: 17 additions & 2 deletions R/irf.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
#' Impulse response functions
#'
#' Effect of a shock on the variables over time
#' Effect of a shock on the factors or variables over time
#'
#' @param x An object of type `bayesianVARs_bvar`
#' @param x An object of type `bayesianVARs_bvar`.
#' @param shock A vector of shocks. If a factor model was used, then `shock` is
#' applied to the factors, and its dimension must be the number of factors.
#'
#' If the Cholesky model was used, then the dimension of `shock` is expected
#' to be equals the number of equations. Note that the contemporaneous effects
#' of a shock in the Cholesky model depend on the ordering of equations.
#'
#' @return Returns a `bayesianVARs_irf` object
#'
#' @examples
#' train_data <- 100 * usmacro_growth[,c("GDPC1", "PCECC96", "GPDIC1", "AWHMAN", "GDPCTPI", "CES2000000008x", "FEDFUNDS", "GS10", "EXUSUKx", "S&P 500")]
#' prior_sigma <- specify_prior_sigma(data=train_data, type="cholesky")
#' mod <- bvar(train_data, lags=2L, draws=2000, prior_sigma=prior_sigma)
#' ir <- irf(mod, shock=c(0,0,0,0,0,0,1,0,0,0))
#' plot(ir, n_col=2)
#'
#' @export
irf <- function(x, shock, ahead=8) {
Expand Down
25 changes: 22 additions & 3 deletions man/irf.Rd

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

0 comments on commit 7a0f9a3

Please sign in to comment.