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 functionsaddpath("~/Documents/repos/tca-matlab-toolbox/")% Modelsaddpath("~/Documents/repos/tca-matlab-toolbox/models/")% Plotting functionsaddpath("~/Documents/repos/tca-matlab-toolbox/plotting/")
A typical transmission channel analysis workflow consists of the following steps:
Define and estimate a model
Compute total effects
Construct a transmission matrix
Define transmission channels
Compute transmission effects
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
VAR Vector Autoregressive (VAR) model in matrix form.
A VAR of lag order p is specified as:
y_t=Ce_t+B_1y_{t-1} +...+B_py_{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.
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.VAR
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 formp=2% lag lengthmode=VAR(data,p)
You can include deterministic trends by specifying the trendExponents option:
p=2% lag lengthmode=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:
VAR.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:
VAR.coeffs
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.
VAR.fitted
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.
VAR.residuals
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 coefficientsmodel.coeffs() % Excluding constants/trendsmodel.coeffs(true)% Fitted valuesmodel.fitted()% Residualsmodel.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:
VAR.fitAndSelect
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 lagsmodel=VAR(data,20);[modelBest,icTable] =model.fitAndSelect();
fitAndSelect supports the following information criteria. Note the underscore suffix (_) on these functions.
VAR.aic_
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.
VAR.bic_
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.
VAR.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.
VAR.hqc_
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:
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:
VAR.aic
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
VAR.bic
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
VAR.sic
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
VAR.hqc
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
# GettheHQCvalueforanestimatedmodelmodel.hqc()
Structural Vector Autoregressions (SVARs)
An SVAR can be defined using the SVAR class and its constructor as documented below:
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 lengthmodel=SVAR(data,p)
You may include deterministic trends as for the VAR case, using the trendExponents option:
p=4% lag lengthmodel=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:
SVAR.fit
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:
SVAR.coeffs
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.
SVAR.fitted
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.
SVAR.residuals
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 valuesmodel.fitted()% Residualsmodel.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:
SVAR.fitAndSelect
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:
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
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.
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.LP
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:
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 defaultmodel.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
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 instrumentsmodel.fit(method);
After estimation, extract the results (note the differing dimensions) via:
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
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 blockvarNames=model.getVariableNames();% Structural shock namesshockNames=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:
VAR.IRF
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.
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
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:
Response variable
Shock
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
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
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.
[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
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
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]
To use an internal instrument, specify a normalisingVariable, then optionally override the instrument (default: first variable) or the normalisingHorizon (default: 0 for contemporaneous effect):
% Changing the instrument to be Y2 and the normalisingVariable to be Y3method=InternalInstrument('Y3','instrument','Y2')
% Changing the normalisingHorizon to be period 1method=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:
SVAR.IRF
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:
Impulse response functions can be obtained from an estimated LP model using IRF. These IRFs are structural whenever the LP model was estimated structurally.
LP.IRF
IRF Compute impulse response functions from LP model.
irfObj = IRF(obj, maxHorizon, varargin) computes IRFs up to maxHorizon based on the LP model.
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 identificationirfObj=model.IRF(maxHorizon,'identificationMethod',Recursive())% Using external instrumentsmethod=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:
DSGE.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
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.
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:
Model.through
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):
Channel through Y1 at horizons 0-3:
q=model.through('Y1',0:3,transmissionOrder);
Channel through Y1 and Y2 contemporaneously:
q=model.through({'Y1','Y2'},0,transmissionOrder);
Channel through Y1 at horizon 0 and Y2 at horizons 0–1:
Use notThrough to define channels that do not go through specified variables at given horizons:
Model.notThrough
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):
Channel not through Y1 at horizons 0-20:
q=model.notThrough('Y1',0:20,transmissionOrder);
Channel not through Y1 and not through Y2 at horizons 0-20:
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):
VAR.transmission
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
SVAR.transmission
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
LP.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.
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 LPeffects=model.transmission(1,...% shock indexq,...% transmission conditiontransmissionOrder,...% transmission matrixmaxHorizon,...% maximum horizon'IdentificationMethod',method...% Recursive, InternalInstrument (VAR/SVAR) or ExternalInstrument (LP));
The returned effects array has dimensions:
Response variables (in original data order)
Transmission effect of the chosen shock
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 LPeffects=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:
DSGE.transmission
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 nameeffects=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
plotCompareDecomposition
plotDecomposition Visualises a single transmission-channel decomposition of the IRFs.
plotCompareDecomposition: Compares two decompositions obtained from different transmission matrices.