Matlab Toolbox for Transmission Channel Analysis

The MATLAB Toolbox for Transmission Channel Analysis provides a suite of functions for conducting transmission channel analysis (TCA) in MATLAB. It includes both standard methods—which are sufficient for most users—and more advanced, customisable techniques.

This overview focuses on the standard methods. Advanced options are described in the Advanced Section, and implementation details can be found in the Internals Section. For practical demonstrations, see the Examples.

Before performing any transmission analysis, add the TCA toolbox to MATLAB’s search path. Update the paths below to match the location of the toolbox on your system:

% General functions
addpath("~/Documents/repos/tca-matlab-toolbox/")
% Models
addpath("~/Documents/repos/tca-matlab-toolbox/models/")
% Plotting functions
addpath("~/Documents/repos/tca-matlab-toolbox/plotting/")

A typical transmission channel analysis workflow consists of the following steps:

  1. Define and estimate a model
  2. Compute total effects
  3. Construct a transmission matrix
  4. Define transmission channels
  5. Compute transmission effects
  6. Visualise results

The sections that follow document the functions available for each of these steps.

1. Defining and estimating a model.

The first step in transmission channel analysis is to define a model. This model will be used to derive total dynamic causal effects (impulse response functions) and to decompose these effects into effects along transmission channels. The TCA toolbox currently supports the following model types:

  • Vector Autoregressions (VARs) for baseline dynamic modelling, estimated via OLS without structural identification.
  • Structural VARs (SVARs) with recursive and internal identification schemes.
  • Local projections with recursive and external instrument identification schemes.
  • DSGE models computed via Dynare.

Each model class extends the abstract type Model. Detailed descriptions of each model follow.

Vector Autoregressions (VARs)

A VAR model can be defined using the VAR class and its constructor as shown below:

VAR Vector Autoregressive (VAR) model in matrix form.

A VAR of lag order p is specified as:

y_t = C e_t + B_1 y_{t-1} + ... + B_p y_{t-p} + u_t

where: - e_t is a vector of deterministic components (constant, trends, etc). - C, B_i are conformable coefficient matrices. - u_t is vector white noise.

Compac```{.matlab}orm:

y_t' = z_t' B_+' + u_t'

with: - z_t = [e_t; y_{t-1}; ...; y_{t-p}] - B_+ = [C, B_1, ..., B_p]

Stacking from ```{.matlab} p+1 to T:

Y = X B_+' + U

