Table of Contents


File

calc_closeness.m

Name

calc_closeness

Synopsis

calc_closeness - Calculates the closeness of a node in a network based on Billio et al. (2010)

Introduction

NOTE: PART OF A SET OF 8 RELATED FILES:

To investigate the dynamic propagation of systemic risk, the authors measure the direction of the relationship between institutions using Granger causality. Specifically, the authors analyze the pairwise Granger causalities between the t and t + 1 monthly returns of the 4 indexes; they say that X Granger-causes Y if c1 has a p-value of less than 5%; similarly, they say that Y Granger-causes X if the p-value of b1 is less than 5%. They adjust for autocorrelation and heteroskedasticity in computing the p-value.

License

=============================================================================

Copyright 2011, Dimitrios Bisias, Andrew W. Lo, and Stavros Valavanis

COPYRIGHT STATUS: This work was funded in whole or in part by the Office of Financial Research under U.S. Government contract TOSOFR-11-C-0001, and is, therefore, subject to the following license: The Government is granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, worldwide license to reproduce, prepare derivative works, distribute copies to the public, perform and display the work.
All other rights are reserved by the copyright owner.

THIS SOFTWARE IS PROVIDED "AS IS". YOU ARE USING THIS SOFTWARE AT YOUR OWN RISK. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR THE UNITED STATES GOVERNMENT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=============================================================================

Inputs

adjacency_matrix
Name:
adjacency_matrix
Description:

Adjacency matrix of the network indicating inter-institutional Granger causal relationships. It is generated as output arg connection_matrix from dynamic_causality_index.m. Note: values are yes/no flags, represented as 1/0 values, respectively.

Type:
float
Range:
{0,1}
Dimensions:

KxK matrix (This is a covariance matrix.)

  1. Rows represent institutions.
  2. Columns represent institutions.

node
Name:
node
Description:

The initial node from which we calculate all the shortest paths to any other node.

Type:
integer
Range:
{1,...,K}
Dimensions:

scalar


Outputs

cl
Name:
cl
Description:

Average shortest path length from the origin node (parameter) to any other node.

Type:
float
Range:
(0,+inf)
Dimensions:

Kx1 matrix

  1. Rows represent destination nodes.

Code

% Run warning message
warning('OFRwp0001:UntestedCode', ...
    ['This version of the source code is very preliminary, ' ...
     'and has not been thoroughly tested. Users should not rely on ' ...
     'these calculations.']);



% Find the distances from the node to all other nodes
distances = dijkstra(adjacency_matrix, node);

% Find the distances for the reachable nodes (including the same node)
reachable_nodes_distances = distances(distances<inf);

% We need to exclude the node itself when we divide
cl = sum(reachable_nodes_distances)/(length(reachable_nodes_distances) - 1);

Examples

NOTE: Numbers used in the examples are arbitrary valid values.
They do not necessarily represent a realistic or plausible scenario.

 Visual representation of the graph used:

         N4
         |  \
    N1 - N2 - N3    N6  <-- not connected
      \      /
       \   /
         N5

Adjacency_matrix may be symmetric or non-symmetric as granger relationships can be unidirectional or bidirectional between nodes.

 adjacency_matrix = [0,1,0,0,1,0; ...
                     1,0,1,1,0,0; ...
                     0,1,0,1,1,0; ...
                     0,1,1,0,0,0; ...
                     1,0,1,0,0,0; ...
                     0,0,0,0,0,0];

 node = 1;
 cl = calc_closeness(adjacency_matrix, node);

References

Billio et al. (2010). Econometric measures of systemic risk in the finance and insurance sectors (No. w16223). National Bureau of Economic Research.

Bisias et al. (2012). A survey of systemic risk analytics (Working paper #0001). Washington, DC: Office of Financial Research, 65-69.