irf_x: Left and right multiply IRFs with constant matrices

View source: R/z_utils.R

irf_xR Documentation

Left and right multiply IRFs with constant matrices

Description

irf_x is a helper function rotating arrays in the third dimension of the given array.

Usage

irf_x(irf, pre_mat = NULL, post_mat = NULL)

Arguments

irf

n x q x (h + 1) array containing the impulse responses, where n, q and h are the cross-sectional dimension, number of dynamic factors, and IRF horizon, resepectively.

pre_mat

matrix used in the left multiplication of the IRF

post_mat

matrix used in the right multiplication of the IRF

Value

An array rotated in the third dimension.

Examples

# create a random array corresponding to the impulse response function
irf_ex <- stats::rnorm(4*4*4) %>% array(dim = c(4,4,4))
# assume the recursive identification via cholesky is given as
chol_ex <- stats::rnorm(16) %>% matrix(4,4) %>% tcrossprod() %>% chol() %>% t()
# then the recursive identification of the IRF can be obtained as
(sirf_ex <- irf_x(irf_ex, post_mat = solve(irf_ex[,,1])%*%chol_ex) %>% zapsmall())


juhokalle/rmfd4dfm documentation built on July 18, 2024, 10:19 p.m.