Properties

  • B (matrix): Coefficient matrix `[C B_1 … B_p].
  • SigmaU (matrix): Covariance matrix of the error term.
  • p (integer): Lag order of the VAR.
  • trendExponents (vector): Time trend exponents (e.g., [0, 1] implies constant and linear trend).
  • inputData (table or matrix): Original data used to estimate the VAR.
  • Y (matrix): Left-hand side outcomes y_t, size (T-p) x k.
  • X (matrix): Right-hand side regressors z_t, size (T-p) x (k*p + m) where m is the number of deterministic domponents.
  • U (matrix): Residuals u_t, size (T-p) x k.
  • Yhat (matrix): Fitted values X * B_+', size (T-p) x k.

VAR Construct a VAR(p) model.

obj = VAR(data, p, varargin) creates a VAR with lag length p based on the provided dataset.

Arguments

  • data (table or matrix): Input dataset for the VAR model.
  • p (integer): Lag order of the VAR.
  • varargin: Name-value pairs for optional arguments:
  • trendExponents (vector): Exponents for deterministic trends. Defaults to [0] (constant term).
  • B (matrix): Coefficient matrix. Default is empty (must be estimated).
  • SigmaU (matrix): Covariance matrix of residuals. Default is empty (must be estimated).

Returns

  • obj (VAR): A VAR model.

See also fit, simulate

The constructor requires a dataset in matrix or table form, with each column representing a variable and each row an observation, ordered from earliest to latest. For example:

% data is some dataset in matrix or table form
p = 2  % lag length
mode = VAR(data, p)

You can include deterministic trends by specifying the trendExponents option:

p = 2  % lag length
mode = VAR(data, p, 'trendExponents', 0:1)

Here, 0:1 indicates a constant (\(t^0\)) and a linear trend (\(t^1\)). For constant, linear, and quadratic trends use 0:2, or [0,2] to skip the linear term.

To estimate the VAR via OLS, call fit:

fit Estimate the VAR model using ordinary least squares (OLS).

Arguments

  • obj (VAR): VAR model object.
% if model is a VAR 
model.fit()

Retrieve estimates with:

coeffs Return the VAR coefficient matrix.

B = coeffs(obj, excludeDeterministic) returns the VAR coefficient matrix [C, B_1, ..., B_p]. If excludeDeterministic is true, returns [B_1, ..., B_p] instead, excluding deterministic components.

Arguments

  • obj (VAR): VAR model object.
  • excludeDeterministic (logical, optional): If true, exclude coefficients on deterministic components. Defaults to false.

Returns

  • B (matrix): VAR coefficient matrix.

fitted Return the fitted values of the VAR model.

Yhat = fitted(obj) returns the matrix of fitted values with size (T-p) x k, where T is the number of observations and k is the number of variables.

Arguments

  • obj (VAR): VAR model object.

Returns

  • Yhat (matrix): Matrix of fitted values.

residuals Return the residuals of the VAR model.

U = residuals(obj) returns the matrix of VAR residuals with size (T-p) x k, where T is the number of observations and k is the number of variables.

Arguments

  • obj (VAR): VAR model object.

Returns

  • U (matrix): Matrix of residuals.
% All coefficients
model.coeffs()  
% Excluding constants/trends
model.coeffs(true)
% Fitted values
model.fitted()
% Residuals
model.residuals()

To select the optimal lag length automatically, use fitAndSelect. This method fits VAR models for every lag length from 0 up to the specified maximum, evaluates each using the chosen information criterion (AIC by default), and returns the model with the lowest criterion value along with a table of lag lengths and their corresponding scores:

fitAndSelect Estimate and select the best VAR model by IC.

[modelBest, icTable] = fitAndSelect(obj, icFunction) fits the VAR model for different lag lengths and selects the one minimizing the information criterion. Maximum lag length is given by the lag length of the provided model.

Arguments

  • obj (VAR): VAR model object.
  • icFunction (function handle, optional): Information criterion function to minimize. Defaults to aic.

Returns

  • modelBest (VAR): Best fitting model.
  • icTable (table): Table of lag lengths and IC values.

See also fit, aic, bic, hqc, sic

% Choosing a maximum of 20 lags
model = VAR(data, 20);
[modelBest, icTable] = model.fitAndSelect();

fitAndSelect supports the following information criteria. Note the underscore suffix (_) on these functions.

aic_ Compute Akaike Information Criterion (AIC).

val = aic_(SigmaU, nCoeffs, T) returns the AIC value given the residual covariance matrix, number of coefficients, and sample size.

Arguments

  • SigmaU (matrix): Covariance matrix of the VAR residuals.
  • nCoeffs (integer): Total number of estimated coefficients.
  • T (integer): Number of effective observations.

Returns

  • val (number): Computed AIC value.

bic_ Compute Bayesian Information Criterion (SIC/BIC).

val = sic_(SigmaU, nCoeffs, T) returns the BIC value given the residual covariance matrix, number of coefficients, and sample size.

Arguments

  • SigmaU (matrix): Covariance matrix of the VAR residuals.
  • nCoeffs (integer): Total number of estimated coefficients.
  • T (integer): Number of effective observations.

Returns

  • val (number): Computed BIC value.

Notes

  • BIC is the same as SIC.

sic_ Compute Schwarz Information Criterion (SIC/BIC).

val = sic_(SigmaU, nCoeffs, T) returns the SIC value given the residual covariance matrix, number of coefficients, and sample size.

Arguments

  • SigmaU (matrix): Covariance matrix of the VAR residuals.
  • nCoeffs (integer): Total number of estimated coefficients.
  • T (integer): Number of effective observations.

Returns

  • val (number): Computed SIC value.

hqc_ Compute Hannan-Quinn Information Criterion (HQC).

val = hqc_(SigmaU, nCoeffs, T) returns the HQC value given the residual covariance matrix, number of coefficients, and sample size.

Arguments

  • SigmaU (matrix): Covariance matrix of the VAR residuals.
  • nCoeffs (integer): Total number of estimated coefficients.
  • T (integer): Number of effective observations.

Returns

  • val (number): Computed HQC value.

For example, to use the Bayesian Information Criteria, call:

model = VAR(data, 20);
[modelBest, icTable] = model.fitAndSelect(@VAR.bic_);

To compute information criteria for an already estimated model over its own sample, use methods without the trailing underscore. Note these values may differ from those returned by fitAndSelect, which evaluates ICs over a common sample across all models:

aic Compute Akaike Information Criterion (AIC) for VAR model.

Arguments

  • obj (VAR): VAR model object.

Returns

  • val (number): AIC value.

See also hqc, sic, bic, fit

bic Compute Bayesian Information Criterion (BIC) for VAR model.

Arguments

  • obj (VAR): VAR model object.

Returns

  • val (number): BIC value.

See also aic, hqc, sic, fit

sic Compute Schwarz Information Criterion (SIC) for VAR model.

Arguments

  • obj (VAR): VAR model object.

Returns

  • val (number): SIC value.

See also aic, hqc, bic, fit

hqc Compute Hannan-Quinn Criterion (HQC) for VAR model.

Arguments

  • obj (VAR): VAR model object.

Returns

  • val (number): HQC value.

See also aic, sic, bic, fit

# Get the HQC value for an estimated model
model.hqc()

Structural Vector Autoregressions (SVARs)

An SVAR can be defined using the SVAR class and its constructor as documented below:

SVAR Structural Vector Autoregressive (SVAR) model.

An SVAR of lag order p is specified as:

A0 y_t = C e_t + A1 y_{t-1} + ... + Ap y_{t-p} + \varepsilon_t

where: - e_t is a vector of deterministic components (constant, trends). - C, A0, Ai are conformable matrices. - \varepsilon_t are structural shocks.

Assuming A0 is invertible, the model can be rewritten as a reduced-fo```{.matlab}VAR:

y_t'A0' = z_t' A_+' + u_t'

where: - z_t = [e_t; y_{t-1}; ...; y_{t-p}] - A_+ = [C, A_1, ..., A_p]

