diff --git a/README.md b/README.md index 90df23b5c..27ed21546 100644 --- a/README.md +++ b/README.md @@ -1,44 +1,18 @@ -# MATLAB Fall 2014 – Research Plan (Template) -(text between brackets to be removed) +# MATLAB Fall 2015 – Research Plan -> * Group Name: (be creative!) -> * Group participants names: (alphabetically sorted by last name) -> * Project Title: (can be changed later) +> * Group Name: destructive +> * Group participants names: Deichmann Marion; Kaiser Laurenz; Schäfer Timo +> * Project Title: Modelling Contagion in a Core-Periphery Financial Network ## General Introduction -(States your motivation clearly: why is it important / interesting to solve this problem?) -(Add real-world examples, if any) -(Put the problem into a historical context, from what does it originate? Are there already some proposed solutions?) +Especially after the collapse of Lehman in 2008 researchers and policy +makers have shifted their focus towards the interconnectedness of +financial intermediaries regarding interbank lending. It has been shown that the default of a bank +can trigger other banks' failure via the network structure. Since then global discussions regarding +capital requirements and banking regulations have emerged, i.e. Basel III, Volcker Rule, Liikanen +report, UK Whitebook. All these measures aim to decrease the +probability of default of banks and hence, to reduce contagion +w.r.t. financial distress. -## The Model - -(Define dependent and independent variables you want to study. Say how you want to measure them.) (Why is your model a good abtraction of the problem you want to study?) (Are you capturing all the relevant aspects of the problem?) - - -## Fundamental Questions - -(At the end of the project you want to find the answer to these questions) -(Formulate a few, clear questions. Articulate them in sub-questions, from the more general to the more specific. ) - - -## Expected Results - -(What are the answers to the above questions that you expect to find before starting your research?) - - -## References - -(Add the bibliographic references you intend to use) -(Explain possible extension to the above models) -(Code / Projects Reports of the previous year) - - -## Research Methods - -(Cellular Automata, Agent-Based Model, Continuous Modeling...) (If you are not sure here: 1. Consult your colleagues, 2. ask the teachers, 3. remember that you can change it afterwards) - - -## Other - -(mention datasets you are going to use) +see proposal_css.pdf diff --git a/README.md~ b/README.md~ new file mode 100644 index 000000000..77d2a4678 --- /dev/null +++ b/README.md~ @@ -0,0 +1,43 @@ +# MATLAB Fall 2015 – Research Plan + +> * Group Name: destructive +> * Group participants names: Deichmann, Marion; Kaiser, Lorenz; Schäfer, Timo +> * Project Title: Modelling Contagion in a Core Periphery Financial Network + +## General Introduction + +(States your motivation clearly: why is it important / interesting to solve this problem?) +(Add real-world examples, if any) +(Put the problem into a historical context, from what does it originate? Are there already some proposed solutions?) + +## The Model + +(Define dependent and independent variables you want to study. Say how you want to measure them.) (Why is your model a good abtraction of the problem you want to study?) (Are you capturing all the relevant aspects of the problem?) + + +## Fundamental Questions + +(At the end of the project you want to find the answer to these questions) +(Formulate a few, clear questions. Articulate them in sub-questions, from the more general to the more specific. ) + + +## Expected Results + +(What are the answers to the above questions that you expect to find before starting your research?) + + +## References + +(Add the bibliographic references you intend to use) +(Explain possible extension to the above models) +(Code / Projects Reports of the previous year) + + +## Research Methods + +(Cellular Automata, Agent-Based Model, Continuous Modeling...) (If you are not sure here: 1. Consult your colleagues, 2. ask the teachers, 3. remember that you can change it afterwards) + + +## Other + +(mention datasets you are going to use) diff --git a/code/README.md b/code/README.md index cf73f2a80..4b5e986da 100644 --- a/code/README.md +++ b/code/README.md @@ -1,3 +1,11 @@ -# Code Folder +data: balance sheet data from bankscope, description, see data.readme -Your code goes here. You could also replace the content of this file with something more meaningful +master1: set ups financial network and balance sheet data (includes plotting for subplots) + +eigencentr: function to calculate eigenvector centrality for a weighted adjacency matrix + +simCBPost: capital buffer simulation using FDA for the post crisis scenario (ER before shock) + +simCBPre: capital buffer simulation using FDA for the pre crisis scenario (no ER before shock) + +simBailout: bail out simulation \ No newline at end of file diff --git a/code/README.md~ b/code/README.md~ new file mode 100644 index 000000000..cf73f2a80 --- /dev/null +++ b/code/README.md~ @@ -0,0 +1,3 @@ +# Code Folder + +Your code goes here. You could also replace the content of this file with something more meaningful diff --git a/code/bankReadme.txt b/code/bankReadme.txt new file mode 100644 index 000000000..68b5e8368 --- /dev/null +++ b/code/bankReadme.txt @@ -0,0 +1,3 @@ +interbank assets | external assets | interbank liabilities | equity | +external liabilities (i.e. deposits) | check solvency | current equity ratio + diff --git a/code/data.mat b/code/data.mat new file mode 100644 index 000000000..52bcd715b Binary files /dev/null and b/code/data.mat differ diff --git a/code/data.readme.txt b/code/data.readme.txt new file mode 100644 index 000000000..5555b2ad4 --- /dev/null +++ b/code/data.readme.txt @@ -0,0 +1,3 @@ +country dummy | total assets | interbank assets | equity | interbank liabilities | + +all values in $billion, data end 2014 \ No newline at end of file diff --git a/code/eigencentr.m b/code/eigencentr.m new file mode 100644 index 000000000..c81c3540e --- /dev/null +++ b/code/eigencentr.m @@ -0,0 +1,11 @@ +function [ X, I ] = eigencentr( adjac ) +%eigencentr: eigencentrality of nodes in network + + [V,D] = eig(adjac); + [max_eig,ind]= max(diag(D)); + x = V(:,ind); + + [X,I] = sort(x,'descend'); + +end + diff --git a/code/master1.m b/code/master1.m new file mode 100644 index 000000000..93d27d602 --- /dev/null +++ b/code/master1.m @@ -0,0 +1,145 @@ +clear all; +load('data.mat'); +%data = sortrows(data,[1,-2]); +%setseed + +%create country specific network characteristics +probCtr = 0.05; + +ncAT=2; npAT=5; mcAT=12; mpAT=3; mcpAT=4; +AT = [ncAT npAT mcAT mpAT mcpAT]; + +ncBE=3; npBE=4; mcBE=12; mpBE=3; mcpBE=6; +BE = [ncBE npBE mcBE mpBE mcpBE]; + +ncCH=5; npCH=10; mcCH=20; mpCH=7; mcpCH=10; +CH = [ncCH npCH mcCH mpCH mcpCH]; + +ncDE=11; npDE=23; mcDE=44; mpDE=17; mcpDE=22; +DE = [ncDE npDE mcDE mpDE mcpDE]; + +ncDK=4; npDK=7; mcDK=16; mpDK=5; mcpDK=8; +DK = [ncDK npDK mcDK mpDE mcpDK]; + +ncES=5; npES=13; mcES=20; mpES=9; mcpES=10; +ES = [ncES npES mcES mpES mcpES]; + +ncFI=2; npFI=2; mcFI=4; mpFI=2; mcpFI=1; +FI = [ncFI npFI mcFI mpFI mcpFI]; + +ncFR=10; npFR=33; mcFR=40; mpFR=24; mcpFR=20; +FR = [ncFR npFR mcFR mpFR mcpFR]; + +ncGB=9; npGB=30; mcGB=36; mpGB=22; mcpGB=18; +GB = [ncGB npGB mcGB mpGB mcpGB]; + +ncGR=1; npGR=3; mcGR=4; mpGR=2; mcpGR=2; +GR = [ncGR npGR mcGR mpGR mcpGR]; + +ncIE=2; npIE=6; mcIE=8; mpIE=4; mcpIE=4; +IE = [ncIE npIE mcIE mpIE mcpIE]; + +ncIT=6; npIT=19; mcIT=24; mpIT=14; mcpIT=12; +IT = [ncIT npIT mcIT mpIT mcpIT]; + +ncLU=2; npLU=6; mcLU=8; mpLU=5; mcpLU=4; +LU = [ncLU npLU mcLU mpLU mcpLU]; + +ncNL=3; npNL=5; mcNL=12; mpNL=3; mcpNL=6; +NL = [ncNL npNL mcNL mpNL mcpNL]; + +ncPT=2; npPT=4; mcPT=8; mpPT=3; mcpPT=4; +PT = [ncPT npPT mcPT mpPT mcpPT]; + +ncSE=3; npSE=4; mcSE=12; mpSE=3; mcpSE=5; +SE = [ncSE npSE mcSE mpSE mcpSE]; + +ctr = [AT;BE;CH;DE;DK;ES;FI;FR;GB;GR;IE;IT;LU;NL;PT;SE]; +[n,~] = size(data); +[fn, adj] = Gnm(ctr, probCtr,data); +adj = adj'; +% plot(fn); +% title('$$G(n,m,p)$$','Interpreter','latex'); +% axis off; + +%%basis for t=0 +indeg = fn.indegree; +%get interbank assets and external assets from balance sheet +for i = 1:n + bank{1,i}(1,1) = data(i,3); + bank{1,i}(1,2) = data(i,2)-data(i,3); +end + +%vector of interbank assets (claims) of n banks +ibA = cell2mat(bank); +ibA = ibA(1,1:2:2*n); + + +%remaing variables +for i= 1:n + %L_IB via outgoing links + bank{1,i}(1,3) = ibA * adj(:,i); + %equity from balance sheet + bank{1,i}(1,4) = data(i,4); + %L_E endogenous + bank{1,i}(1,5) = sum(bank{1,i}(1,1:2))-sum(bank{1,i}(1,3:4)); + %check solvency + bank{1,i}(1,6) = bank{1,i}(1,4)>0; + %current equity ratio + bank{1,i}(1,7) = bank{1,i}(1,4)/sum(bank{1,i}(1,1:2)); + liabTot(i) = bank{1,i}(1,3) + bank{1,i}(1,5) ; +end + + +%% plot aggregation +subplot(1,2,1) +fig1 = figure(1); + set(fig1,'defaulttextinterpreter','latex'); + set(fig1, 'defaultAxesTickLabelInterpreter','latex') ; + grid on; + p1 = plot(erVecIP1,erVecResultsIP1,'color','blue'); + hold on; + p2 = plot(erVecIP1,nErFDIP1,'color','red'); + hold on; + p3 = plot(erVecIP1,dCoreFinIP1,'color','magenta'); + hold on; + p4 = plot(erVecIP1,dPerFinIP1,'color','green'); + xlabel('\textit{ER}'); + ylim([0.1 0.5]); + ylabel('relative \#defaults'); + ybounds = ylim(); + set(gca, 'ytick', ybounds(1):0.05:ybounds(2)); + title(sprintf('FDA simulation with different equity ratios, pre-crisis: a=%d, b=%d',distn.a, distn.b),'fontsize',14,'fontweight','bold'); +subplot(1,2,2) +fig2 = figure(1); + set(fig2,'defaulttextinterpreter','latex'); + set(fig2, 'defaultAxesTickLabelInterpreter','latex') ; + grid on; + p1 = plot(erVecIP,erVecResultsIP,'color','blue'); + hold on; + p2 = plot(erVecIP,nErFDIP,'color','red'); + hold on; + p3 = plot(erVecIP,dCoreFinIP,'color','magenta'); + hold on; + p4 = plot(erVecIP,dPerFinIP,'color','green'); + xlabel('\textit{ER}'); + ylabel('relative \#defaults'); + ylim([0.1 0.5]); + ybounds = ylim(); + set(gca, 'ytick', ybounds(1):0.05:ybounds(2)); + title(sprintf('FDA simulation with different equity ratios, post-crisis: a=%d, b=%d',distn.a, distn.b),'fontsize',14,'fontweight','bold'); +leg = legend([p1 p2 p3 p4], {'Contagious','Fundamental','Core contagion','Periphery contagion'},'Location','southoutside','orientation','horizontal'); +newPosition = [0.4 0.03 0.2 0.03]; +newUnits = 'normalized'; +set(leg,'Position', newPosition,'Units', newUnits); +print('C:\Users\Timo Schäfer\Documents\Banking and Finance\HS 2015\Computational Social Sciences with Matlab\Text\CBPlotCombi', '-dpng'); + +axoptions={'scaled y ticks = false',... + 'y tick label style={/pgf/number format/.cd, fixed, fixed zerofill,precision=2}',... + 'scaled x ticks = false',... + 'x tick label style={/pgf/number format/.cd, fixed, fixed zerofill,precision=2}'}; +matlab2tikz('C:\Users\Timo Schäfer\Documents\Banking and Finance\HS 2015\Computational Social Sciences with Matlab\Text\CBPlotCombi.tex','extraAxisOptions',axoptions); + + + + diff --git a/flashtalk/MSSSM_Flashtalk.pdf b/flashtalk/MSSSM_Flashtalk.pdf new file mode 100644 index 000000000..e8852d99f Binary files /dev/null and b/flashtalk/MSSSM_Flashtalk.pdf differ diff --git a/flashtalk/README.md b/flashtalk/README.md deleted file mode 100644 index 7eee58b3e..000000000 --- a/flashtalk/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Flash Talk Folder - -Put a PDF with a single slide for your flash talk here. diff --git a/presentation/README.md b/presentation/README.md index 04680c0d6..21d1f8f97 100644 --- a/presentation/README.md +++ b/presentation/README.md @@ -1,3 +1 @@ -# Presentation Folder - -Add your presentation here...but first finish the code and the report! +current presentation file for Tue 15 Dec, 2015 \ No newline at end of file diff --git a/presentation/README.md~ b/presentation/README.md~ new file mode 100644 index 000000000..04680c0d6 --- /dev/null +++ b/presentation/README.md~ @@ -0,0 +1,3 @@ +# Presentation Folder + +Add your presentation here...but first finish the code and the report! diff --git a/presentation/css_p.pdf b/presentation/css_p.pdf new file mode 100644 index 000000000..660aabf98 Binary files /dev/null and b/presentation/css_p.pdf differ diff --git a/proposal_css.pdf b/proposal_css.pdf new file mode 100644 index 000000000..d238601d4 Binary files /dev/null and b/proposal_css.pdf differ