Reconstruction of financial networks

This method is based on the papers

Systemic risk analysis in reconstructed economic and financial networks
Giulio Cimini, Tiziano Squartini, Diego Garlaschelli, Andrea Gabrielli
Sci. Rep. 5 (15758) (2015)

Stock markets reconstruction via entropy maximization driven by fitness and density
Tiziano Squartini, Guido Caldarelli, Giulio Cimini
arXiv:1606.07684



INPUT

(Partial) information represented by two vectors with N elements each. The first vector represents the banks' assets a(i), i=1...N. The second vector represents the banks' liabilities l(i), i=1...N. Assets and liabilities are the banks marginals. Each vector contains N real numbers and can be provided as a *.txt, *.dat, *.csv file. As a check, the sum of assets, W, matches the sum of liabilities: a_1+a_2+...a_N=l_1+l_2+...l_N=W.

As an additional input, our method requires the knowledge of the total number of connections, L. If this parameter is not known for the network under analysis, an estimate of it can be provided as well.

STEPS OF THE METHOD

Our method has been called "Max&Sam" since it is based on two subsequent steps. The first step prescribes to Maximize the likelihood of observing a particular configuration: as a result, a connection probability p(i,j) can be defined for each pair of nodes. The second step Samples the ensemble of matrices induced by the probability coefficients obtained from the first step.

[1] choose a pair of nodes (e.g. nodes i and j);


[2] link i and j with a probability coefficient given by


p(i,j) = z*a(i)*l(j)/(1+z*a(i)*l(j))


In other words, we are assuming that banks connect with a probability depending on their marginals (notice that this is often the only available information);


[3] z, on the other hand, is an unknown parameter. In order to estimate it, solve the following equation



L = (i<j) p(i,j)


which represents the likelihood condition associated to our model (the symbol (i<j) means "sum over pairs of nodes"). L is the total number of links of the considered financial network. In case L is not known, an estimate of the density of links can be used to determine z;


[4] in order to provide an estimation of the magnitude of the transaction w_ij, implement the following Bernoulli process:


 draw 0 with probability 1-p(i,j)

                     draw a(i)*l(j)/(W*p(i,j)) with probability p(i,j)


defining an expected weight equal to <w(i,j)>=a(i)*l(j)/W. As easily verifiable, such a recipe allows us to reproduce the ``interbank constraints '': <a(i)>=(j) <w(i,j)>=a(i) and <l(j)>=(i) <w(i,j)>=l(j);


[5] repeat steps 2-5 for all nodes' pairs.


OUTPUT


The output of our algorithm thus consists of a weighted, directed network (defined by an N X N square matrix of real numbers). Such a matrix can be output as a *.txt, *.dat, *.csv file.




In order to run our algorithm:

[1] download the *.rar file at the bottom of the page;

[2] put the Matlab routines and the *.txt files inside the same folder;

[3] run the code line: E=Reconstruction(Assets,Liabilities,Links);

[4] as output, one matrix is obtained. Please notice that our method requires the constraints the be satisfied on average. Thus, an entire ensemble of matrices can, in principle, be explored. By tuning the parameter "EnsembleCardinality" within the code as many matrices as wanted can be generated (the default value is 1).



Here we show the binary and weighted observed structure of our test-matrix. White dots represents 0s, black dots represent 1s, colored dots represent (positive) weights:



Here we show the binary and weighted reconstructed structure of our test-matrix. White dots represents 0s, black dots represent 1s, colored dots represent (positive) weights:



Here we explicitly show the scatter plot of observed VS reconstructed weights:



ċ
Reconstruction of financial networks.rar
(294k)
Tiziano Squartini,
Jul 6, 2016, 2:56 AM