Assuming A0 is invertible, the reduced-form VAR ca```{.matlab}e obtained as

y_t' = z_t' A_+'(A_0')^{-1} + u_t'(A_0')^{-1}

which can be represented using a VAR object.

Properties

  • A0 (matrix): Contemporaneous coefficient matrix.
  • APlus (matrix): Stacked coefficient matrix [C A1 ... Ap].
  • p (integer): Lag order of the (S)VAR model.
  • trendExponents (vector): Time trend exponents (e.g., [0, 1]).
  • VARModel (VAR): Reduced-form VAR representation.

See also VAR

SVAR Construct a Structural VAR (SVAR) model object.

obj = SVAR(data, p, varargin) creates an SVAR object with lag length p, based on the provided dataset and structural specification.

Arguments

  • data (table or matrix): Input dataset for the SVAR model.
  • p (integer): Lag order of the SVAR.
  • varargin: Name-value pairs for optional arguments:
  • trendExponents (vector): Exponents for deterministic trends. Defaults to [0] (constant term).
  • A0 (matrix): Contemporaneous coefficient matrix.
  • APlus (matrix): Stacked coefficient matrix [A1, ..., Ap].
  • VARModel (VAR): Precomputed reduced-form VAR model.

Returns

  • obj (SVAR): Constructed SVAR model object.

Notes

  • If VARModel, A0, APlus are not provided, they are estimated from the data.

See also VAR

The constructor requires a dataset in matrix or table form, with each column representing a variable and each row an observation, ordered from earliest to latest. For example, to specify a lag order of four (p = 4):

p = 4  % lag length
model = SVAR(data, p)

You may include deterministic trends as for the VAR case, using the trendExponents option:

p = 4  % lag length
model = SVAR(data, p, 'trendExponents', 0:1)

To estimate the structural model, an identification method must be provided. Only recursive identification (Recursive) is supported for full structural identification. Note that InternalInstrument methods can be used to identify impulse responses to a single shock; these are documented in a later section. Fit the model as follows:

fit Estimate the SVAR model using an identification method.

fit(obj, identificationMethod) first fits the reduced-form VAR model using ordinary least squares (OLS), then identifies the structural matrices using the provided identification method.

Arguments

  • obj (SVAR): SVAR model object.
  • identificationMethod (object): An object of type IdentificationMethod used to identify A0 and APlus.

Notes

  • identificationMethod must implement an identify method taking a VAR object and returning A0 and APlus.

See also VAR.fit, IdentificationMethod

model.fit(Recursive())

After fitting, extract coefficients, fitted values, and residuals:

coeffs Return the SVAR coefficient matrices.

[A0, APlus] = coeffs(obj, excludeDeterministic) returns the contemporaneous matrix A0 and the lag coefficient matrix APlus for the SVAR model.

Arguments

  • obj (SVAR): SVAR model object.
  • excludeDeterministic (logical, optional): If true, exclude coefficients on deterministic components from APlus. Defaults to false.

Returns

  • A0 (matrix): Contemporaneous coefficient matrix.
  • APlus (matrix): Coefficient matrix. If excludeDeterministic is true, returns only lag matrices [A1 ... Ap]. Otherwise APlus = [C A_1 ... A_p] is returned.

fitted Return the fitted values of the SVAR model.

Yhat = fitted(obj) returns the fitted values from the reduced-form VAR model associated with the SVAR.

Arguments

  • obj (SVAR): SVAR model object.

Returns

  • Yhat (matrix): Matrix of fitted values (T-p) x k.

residuals Return the residuals of the SVAR model.

U = residuals(obj) returns the residuals from the reduced-form VAR model associated with the SVAR.

Arguments

  • obj (SVAR): SVAR model object.

Returns

  • U (matrix): Matrix of residuals (T-p) x k.
% Structural coefficient matrices A0 and APlus
[A0, APlus] = model.coeffs()
% Excluding constants and time trends
[A0, APlus] = model.coeffs(true)
% Fitted values
model.fitted()
% Residuals
model.residuals()

You can select the lag length automatically via fitAndSelect, which first determines the best reduced‑form VAR up to the maximum lag and then applies the chosen identification method:

fitAndSelect Estimate and select the best SVAR model by IC.

[modelBest, icTable] = fitAndSelect(obj, identificationMethod, icFunction) fits the SVAR model for different lag lengths and selects the one minimizing the information criterion. The maximuml lag length is determined by the lag length of the given model.

Arguments

  • obj (SVAR): SVAR model object.
  • identificationMethod (IdentificationMethod): Identification method for SVAR.
  • icFunction (function handle, optional): Information criterion function to minimize. Defaults to aic.

Returns

  • modelBest (SVAR): Best fitting SVAR model.
  • icTable (table): Table of lag lengths and IC values.

Notes

  • Maximum lag length is given by the lag length of the provided model.

See also SVAr.fit, aic, bic, hqc, sic, VAR.fitAndSelect

Using AIC (default) with a maximum of twenty lags:

model = SVAR(data, 20);
[modelBest, icTable] = model.fitAndSelect(Recursive())

Or using HQC for model selection:

model = SVAR(data, 20);
[modelBest, icTable] = model.fitAndSelect(Recursive(), @VAR.hqc_)

All VAR information‑criterion functions (with underscore) may be supplied to choose the optimal SVAR.

Local Projections

A local projection model can be specified using the LP class and its constructor:

LP Local Projection (LP) model for estimating IRFs.

Local Projection (LP) model for estimating impulse response functions (IRFs) in a flexible and semi-parametric manner.

Each LP regression estimates the dynamic response of an outcome variable at future horizon h to a one-period change in a treatment variable at time t, controlling for contemporaneous and lagged covariates.

The regression model is specified as:

w_{i,t+h} = \mu_{i,h} + \theta_{i,h} x_t + \gamma_{i,h}' r_t +
\sum_{l=1}^p \delta_{i,h,l} w_{t-l} + \xi_{i,h,t}

where w_t = (r_t', x_t, q_t') and: - x_t is the treatment variable - r_t contains contemporaneous controls (all variables before x_t) - p is the number of lags included - \theta_{i,h} is the relative IRF of x_t on the i-th variable at horizon h.

The treatment variable may be endogenous. Structural interpretation of IRFs can be achieved using valid instruments—see ExternalInstrument for one such method. If the treatment satisfies a conditional ignorability assumption (a recursive assumption in macro), then the coefficient has a structural interpretation even without the use of instruments. For this to hold, x_t - E(x_t|r_t, w_{t-1}, ..., w_{t-p}) must be equal to the structural shock.

Properties

  • data (table or matrix): Input time series dataset.
  • treatment (char or integer): Treatment variable.
  • p (integer): Number of lags.
  • horizons (vector): Forecast horizons for projections.
  • includeConstant (logical): Whether to include an intercept.
  • B (array): Coefficient estimates per horizon.
  • Y (array): Dependent variables per horizon.
  • X (matrix): Common regressor matrix.
  • U (array): Residuals per horizon.
  • Yhat (array): Fitted values per horizon.

LP Construct a Local Projection (LP) model object.

obj = LP(data, treatment, p, horizons, varargin) initializes an LP object for estimating impulse response functions.

Arguments

  • data (matrix or table): Input time series dataset.
  • treatment (char or int): Treatment variable.
  • p (integer): Lag length.
  • horizons (vector): Forecast horizons.
  • varargin: Name-value pairs for options:
  • includeConstant (logical): Include constant in regressors (Defaults to true).

The constructor requires:

  • A dataset in matrix or table form
  • A treatment variable (either the shock itself or the instrumented variable)
  • The number of lags (p)
  • A vector of horizons (horizons)

For example, to estimate horizons \(0\)\(20\) with 4 lags for treatment variable Y1:

model = LP(data, 'Y1', 4, 0:20)

By default, each regression includes a constant term. To omit the constant, set the includeConstant flag to false:

model = LP(data, 'Y1', 4, 0:20, 'includeConstant', false)

Use the fit method to estimate the projections:

fit Estimate the LP model with an identification method.

fit(obj, identificationMethod) estimates the LP model, identifying causal effects with respect to the treatment.

Arguments

  • obj (LP): LP model object.
  • identificationMethod (object, optional): Identification method. Must be of type IdentificationMethod. Defaults to Recursive.

See also coeffs, fitted, residuals, Recursive

% Uses Recursive by default
model.fit()

By default, fit applies a recursive (conditional ignorability) assumption. These estimates are structural only if the true shock satisfies this assumption; otherwise, they should be treated as reduced‐form.

Available identification schemes:

  • Recursive (default)
  • ExternalInstrument (for external‐instrument IV)

ExternalInstrument Identify IRFs using external instruments.

This class identifies structural IRFs from (S)VARs using the external instrument approach proposed by Stock and Watson (2018).

Notes

  • IRFs are computed relative to the reaction of the treatment variable at normalisingHorizon.
  • instruments must be a matrix or table spanning the same period as the model data.
  • Defaults:
  • normalisingHorizon = 0

Reference

  • Stock, J. H., & Watson, M. W. (2018). “Identification and Estimation of Dynamic Causal Effects in Macroeconomics Using External Instruments.” The Economic Journal, 128(610), 917-948. [https://doi.org/10.1111/ecoj.12593]

See also IdentificationMethod, Recursive, InternalInstrument

To use an external instrument, first instantiate ExternalInstrument with the treatment name and an instrument dataset, then supply it to fit:

method = ExternalInstrument('Y1', data_instruments);
% Estimate the local projection using external instruments
model.fit(method);

After estimation, extract the results (note the differing dimensions) via:

  • coeffs: (response variable × regressors × horizons)
  • fitted, residuals: (observations × variables × horizons)

coeffs Return coefficient estimates from LP model.

B = coeffs(obj, excludeDeterministic) returns the estimated coefficients from the fitted LP model.

Arguments

  • obj (LP): LP model object.
  • excludeDeterministic (logical, optional): If true, excludes constant terms from the coefficients. Defaults to false.

Returns

  • B (3D array): Coefficients array with dimensions:
  • First dimension: Outcome variable.
  • Second dimension: Regressors.
  • Third dimension: Horizon.

See also fit

fitted Return the fitted values from the LP model.

Yhat = fitted(obj) returns the fitted values obtained from the local projection regressions.

Arguments

  • obj (LP): LP model object.

Returns

  • Yhat (3D array): Fitted values with dimensions:
  • First dimension: Time.
  • Second dimension: Outcome variable.
  • Third dimension: Horizon.

See also residuals, coeffs, fit

residuals Return residuals from the LP model.

U = residuals(obj) returns the residuals from the local projection regressions.

Arguments

  • obj (LP): LP model object.

Returns

  • U (3D array): Residuals with dimensions:
  • First dimension: Time.
  • Second dimension: Outcome variable.
  • Third dimension: Horizon.

See also fitted, coeffs, fit

# Coefficients
model.coeffs()
# Excluding the constant 
model.coeffs(true)
# Fitted values
model.fitted()
# Residuals
model.residuals()

To select the lag order automatically, use fitAndSelect, which fits VARs internally to choose the optimal p:

fitAndSelect Select optimal lag length for LP model.

[modelBest, icTable] = fitAndSelect(obj, identificationMethod, icFunction) selects the optimal lag length based on an equivalent VAR model.

Arguments

  • obj (LP): LP model object.
  • identificationMethod (IdentificationMethod, optional): Identification method. Defaults to Recursive.
  • icFunction (function handle, optional): Information criterion function to minimize. Defaults to aic.

Returns

  • modelBest (LP): Best fitting LP model.
  • icTable (table): Table of lag lengths and IC values.

Notes

  • Maximum lag length considered is the lag length of obj.

See also fit, VAR.fitAndSelect, Recursive

All VAR underscore‑suffixed information‑criterion functions (e.g., aic_, bic_, sic_, hqc_) may be used for LP lag selection. For example, using BIC:

model = LP(data, 'Y1', 20, 0:20);
[modelBest, icTable] = model.fitAndSelect(Recursive(), @VAR.bic_);

DSGE

A DSGE model can be specified using the DSGE class. Before defining the model, you must compute its first‐order approximation in Dynare. Refer to Dynare’s manual for details.

DSGE Dynamic Stochastic General Equilibrium (DSGE) model.

This class specifies a DSGE model structure. The model must be previously computed using Dynare. It provides access to the Dynare output structures.

Properties

  • M_ (struct): Model structure returned by Dynare.
  • options_ (struct): Options structure from Dynare.
  • oo_ (struct): Output structure with results from Dynare.

Notes

  • The model must have already been solved in Dynare.
  • This class serves as a wrapper to interface with Dynare output.

Once Dynare has run, the workspace should contain the structures M_, oo_, and options_. Use these to define your DSGE model:

model = DSGE(M_, options_, oo_)

The TCA toolbox represents the DSGE as a VARMA model, whereas Dynare uses a state‐space form. For the VARMA representation to exist, the number of observed variables (varobs) must equal the number of structural shocks, and these observed variables must span the shock space. If this condition is not met, calling any method on the DSGE model will return an error.

To inspect the observed variables and structural shocks, use:

% Observed variables in the varobs block
varNames = model.getVariableNames();
% Structural shock names
shockNames = model.getShockNames();

2. Obtaining the effects – structural IRFs

Once a model is defined, you can compute total dynamic causal effects—impulse response functions (IRFs)—using the IRF method. The IRF function always requires a maximum horizon (maxHorizon) for computation. For reduced‐form models, you may also supply an IdentificationMethod to derive structural IRFs.

Details on IRF computation for all models are provided below.

VARs

Obtain reduced‐form IRFs from a VAR model by specifying the maximal horizon:

IRF Compute impulse response functions for the VAR model.

irfObj = IRF(obj, maxHorizon, varargin) computes IRFs up to horizon maxHorizon. If an identificationMethod is provided, structural IRFs are computed.

Arguments

  • obj (VAR): VAR model object.
  • maxHorizon (integer): Maximum horizon for IRFs.
  • varargin: Name-value pairs for options:
  • identificationMethod (an IdentificationMethod): Optional method to compute structural IRFs.

Returns

  • irfObj (IRFContainer): Object containing computed IRFs.

Notes

  • Without an identification method, reduced-form IRFs are computed.
  • With an identification method, structural IRFs are computed.

See also IRF_, IRFContainer, fit, IdentificationMethod

maxHorizon = 20;
irfObj = model.IRF(maxHorizon);

Here, irfObj is an IRFContainer holding both the IRF array and related metadata:

IRFContainer Container for storing impulse response functions.

This class holds IRFs, variable names, the originating model, and the identification method used (if any).

Properties

  • irfs (3D array): IRFs with dimensions:
  • First: Response variable.
  • Second: Shock.
  • Third: Horizon.
  • varnames (cell array): Names of response variables.
  • model (Model): Model used to compute the IRFs.
  • identificationMethod (IdentificationMethod):
  • Identification method if the model is reduced form.

Printing irfObj displays a 3D array with dimensions:

  1. Response variable
  2. Shock
  3. Horizon (starting at 0 for contemporaneous effect)

To retrieve the raw IRF array, call:

irfObj.getIrfArray()

To compute structural IRFs, supply an IdentificationMethod. Supported methods include recursive and internal‐instrument schemes:

IdentificationMethod Abstract class for structural identification.

This abstract class specifies the interface for identification methods that recover structural models and IRFs from reduced-form models.

Required Methods

  1. irfs = identifyIrfs(obj, model, maxHorizon)
  • Identifies IRFs from the reduced form model.
  • Returns a 3D array with dimensions: (response variable, shock, horizon).
  • IRFs should be computed up to maxHorizon.
  1. [varargout] = identify(obj, model)
  • Identifies the structural form of a reduced form model.
  • For SVARs from VARs:
  • varargout{1} = A0 (contemporaneous matrix)
  • varargout{2} = APlus (lag polynomial matrix)
  • For LPs:
  • varargout{1} = coefficient estimates per horizon.

Notes

  • See the Recursive class for an example implementation.

See also Recursive, SVAR, LP

Recursive Identify reduced-form models using recursivity.

This class implements identification under a recursive (Cholesky) structure, assuming conditional ignorability.

Notes

  • For SVARs, this corresponds to Cholesky identification.
  • For LPs, it assumes conditioning on prior ordered variables.
  • Commonly used in macroeconomics when contemporaneous shocks are assumed to have a lower triangular impact.

See also IdentificationMethod, SVAR, LP

InternalInstrument Identify IRFs using internal instruments.

This class identifies impulse responses in (S)VARs using the internal instruments method proposed by Plagborg-Moller and Wolf (2021).

Notes

  • IRFs are computed from Cholesky-orthogonalized shocks with respect to the selected instrument.
  • Shocks are normalized by the response of the normalisingVariable at normalisingHorizon.
  • The instrument can be specified as an integer (index) or character (variable name).
  • Defaults:
  • instrument = 1 (first variable)
  • normalisingHorizon = 0

Reference

  • Plagborg-Moller, M., & Wolf, C. K. (2021). “Local Projections and VARs Estimate the Same Impulse Responses.” Econometrica, 89(2), 955-980. [https://doi.org/10.3982/ecta17813]

See also IdentificationMethod, Recursive

For a recursive identification:

irfObj = model.IRF(maxHorizon, 'IdentificationMethod', Recursive())

To use an internal instrument, specify a normalisingVariable, then optionally override the instrument (default: first variable) or the normalisingHorizon (default: 0 for contemporaneous effect):

normalisingVariable = 'Y2'
method = InternalInstrument(normalisingVariable)
irfObj = model.IRF(maxHorizon, 'IdentificationMethod', method)
% Changing the instrument to be Y2 and the normalisingVariable to be Y3
method = InternalInstrument('Y3', 'instrument', 'Y2')
% Changing the normalisingHorizon to be period 1
method = InternalInstrument('Y3', 'instrument', 'Y2', 'normalisingHorizon', 1)

SVARs

Impulse response functions can be obtained from an SVAR using the IRF function, analogous to the VAR case. Since an SVAR is already structurally identified, IRF returns structural IRFs directly:

IRF Compute structural impulse response functions for SVAR.

irfObj = IRF(obj, maxHorizon) computes structural IRFs up to horizon maxHorizon from an estimated SVAR model.

Arguments

  • obj (SVAR): SVAR model object.
  • maxHorizon (integer): Maximum horizon for IRFs.

Returns

  • irfObj (IRFContainer): Container with computed IRFs.

Notes

  • The IRFs have dimensions (k x k x (maxHorizon+1)):
  • First dimension: Responding variables.
  • Second dimension: Structural shocks.
  • Third dimension: Horizons.

See also VAR.IRF, ~IRFContainer`

