IRIS Toolbox Reference Manual

sort

Sort SVAR parameterisations by squared distance of shock reponses to median

Syntax

[B,~,Inx,Crit] = sort(A,[],SortBy,...)
[B,Data,Inx,Crit] = sort(A,Data,SortBy,...)

Input arguments

Output arguments

Options

Description

The individual parameterisations within the SVAR object A are sorted by the sum of squared distances of selected shock responses to the respective median reponses. Formally, the following criterion is evaluated for each parameterisation

$$ \sum_{i\in I,j\in J,k\in K} \left[ S_{i,j}(k) - M_{i,j}(k) \right]^2 $$

where $S_{i,j}(k)$ denotes the response of the i-th variable to the j-th shock in period k, and $M_{i,j}(k)$ is the median responses. The sets of variables, shocks and periods, i.e. I, J, K, respectively, over which the summation runs are determined by the user in the SortBy string.

How do you select the shock responses that enter the criterion in SortBy? The input argument SortBy is a text string that refers to array S, whose element S(i,j,k) is the response of the i-th variable to the j-th shock in period k.

Note that when you pass in SVAR data and request them to be sorted the same way as the SVAR parameterisations (the second line in Syntax), the number of parameterisations in A must match the number of data sets in Data.

Example

Sort the parameterisations by squared distance to median of shock responses of all variables to the first shock in the first four periods. The parameterisation that is closest to the median responses

S2 = sort(S1,[],'S(:,1,1:4)')