Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest commit 5a971af on 15 Dec 2015 schatimo new #8

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 13 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
43 changes: 43 additions & 0 deletions README.md~
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 10 additions & 2 deletions code/README.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions code/README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Code Folder

Your code goes here. You could also replace the content of this file with something more meaningful
3 changes: 3 additions & 0 deletions code/bankReadme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interbank assets | external assets | interbank liabilities | equity |
external liabilities (i.e. deposits) | check solvency | current equity ratio

Binary file added code/data.mat
Binary file not shown.
3 changes: 3 additions & 0 deletions code/data.readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
country dummy | total assets | interbank assets | equity | interbank liabilities |

all values in $billion, data end 2014
11 changes: 11 additions & 0 deletions code/eigencentr.m
Original file line number Diff line number Diff line change
@@ -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

145 changes: 145 additions & 0 deletions code/master1.m
Original file line number Diff line number Diff line change
@@ -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);




Binary file added flashtalk/MSSSM_Flashtalk.pdf
Binary file not shown.
3 changes: 0 additions & 3 deletions flashtalk/README.md

This file was deleted.

4 changes: 1 addition & 3 deletions presentation/README.md
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions presentation/README.md~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Presentation Folder

Add your presentation here...but first finish the code and the report!
Binary file added presentation/css_p.pdf
Binary file not shown.
Binary file added proposal_css.pdf
Binary file not shown.