Using SVARs and Internal Instruments

The SVAR.IRF method requires a fully identified SVAR. Internal instruments (via InternalInstrument) cannot be applied to an SVAR directly. To use internal instruments for IRF identification, first define a reduced‐form VAR, apply the instrument there, and then compute IRFs:

model = VAR(data, p);
normalisingVariable = 'Y2';
method = InternalInstrument(normalisingVariable);
irfObj = model.IRF(maxHorizon, 'identificationMethod', method);

Local Projections

Impulse response functions can be obtained from an estimated LP model using IRF. These IRFs are structural whenever the LP model was estimated structurally.

IRF Compute impulse response functions from LP model.

irfObj = IRF(obj, maxHorizon, varargin) computes IRFs up to maxHorizon based on the LP model.

Arguments

  • obj (LP): LP model object.
  • maxHorizon (integer): Maximum forecast horizon.
  • varargin: Name-value pairs for options:
  • identificationMethod (optional): Identification method.

Returns

  • irfObj (IRFContainer): Container with computed IRFs.

Notes

  • If identificationMethod is provided, LP is refitted first.
  • The IRFs have dimensions (k x k x (maxHorizon+1)):
  • First dimension: Responding variables.
  • Second dimension: Shocks.
  • Third dimension: Horizon.

See also fit, IRFContainer

