Financial Networks IV. Analyzing and Visualizing Exposures

554 views

Published on

Fourth lecture of a PhD level course on "Financial Networks" at Center for Financial Research at Goethe University, Frankfurt.

Published in: Economy & Finance
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
554
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Financial Networks IV. Analyzing and Visualizing Exposures

  1. 1. Center for Financial Studies at the Goethe UniversityPhD Mini-courseFrankfurt, 25 January 2013Financial NetworksIV. Analyzing and visualizingExposures Dr. Kimmo Soramäki Founder and CEO FNA, www.fna.fi
  2. 2. Tutorials• Tutorial 1 – Loading Networks into FNA• Tutorial 2 – Managing Data in FNA• Tutorial 3 – Network Summary Measures• Tutorial 4 – Centrality Measures• Tutorial 5 – Connectedness and Components• Tutorial 6 – Network Visualization• Tutorial 7 – Correlation Networks• Tutorial 8 – Payment System Simulations• Tutorial 9 – Analyzing Cross-Border Banking Exposures 2
  3. 3. Cross-border banking exposures• The BIS Consolidated Banking statistics report banks’ foreign claims for a network of 26 countries (available on the BIS statistics page, Table 9D).• E.g. The exposures by the Austrian banking sector against borrowers in Italy are 16.5 billion in 2Q2012• Aim to explore and identify important/fragile countries 3
  4. 4. I. Loading data• Source data at BIS Website:• Data in FNA list format (link)# load arc list into FNA as a networkloada -file bis-updated-2012.csv -preserve false• loada -command loads arcs and their properties from a text file• Creates referenced vertices if they do not exist• Retains all existing arc property values (does not overwrite any existing data)• -preserve parameter defines whether to keep (true) or overwrite (false) existing networks in database. By default true.• Network, source vertex and destination vertex are mandatory, all other fields are loaded as property values 4
  5. 5. CSV file for exposure data Comment rows # The data shows banking system exposures to particular countries. (1 and d 2) # See http://www.bis.org/publ/qtrpdf/r_qt1006y.htm for details. Empty row (3)Header field (with net_id,arc_id,from_id,to_id,value value ‘net_id’) 2010-1Q,Australia-Austria,Australia,Austria,211 Header row (4) 2010-1Q,Australia-Belgium,Australia,Belgium,1128 2010-1Q,Australia-Canada,Australia,Canada,12231 2010-1Q,Australia-Chile,Australia,Chile,335 2010-1Q,Australia-France,Australia,France,8865Field (with value 2010-1Q,Australia-Germany,Australia,Germany,11702 ‘2010-1Q’) 2010-1Q,Australia-Greece,Australia,Greece,12 2010-1Q,Australia-India,Australia,India,2180 2010-1Q,Australia-Ireland,Australia,Ireland,3583 Data rows (5-) 2010-1Q,Australia-Italy,Australia,Italy,8657 2010-1Q,Australia-Japan,Australia,Japan,4035 2010-1Q,Australia-Netherlands,Australia,Netherlands,5970 2010-1Q,Australia-Portugal,Australia,Portugal,776 2010-1Q,Australia-Spain,Australia,Spain,2776 2010-1Q,Australia-Sweden,Australia,Sweden,773 2010-1Q,Australia-Switzerland,Australia,Switzerland,3366 2010-1Q,Australia-Turkey,Australia,Turkey,63 Column Delimiter (,)
  6. 6. file -parameter in loada• Arc file (-file) : File from which to read arcs. Referenced vertices that do not exist are created automatically. To skip lines or use non-default field delimiter use the delimiter and skiplines arguments. Mandatory.• The -file parameter has two important qualifiers – data delimiter : It can be comma, semicolon, whitespace, tab. The default separator is comma. – skiplines : is a list of lines to be skipped when reading the file. The list can be given as comma separated integers, or may also include integer ranges as in skiplines=2-10,12 or skiplines=1-3,5-6. By default, all empty lines and lines starting with # are skipped.• First read line must contain headers• e.g. loada -file tabbeddata.txt[delimiter=tab;skiplines=1,3-5] 6
  7. 7. Other parameters in loada• Network id column (-ncol) : Column name that contains network id. Optional. By default net_id.• Source column (-svcol) : Column name that contains source vertex. Optional. By default from_id.• Destination column (-dvcol) : Column name that contains destination vertex. Optional. By default to_id.• Decimal Separator (-decimalseparator) : Decimal separator used in the input file, commonly . or ,. Default value corresponds to Decimal separator setting in Default format settings. Optional.• Date format (-dateformat) : Date format used in files. Default value corresponds to Date format setting in Default format settings. Optional.• Time format (-timeformat) : Time format to use. Default value corresponds to Time format setting in Default format settings. Optional. 7
  8. 8. Other input data formats:• GraphML (loadgraphml)• Matrix (loadmatrix)• Network elements: arcs (loada), vertices (loadv) networks (loadn)• Property data for existing network elements in database: for arcs (loadap), for vertices (loadvp) and networks (loadnp)• Network series (loads) 8
  9. 9. II. Calculating Degree/Strengthdegree -p value -saveas total_exposure• Weight property (-p) : Property name for arc weights. – For missing and NaN values 0 is used. – Optional. If none given, simple degree is calculated• Direction of arcs (-direction) : Direction of arcs to consider for each vertex. – Allowed values: [in, out, both] – Optional, By default out• Save as property (-saveas) : Property name of saved result. Optional. By default degree. 9
  10. 10. III. Making first visualizationviz• viz -command is the simplest visualization command• It uses simple logic to determine layout algorithm to be used – istree -> tree layout – isbipartite -> bipartite layout – Fruchterman-Reingold layout• Creates an independent .html document that contains the visualization and all the network data• Other layouts: circle, circletree, distance, sammon, any external coordinates 10
  11. 11. 11
  12. 12. Network Visualization 12
  13. 13. PrinciplesAll details must convey unique meaning1. High data-ink ratio2. No chartjunk3. Correct dimensions4. No duplication(from Edward Tufte 2001)
  14. 14. Directed vs. undirected• Display curved arcs (-curvedarcs) : If true, opposite links are shown as curved arcs between the two vertices. If false, opposite arcs are shown as straight lines on top of each other. Optional. By default true.• Display arrows (-arrows) : If true, links have arrows denoting link direction. If false, no arrows are shown. Optional. By default false. 14
  15. 15. Vertex Color• Vertex color (-vcolor) : Vertex property defining vertex colors. The property values can be any of the following: – Hexadecimal color code, such as #8B0000 for dark red. – Valid color name. Such as darkred. – Number. Color ranges from gray (lowest value) to dark red (highest value) by a 100-step gradient. – Any string. A color from the palette is used for each unique string and same strings get same color.• Default vertex color (-vcolordefault) : Default vertex color used in case no arc color data is mapped and in case of missing data. Optional. By default black. 15
  16. 16. Vertex Size• Vertex size (-vsize) : The vertex property used for establishing vertex size. Vertex with smallest value (negative or positive) has smallest size, and vertex with largest value (negative or positive) has largest size. By default all vertices are same size. Optional. Data type: Numeric.• Vertex height (-vheight) : The vertex property used for establishing vertex height. Specifications as with size.• Vertex width (-vwidth) : The vertex property used for establishing vertex width. As with size.• Vertex size range (-vsizerange) : Range of vertex sizes (in pixels). Optional. By default 3-20.• Vertex size domain (-vsizedomain) : Domain for vertex size. The vertex with the lowest value has the lower bound size defined by Vertex size range and vertex with highest value has the upper bound size. Optional.• Default vertex size (-vsizedefault) : Default vertex size in case size is not defined by data. Any value between 0.0 to 100.0 (inclusive). Optional. By default 3.0. 16
  17. 17. Range and Domain Default Domain Range lower bound Range upper bound Smallest data value Largest data value -0.7 0.9 Specified domainRange lower bound Range upper bound -1 1 Smallest data value Largest data value Fixed range and bound allow comparison across data sets and across networks 17
  18. 18. Vertex transparency• Vertex transparency (-vtransparency) : The vertex property defining vertex transparency. Higher values are less transparent. Optional. Data type: Numeric.• Vertex transparency range (-vtransparencyrange) : Range of vertex transparency. Optional. By default 0.2-0.8.• Vertex transparency domain (-vtransparencydomain) : Domain for vertex transparency. The vertex with the lowest value has the lower bound transparency defined by Vertex transparency range and vertex with highest value has the upper bound transparency. Optional.• Default vertex transparency (-vtransparencydefault) : Default vertex transparency in case transparency is not defined by data. Any value between 0.0 to 1.0 (inclusive). Optional. By default 0.7. 18
  19. 19. Labels and hover behavior• Vertex hover (-vhover) : Vertex property defining value shown on vertex hover. By default, nothing is shown on hover. Optional. By default none.• Vertex label (-vlabel) : Vertex property defining vertex label. By default no label is shown. Optional. By default none.• Arc hover (-ahover) : Name of arc property to display in arc tooltip on hover. Optional. By default none.• Arc label (-alabel) : Name of arc property to display next to each arc. Optional. By default none.• Label font color (-fontcolor) : The font color of arc and vertex labels. Optional. By default Black.• Label font size (-fontsize) : The font size of arc and vertex labels in pixels. Optional. By default 14. 19
  20. 20. Arc width• Arc width (-awidth) : The arc property defining arc width. Arc widths scale according to absolute value of given property, ie. values -100 and 100 have same width and are wider than arcs with values -10 and 10. Optional. Data type: Numeric.• Arc width range (-awidthrange) : Range of arc widths (in pixels). Optional. By default 1-11.• Arc width domain (-awidthdomain) : Domain for arc width. The arc with the lowest value has the lower bound width defined by Arc width range and arc with highest value has the upper bound width. Optional.• Default arc width (-awidthdefault) : Default arc width in case width is not defined by data. Any value between 0.0 to 100.0 (inclusive). Optional. By default 1.0. 20
  21. 21. Arc Color• Arc color (-acolor) : Name of arc property that defines arc colors. The property values can be any of the following: – Hexadecimal color code, such as #8B0000 for dark red. – Valid color name. Such as darkred. – Number. Color ranges from light gray (lowest value) to dark gray (highest value) by a 100-step gradient. – Any string (category). A color from the palette is used for each unique string and same strings get same color.• Default arc color (-acolordefault) : Default arc color used in case no arc color data is mapped and in case of missing data. Optional. By default black. 21
  22. 22. Arc transparency• Arc transparency (-atransparency) : The arc property defining arc transparency. Higher values are less transparent. Optional.• Arc transparency range (-atransparencyrange) : Range of arc transparency. Optional. By default 0.2-0.8.• Arc transparency domain (-atransparencydomain) : Domain for arc transparency. The arc with the lowest value has the lower bound transparency defined by Arc transparency range and arc with highest value has the upper bound transparency. Optional.• Default arc transparency (-atransparencydefault) : Default arc transparency in case transparency is not defined by data. Any value between 0.0 to 1.0 (inclusive). Optional. By default 0.7. 22
  23. 23. ScaleScale allows to create comparable network layouts,similarly as domain and range comparable elementsizes/width/colors.Scale= length in pixels of distance 1 in coordinate system• Scale (-scale) : Scale for coordinate system. Optional.• Scale sensitivity (-scalesensitivity) : Sensitivity of scaling. Set 0 for no scaling. Any value between 0.0 to 1.0 (inclusive). Optional. By default 0.2. 23
  24. 24. Filtering and sorting elements• Network id (-id) : Id of the network to visualize. Use(*) for all networks. Optional. By default *.• Show specific vertices. (-vshow) : Shows vertices according to expression criteria. Optional.• Show specific arcs. (-ashow) : Shows arcs according to expression criteria. Optional.• Sort networks (-sortn) : Comma separated list of network properties and order, e.g. vertex_id:asc. Optional. 24
  25. 25. Better visualizationviz-vlabel vertex_id-vsize total_exposure-vcolordefault red-atransparency value-awidth value-npanel net_id-ahover value-fontsize 18-vtransparencydefault 0.7-saveas tutorial9_full 25
  26. 26. Other behavior• Network panel text (-npanel) : Html syntax string to show as network description. Optional.• Length of transition (-transition) : Speed of transition between networks (in milliseconds), 0 = immediate, 1000 = 1 second. Any value between 0 to 10000 (inclusive). Optional. By default 1000.• Time interval for looping frames (-loopinterval) : Time interval between automatic rotation of frames (in milliseconds), 0 = no rotation, 1000 = 1 second. Any value between 0 to 10000 (inclusive). Optional. By default 0.• Allow pan (-allowpan) : Allow panning of visualization. Optional. By default true.• Allow zoom (-allowzoom) : Allow zooming of visualization. Optional. By default true.• Allow rotate (-allowrotate) : Allow rotating of visualization. Optional. By default true.• Allow dragging (-allowdrag) : Allow dragging of vertices. Optional. By default true.• Slider position (-slider) : Larger than or equal to 0. Optional. By default 0. 26
  27. 27. Relative Exposure to GDP# Load GDP data as vertex propertiesloadvp -file GDP-2012.csv# Drop Turkey and Greece for which data is not available full seriesdropv -v Greece,Turkey# Calculate Exposure/GDPcalcap -e 10000*value/source:gdp -saveas GDP_relative_value# Sum up relative exposure to country leveldegree -p GDP_relative_value -direction out -saveas relative_debt 27
  28. 28. Visualize Exposure/GDPcircleviz-vsize relative_debt-vlabel vertex_id-vhover relative_debt-vsizedomain 0-0.05-vsizerange 5-20-arrows true-ahover value-awidth GDP_relative_value-atransparency GDP_relative_value-atransparencyrange 0-1-vcolordefault red-fontsize 16-sortv vertex_id-npanel net_id-saveas tutorial9_0 28
  29. 29. Which centrality metric would make sensefor the cross-border banking exposures? 29
  30. 30. Blog, Library and Demos at www.fna.fiDr. Kimmo Soramäkikimmo@soramaki.netTwitter: soramaki

×