% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/irf.R
\name{IRF}
\alias{IRF}
\title{Impulse Response Functions for a fitted steady-state BVAR model}
\usage{
IRF(
  x,
  H = 16,
  response = NULL,
  shock = NULL,
  type = c("median", "mean"),
  method = c("OIRF", "GIRF"),
  ci = 0.95,
  t = NULL,
  growth_rate_idx = NULL
)
}
\arguments{
\item{x}{A steady-state \code{bvar} object that has been passed through \code{\link{fit}}.}

\item{H}{Integer. The forecast horizon for the IRF. Default \code{16}.}

\item{response}{Integer. Index of the response variable to plot. If
\code{NULL} (default), all responses are plotted.}

\item{shock}{Integer. Index of the shock variable to plot. If \code{NULL}
(default), all shocks are plotted.}

\item{type}{Character. Whether to use \code{"median"} or \code{"mean"} as
the point estimate. Default \code{"median"}.}

\item{method}{Character. The IRF method: \code{"OIRF"} for orthogonalized
or \code{"GIRF"} for generalized impulse responses. Default \code{"OIRF"}.}

\item{ci}{Numeric. The credible interval width. Default \code{0.95}, i.e. 95\%.}

\item{t}{Integer. Time index for the covariance matrix when using stochastic
volatility models. If \code{NULL} (default), the last time \code{t} is used.}

\item{growth_rate_idx}{Integer vector. Indices of variables for which the impulse
response is converted from a quarterly or monthly log first difference to an
annual growth rate response, i.e. \eqn{\ln x_{t} - \ln x_{t-f}}, where \eqn{f} is
the frequency of the data (4 for quarterly, 12 for monthly).
Only suitable for variables specified as \eqn{\ln x_{t} - \ln x_{t-1}}, i.e.
\code{diff(log(x))} or \code{100*diff(log(x))}. Computed by summing up to
\eqn{f} periods of the impulse response, treating the response in periods
prior to the shock as zero. Default is \code{NULL}.}
}
\value{
Invisibly returns a list with three arrays: the point estimate IRF, \code{lower}, and
\code{upper} credible bounds, each of dimension \code{k x k x (H+1)}.
}
\description{
Computes and plots impulse response functions (IRFs) from a fitted
steady-state \code{bvar} object. Supports both orthogonalized (OIRF) and generalized
(GIRF) impulse responses, with optional conversion to annual growth rates.
}
\examples{
\donttest{
#homoscedastic with Jeffreys prior
yt <- matrix(rnorm(50), 25, 2)

bvar_obj <- bvar(data = yt)

bvar_obj <- setup(bvar_obj, p=1, deterministic = "constant")

bvar_obj <- priors(bvar_obj,
                   lambda_1 = 0.2,
                   lambda_2 = 0.5,
                   lambda_3 = 1,
                   first_own_lag_prior_mean = rep(1,2),
                   theta_Psi = rep(0, 2),
                   Omega_Psi = diag(0.1, 2, 2),
                   Jeffreys = TRUE,
                   SV = FALSE,
                   SV_type = NULL,
                   SV_priors = NULL)
                   
bvar_obj <- fit(bvar_obj,
                H = 8,
                d_pred = matrix(rep(1,8)),
                iter = 200,
                warmup = 50,
                chains = 1,
                cores = 1)
                
(IRF(bvar_obj))
}
}