irfObj = model.IRF(maxHorizon)

Optionally, supply an identification method (Recursive or ExternalInstrument) to re-estimate the local projection and compute IRFs under that scheme:

% USing recursive identification
irfObj = model.IRF(maxHorizon, 'identificationMethod', Recursive())
% Using external instruments
method = ExternalInstrument('Y1', data_instruments);
irfObj = model.IRF(maxHorizon, 'identificationMethod', method);

DSGE

If a VARMA representation of the DSGE model exists, compute IRFs for the varobs variables via IRF:

IRF Compute impulse response functions for DSGE model.

irfObj = IRF(obj, maxHorizon) computes IRFs of the DSGE model up to horizon maxHorizon.

Arguments

  • obj (DSGE): DSGE model object.
  • maxHorizon (integer): Maximum forecast horizon.

Returns

  • irfObj (IRFContainer): Container with computed IRFs.

Notes

  • Uses VARMA representation for IRF computation.

See also coeffs, dynareToVarma_, varmaIrfs_

maxHorizon = 20;
irfObj = model.IRF(maxHorizon);

3. Defining a transmission matrix.

The next step in a transmission channel analysis is to define the transmission matrix, which specifies the ceteris paribus ordering of variables in the chosen equilibrium representation. The simplest way is to list the variables in the desired order as a cell array of char. For example, if your data contains Y1, Y2, Y3, and Y4, and you wish to order them as Y4, Y2, Y1, Y3, define:

