irf: Compute Impulse-Response Functions

View source: R/irf.R

irf.dsge_bayesR Documentation

Compute Impulse-Response Functions

Description

Computes the impulse-response functions (IRFs) from a fitted or solved DSGE model. An IRF traces the dynamic response of control and state variables to a one-standard-deviation shock.

Usage

## S3 method for class 'dsge_bayes'
irf(
  x,
  periods = 20L,
  impulse = NULL,
  response = NULL,
  se = TRUE,
  level = 0.95,
  n_draws = 200L,
  ...
)

irf(
  x,
  periods = 20L,
  impulse = NULL,
  response = NULL,
  se = TRUE,
  level = 0.95,
  ...
)

Arguments

x

A dsge_fit or dsge_solution object.

periods

Integer. Number of periods to compute. Default is 20.

impulse

Character vector of shock names. If NULL (default), computes IRFs for all shocks.

response

Character vector of variable names. If NULL (default), computes responses for all variables.

se

Logical. If TRUE (default) and x is a dsge_fit, compute delta-method standard errors for IRFs.

level

Confidence level for bands. Default is 0.95.

n_draws

Integer. Number of posterior draws to use for IRF computation. Default is 200. Set to NULL to use all draws.

...

Additional arguments passed to methods.

Value

An object of class "dsge_irf" containing a data frame with columns: period, impulse, response, value, and optionally se, lower, upper.

Methods (by class)

  • irf(dsge_bayes): Compute posterior IRFs from a Bayesian DSGE fit. Returns pointwise posterior median and credible bands.

Examples


m <- dsge_model(
  obs(y ~ z),
  state(z ~ rho * z),
  start = list(rho = 0.5)
)
sol <- solve_dsge(m, params = c(rho = 0.8))
irfs <- irf(sol, periods = 10)



dsge documentation built on Sept. 25, 2026, 5:08 p.m.