| Title: | Transmission Channel Analysis in Structural VAR Models |
|---|---|
| Description: | Implements Transmission Channel Analysis (TCA) for structural vector autoregressive (SVAR) models following the methodology of Wegner, Lieb, and Smeekes (2025) <doi:10.48550/arXiv.2405.18987>. TCA decomposes impulse response functions (IRFs) into contributions from distinct transmission channels using a systems form representation and directed acyclic graph (DAG) path analysis. Supports overlapping channels, exhaustive 3-way and 4-way decompositions via inclusion-exclusion principle. This is a parallel R implementation of the 'tca-matlab-toolbox' (<https://github.com/enweg/tca-matlab-toolbox>). |
| Authors: | Muhammad Alkhalaf [aut, cre] (ORCID: <https://orcid.org/0009-0002-2677-9246>), Emanuel Wegner [ctb] (Original MATLAB toolbox author), Lenard Lieb [ctb] (Original MATLAB toolbox author), Stephan Smeekes [ctb] (Original MATLAB toolbox author) |
| Maintainer: | Muhammad Alkhalaf <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.2 |
| Built: | 2026-05-28 07:21:35 UTC |
| Source: | https://github.com/muhammedalkhalaf/svartca |
The SVARtca package implements Transmission Channel Analysis (TCA) for decomposing impulse response functions in structural vector autoregressive (SVAR) models. The package follows the methodology presented in Wegner, Lieb, Smeekes (2025).
TCA enables researchers to decompose the total impulse response to a shock into contributions from different transmission channels. Supported channels include effects passing through specific intermediate variables, allowing analysts to distinguish direct effects from indirect effects that operate through identified transmission mechanisms.
Key features:
Multiple decomposition modes: overlapping, exhaustive 3-way, and exhaustive 4-way.
Support for VAR and SVAR models via integration with the vars package.
Visualization of channel contributions using ggplot2.
Diagnostic tools for validating decomposition accuracy.
tca_systems_formBuild the systems form representation (B and Omega matrices) from VAR coefficients and structural impact matrix.
tca_analyzeRun the main TCA analysis with specified decomposition mode.
tca_decompose_binaryDecompose IRF into "through" and "not_through" components for a single variable.
tca_validate_additivityValidate that the binary decomposition satisfies exact additivity.
tca_from_varConvenience wrapper to run TCA directly from a fitted VAR model object.
plot_tcaCreate publication-quality visualizations of channel contributions.
The package supports two identification schemes:
Cholesky: Lower-triangular Cholesky decomposition of the
residual covariance matrix. Set Phi0 = t(chol(Sigma)).
Manual: User-supplied structural impact matrix for alternative identifications (e.g., sign restrictions, zero restrictions).
If you use the SVARtca package in your research, please cite the original methodology paper:
Wegner, E., Lieb, L., Smeekes, S. (2025). Transmission Channel Analysis in Dynamic Models. arXiv:2405.18987. https://github.com/enweg/tca-matlab-toolbox
Muhammad Alkhalaf
Wegner, E., Lieb, L., Smeekes, S. (2025). Transmission Channel Analysis in Dynamic Models. arXiv:2405.18987.
Creates a stacked bar chart (for exhaustive modes) or a line chart (for overlapping mode) showing channel contributions over horizons.
plot_tca(x, target = NULL, type = NULL, title = NULL, colors = NULL)plot_tca(x, target = NULL, type = NULL, title = NULL, colors = NULL)
x |
A |
target |
Integer index of the response variable to plot (default: first variable after shock). |
type |
Plot type: |
title |
Custom plot title (optional). |
colors |
Named character vector of colours for channels (optional). |
A ggplot object.
K <- 4 A1 <- matrix(c(0.7,-0.1,0.05,-0.05, -0.3,0.6,0.10,-0.10, -0.2,0.1,0.70,0.05, -0.1,0.2,0.05,0.65), K, K, byrow=TRUE) Sigma <- matrix(c(1,0.3,0.2,0.1, 0.3,1.5,0.25,0.15, 0.2,0.25,0.8,0.1, 0.1,0.15,0.1,0.6), K, K, byrow=TRUE) Phi0 <- t(chol(Sigma)) sf <- tca_systems_form(Phi0, list(A1), h = 20) res <- tca_analyze(from = 1, B = sf$B, Omega = sf$Omega, intermediates = c(2, 4), K = K, h = 20, order = 1:K, mode = "exhaustive_4way", var_names = c("IntRate","GDP","Inflation","Wages")) plot_tca(res, target = 3)K <- 4 A1 <- matrix(c(0.7,-0.1,0.05,-0.05, -0.3,0.6,0.10,-0.10, -0.2,0.1,0.70,0.05, -0.1,0.2,0.05,0.65), K, K, byrow=TRUE) Sigma <- matrix(c(1,0.3,0.2,0.1, 0.3,1.5,0.25,0.15, 0.2,0.25,0.8,0.1, 0.1,0.15,0.1,0.6), K, K, byrow=TRUE) Phi0 <- t(chol(Sigma)) sf <- tca_systems_form(Phi0, list(A1), h = 20) res <- tca_analyze(from = 1, B = sf$B, Omega = sf$Omega, intermediates = c(2, 4), K = K, h = 20, order = 1:K, mode = "exhaustive_4way", var_names = c("IntRate","GDP","Inflation","Wages")) plot_tca(res, target = 3)
S3 print method for tca_result objects. Displays a formatted
table of transmission channel contributions across horizons.
## S3 method for class 'tca_result' print(x, target = NULL, ...)## S3 method for class 'tca_result' print(x, target = NULL, ...)
x |
A |
target |
Target variable to display (default: first intermediate). |
... |
Additional arguments (ignored). |
Invisibly returns x.
Decomposes impulse response functions into transmission channel contributions using the methodology of Wegner, Lieb, Smeekes (2025).
Three decomposition modes are supported:
"overlapping"Each channel is through(j) = total - not_through(j). Channels may overlap, so their sum may differ from the total.
"exhaustive_3way"(2 intermediates only) Non-overlapping: (1) through var1 inclusive, (2) through var2 only, (3) direct. Sum equals total.
"exhaustive_4way"(2 intermediates only) Full inclusion-exclusion: (1) var1 only, (2) var2 only, (3) both, (4) direct. Sum equals total.
tca_analyze(from, B, Omega, intermediates, K, h, order, mode = "overlapping", var_names = NULL)tca_analyze(from, B, Omega, intermediates, K, h, order, mode = "overlapping", var_names = NULL)
from |
Shock variable number (1-based). |
B |
Systems form B matrix (from |
Omega |
Systems form Omega matrix. |
intermediates |
Integer vector of intermediate variable numbers (1-based, original ordering). |
K |
Number of variables. |
h |
Maximum horizon. |
order |
Transmission ordering vector. |
mode |
Decomposition mode: |
var_names |
Character vector of variable names (optional). |
A list of class "tca_result" with components:
Matrix (h+1) x K of total IRFs.
Named list of channel IRF matrices, each (h+1) x K.
Character vector of channel names.
Decomposition mode used.
Shock variable number.
Number of variables.
Maximum horizon.
Transmission ordering.
Variable names.
Wegner, E., Lieb, L., Smeekes, S. (2025). Transmission Channel Analysis in Dynamic Models. arXiv:2405.18987.
# Monetary policy model K <- 4 A1 <- matrix(c(0.7,-0.1,0.05,-0.05, -0.3,0.6,0.10,-0.10, -0.2,0.1,0.70,0.05, -0.1,0.2,0.05,0.65), K, K, byrow=TRUE) Sigma <- matrix(c(1,0.3,0.2,0.1, 0.3,1.5,0.25,0.15, 0.2,0.25,0.8,0.1, 0.1,0.15,0.1,0.6), K, K, byrow=TRUE) Phi0 <- t(chol(Sigma)) sf <- tca_systems_form(Phi0, list(A1), h = 20) result <- tca_analyze(from = 1, B = sf$B, Omega = sf$Omega, intermediates = c(2, 4), K = K, h = 20, order = 1:K, mode = "exhaustive_4way", var_names = c("IntRate","GDP","Inflation","Wages")) print(result)# Monetary policy model K <- 4 A1 <- matrix(c(0.7,-0.1,0.05,-0.05, -0.3,0.6,0.10,-0.10, -0.2,0.1,0.70,0.05, -0.1,0.2,0.05,0.65), K, K, byrow=TRUE) Sigma <- matrix(c(1,0.3,0.2,0.1, 0.3,1.5,0.25,0.15, 0.2,0.25,0.8,0.1, 0.1,0.15,0.1,0.6), K, K, byrow=TRUE) Phi0 <- t(chol(Sigma)) sf <- tca_systems_form(Phi0, list(A1), h = 20) result <- tca_analyze(from = 1, B = sf$B, Omega = sf$Omega, intermediates = c(2, 4), K = K, h = 20, order = 1:K, mode = "exhaustive_4way", var_names = c("IntRate","GDP","Inflation","Wages")) print(result)
Decomposes the total IRF into the effect passing through a variable and the effect not passing through it. This is an exact decomposition (residual is zero at machine precision).
tca_decompose_binary(from, B, Omega, var_idx, K, h, order)tca_decompose_binary(from, B, Omega, var_idx, K, h, order)
from |
Shock variable (1-based). |
B |
Systems form B matrix. |
Omega |
Systems form Omega matrix. |
var_idx |
Variable to decompose through (1-based). |
K |
Number of variables. |
h |
Maximum horizon. |
order |
Transmission ordering. |
A list with matrices total, through,
not_through (each (h+1) x K).
Extracts coefficient matrices and residual covariance from a fitted VAR model (from the vars package) and runs TCA.
tca_from_var(var_model, from, intermediates, h = 20, order = NULL, mode = "overlapping", identification = "cholesky", Phi0 = NULL)tca_from_var(var_model, from, intermediates, h = 20, order = NULL, mode = "overlapping", identification = "cholesky", Phi0 = NULL)
var_model |
A fitted VAR model object from |
from |
Shock variable (integer or name). |
intermediates |
Integer vector or character vector of intermediate variable names. |
h |
Maximum horizon (default: 20). |
order |
Transmission ordering (default: variable ordering in the VAR). |
mode |
Decomposition mode: |
identification |
Identification scheme: |
Phi0 |
Manual impact matrix. Required if |
A tca_result object (see tca_analyze).
library(vars) data(Canada) var_est <- VAR(Canada, p = 2, type = "const") result <- tca_from_var(var_est, from = "e", intermediates = c("prod", "rw"), h = 20, mode = "exhaustive_4way") plot_tca(result, target = "U")library(vars) data(Canada) var_est <- VAR(Canada, p = 2, type = "const") result <- tca_from_var(var_est, from = "e", intermediates = c("prod", "rw"), h = 20, mode = "exhaustive_4way") plot_tca(result, target = "U")
Constructs both B and Omega matrices for the systems form representation x = Bx + Omega*epsilon, following the methodology of Wegner, Lieb, Smeekes (2025).
tca_systems_form(Phi0, As, h, order = NULL, Psis = NULL)tca_systems_form(Phi0, As, h, order = NULL, Psis = NULL)
Phi0 |
Structural impact matrix (K x K). For Cholesky
identification, use |
As |
List of VAR coefficient matrices (A_1, A_2, ..., A_p). |
h |
Maximum IRF horizon. |
order |
Transmission ordering vector (default: |
Psis |
List of reduced-form MA coefficients (optional, for DSGE/VARMA models). |
A list with components:
Systems form B matrix (K*(h+1) x K*(h+1)).
Systems form Omega matrix (K*(h+1) x K*(h+1)).
Wegner, E., Lieb, L., Smeekes, S. (2025). Transmission Channel Analysis in Dynamic Models. arXiv:2405.18987. https://github.com/enweg/tca-matlab-toolbox
# 2-variable VAR(1) Phi0 <- matrix(c(1, 0.3, 0, 0.95), 2, 2) As <- list(matrix(c(0.5, -0.1, 0.2, 0.4), 2, 2)) sf <- tca_systems_form(Phi0, As, h = 10) dim(sf$B) # 22 x 22# 2-variable VAR(1) Phi0 <- matrix(c(1, 0.3, 0, 0.95), 2, 2) As <- list(matrix(c(0.5, -0.1, 0.2, 0.4), 2, 2)) sf <- tca_systems_form(Phi0, As, h = 10) dim(sf$B) # 22 x 22
Tests that total = through(j) + not_through(j) holds for all variables at machine precision. This is a diagnostic to verify correct implementation.
tca_validate_additivity(from, B, Omega, K, h, order, var_names = NULL, verbose = TRUE)tca_validate_additivity(from, B, Omega, K, h, order, var_names = NULL, verbose = TRUE)
from |
Shock variable (1-based). |
B |
Systems form B matrix. |
Omega |
Systems form Omega matrix. |
K |
Number of variables. |
h |
Maximum horizon. |
order |
Transmission ordering. |
var_names |
Character vector of variable names (optional). |
verbose |
Logical; print results? Default |
Invisibly returns TRUE if all tests pass.