transmissionOrdering = {'Y4', 'Y2', 'Y1', 'Y3'};

Note: The ordering must be a cell array of character vectors (not string arrays).

Advanced methods for constructing transmission matrices are covered in the Advanced Methods Section.

4. Definining transmission channels.

With the transmission matrix in place, you can specify transmission channels of interest via the helper functions through and notThrough. These functions return a transmission condition Q that you can combine to define complex transmission channels. More advanced methods for defining transmission channels are documented in the Advanced Methods Section.

Q Represents a transmission condition.

The Q class is used to define transmission conditions based on Boolean statements. A transmission condition is denoted as \(Q(b)\), where \(b\) is a Boolean statement involving variables x<num>, such as x1, x2, etc. Boolean statements should only contain AND (&) and NOT (!) operations.

Properties

  • vars (cell array of strings): Contains the Boolean variable expressions.
  • multiplier (vector of numbers): Multipliers associated with each term.

Methods

  • Q: Constructor to create a transmission condition.
  • and: Overloads & (logical AND) for Q objects.
  • or: Overloads | (logical OR) for Q objects.
  • not: Overloads ~ (logical NOT) for Q objects.
  • disp: Custom display function.
  • display: Calls disp for better formatting.

Usage

% Define variables as transmission conditions
x = arrayfun(@(i) Q(sprintf('x%d', i)), 1:10);
q = (x(1) | x(2)) & ~x(3);

% Alternatively, define variables separately
x1 = Q('x1');
x2 = Q('x2');
x3 = Q('x3');
q = (x1 | x2) & ~x3;

% Creating Q objects with multipliers
q = Q('x1 & !x3', 1);
q = Q({'x1', 'x2', 'x1 & x2'}, [1, 1, -1]);

Notes

  • The recommended constructor is Q(i), where i is an integer representing a variable index.
  • Other constructors are for internal use and may lead to incorrect results if misused.
  • DO NOT use OR (|) inside the string input for Q, as it is not supported.

through

Use through to define channels that pass through specified variables at given horizons:

through Create a transmission condition enforcing paths through specific variables.

q = through(obj, vars, horizons, order) constructs a transmission condition q where paths must pass through specified variables at given time horizons.

Arguments

  • obj (object): A Model object.
  • vars (char or cell array of char): Name(s) of the variables that paths must go through.
  • horizons (vector or cell array of vectors): Time horizons at which the paths must pass through the variable(s).
  • order (char or cell array of char): Variable ordering defining the transmission matrix.

Returns

  • q (Q): A transmission condition that can be used in transmission to compute the transmission effect.

See also notThrough, transmission.

Examples (for any model — VAR, SVAR, LP, or DSGE — with transmissionOrder or a transmission matrix as described above):

  1. Channel through Y1 at horizons 0-3:
q = model.through('Y1', 0:3, transmissionOrder);
  1. Channel through Y1 and Y2 contemporaneously:
q = model.through({'Y1', 'Y2'}, 0, transmissionOrder);
  1. Channel through Y1 at horizon 0 and Y2 at horizons 0–1:
q = model.through({'Y1', 'Y2'}, {0:0, 0:1}, transmissionOrder);

notThrough

Use notThrough to define channels that do not go through specified variables at given horizons:

notThrough Create a transmission condition excluding specific variables from the channel.

q = notThrough(obj, vars, horizons, order) constructs a transmission condition q where paths cannot pass through specified variables at given time horizons.

Arguments

  • obj (object): A Model object.
  • vars (char or cell array of char): Name(s) of the variables that paths cannot go through.
  • horizons (vector or cell array of vectors): Time horizons at which the paths cannot pass through the variable(s).
  • order (char or cell array of char): Variable ordering defining the transission matrix.

Returns

  • q (Q): A transmission condition that can be used in transmission to compute the transmission effect.

See also through, transmission

Examples (for any model — VAR, SVAR, LP, or DSGE — with transmissionOrder or a transmission matrix as described above):

  1. Channel not through Y1 at horizons 0-20:
q = model.notThrough('Y1', 0:20, transmissionOrder);
  1. Channel not through Y1 and not through Y2 at horizons 0-20:
q = model.notThrough({'Y1', 'Y2'}, 0:20, transmissionOrder);
  1. Channel not through Y1 contemporaneously and not through Y2 at horizon 1:
q = model.notThrough({'Y1', 'Y2'}, {0:0, 1:1}, transmissionOrder);

Combining through and notThrough

Both through and notThrough return a transmission condition Q, which can be combined using logical operators:

  • AND (&): both conditions must be satisfied.
  • OR (|): at least one condition must be satisfied.
  • NOT (~): negates a condition.

Examples:

  1. Channel through Y1 contemporaneously but not through Y2 contemporaneously:
q1 = model.through('Y1', 0, transmissionOrder);
q2 = model.notThrough('Y2', 0, transmissionOrder);
q = q1 & q2;
  1. Channel through Y1 contemporaneously or not through Y2 contemporaneously:
q1 = model.through('Y1', 0, transmissionOrder);
q2 = model.notThrough('Y2', 0, transmissionOrder);
q = q1 | q2;
  1. Channel not through Y1 contemporaneously (both ways are equivalent):
q1 = model.through('Y1', 0, transmissionOrder);
q = ~q1;  # not through Y1 contemporaneously
q = model.notThrough('Y1', 0, transmissionOrder);
  1. Channel through Y1 in at least one period between horizons 0-20:
q = model.notThrough('Y1', 0:20, transmissionOrder);
q = ~q;

By combining through and notThrough with logical operators, you can flexibly construct any complex transmission channel you require. 

5. Obtaining transimssion effects.

Once you have defined a model (VAR, SVAR, LP, or DSGE), the transmission method computes transmission effects along your specified channel. Below are the details for each model type.

VAR, SVAR, or LP

For VAR, or for SVAR and LP models that have not yet been structurally estimated, you must provide an IdentificationMethod (since at least one structural shock is required):

transmission Compute transmission effects in a VAR model.

effects = transmission(obj, shock, condition, order, maxHorizon, varargin) computes the transmission effects of a shock under a condition, using the transmission matrix defined by order, up to maxHorizon.

Arguments

  • obj (VAR): VAR model object.
  • shock (integer): Index of the shock variable.
  • condition (Q): Transmission condition object.
  • order (cell array of char): Variable transmission ordering.
  • maxHorizon (integer): Maximum horizon.
  • varargin: Name-value pairs for options:
  • identificationMethod (IdentificationMethod): Required method to compute structural IRFs.

Returns

  • effects (3D array): Transmission effects over horizons, where:
  • First dimension: Endogenous variables (responses).
  • Second dimension: Shocks (of size one for the single selected shock).
  • Third dimension: Horizon.

See also VAR.through, VAR.notThrough

transmission Compute transmission effects in an SVAR model.

effects = transmission(obj, shock, condition, order, maxHorizon, varargin) computes the transmission effects of a shock under a condition, using the transmission matrix defined by order, up to maxHorizon.

Arguments

  • obj (SVAR): SVAR model object.
  • shock (integer): Index of the shock variable.
  • condition (Q): Transmission condition object.
  • order (cell array of char): Variable transmission ordering.
  • maxHorizon (integer): Maximum horizon.
  • varargin: Name-value pairs for options:
  • identificationMethod (IdentificationMethod, optional): Method to identify the SVAR if not yet fitted.

Returns

  • effects (3D array): Transmission effects over horizons, where:
  • First dimension: Endogenous variables (responses).
  • Second dimension: Shocks (only the selected shock).
  • Third dimension: Horizon.

Notes

  • If identificationMethod is provided, the model is fitted first.

See also SVAR.through, SVAR.notThrough, VAR.transmission

transmission Compute transmission effects in an LP model.

effects = transmission(obj, shock, condition, order, maxHorizon, varargin) computes transmission effects for a shock satisfying a condition, based on the ordering order, up to maxHorizon.

Arguments

  • obj (LP): LP model object.
  • shock (integer): Index of the shock variable.
  • condition (Q): Transmission condition object.
  • order (cell array of char): Variable transmission ordering.
  • maxHorizon (integer): Maximum horizon.
  • varargin: Name-value pairs for options:
  • identificationMethod (optional): Identification method.

Returns

  • effects (3D array): Transmission effects over horizons:
  • First dimension: Endogenous variables (responses).
  • Second dimension: Selected shock.
  • Third dimension: Horizon.

Notes

  • If identificationMethod is provided, the LP model is refitted.

See also LP.through, LP.notThrough, LP.IRF

For example, to compute the effects of the first structural shock up to maxHorizon, using a transmission matrix transmissionOrder and a transmission condition q:

% model can be VAR, SVAR, or LP
effects = model.transmission(
    1, ...                % shock index
    q, ...                % transmission condition
    transmissionOrder, ...% transmission matrix
    maxHorizon, ...       % maximum horizon
    'IdentificationMethod', method ... % Recursive, InternalInstrument (VAR/SVAR) or ExternalInstrument (LP)
);

The returned effects array has dimensions:

  1. Response variables (in original data order)
  2. Transmission effect of the chosen shock
  3. Horizons (starting at 0)

If your SVAR or LP model is already structurally identified (fitted with a structural identification scheme), you may omit the identification argument:

% model is a SVAR or structurally estimated LP
effects = model.transmission(1, q, transmissionOrder, maxHorizon)

DSGE

Since DSGE models are inherently structural and shocks can be named, you may specify the shock by name or index. No identification method is needed:

transmission Compute transmission effects in a DSGE model.

effects = transmission(obj, shock, condition, order, maxHorizon) computes the transmission effects for a shock under a condition based on order, up to maxHorizon.

Arguments

  • obj (DSGE): DSGE model object.
  • shock (char or int): Shock name or index.
  • condition (Q): Transmission condition object.
  • order (cell array or vector): Variable ordering.
  • maxHorizon (integer): Maximum forecast horizon.

Returns

  • effects (3D array): Transmission effects over horizons:
  • First dimension: Endogenous variables.
  • Second dimension: Selected shock.
  • Third dimension: Horizon.

Notes

  • shock and order can be provided by name or index.

See also DSGE.through, DSGE.notThrough

For example, if mp (monetary policy shock) is the first shock:

% By name
effects = model.transmission('mp', q, transmissionOrder, maxHorizon);

% By index (equivalent)
effects = model.transmission(1, q, transmissionOrder, maxHorizon);

6. Visualising effects.

To inspect transmission effects graphically, use the helper functions:

  • plotDecomposition Visualises a single transmission-channel decomposition of the IRFs.
  • plotCompareDecomposition: Compares two decompositions obtained from different transmission matrices.

See the Examples for usage demos.