SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

查看: 1421|回复: 0
打印 上一主题 下一主题

Play Basel II Accord with SAS (1): capital requirement

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2011-7-11 20:24:52 | 只看该作者

Play Basel II Accord with SAS (1): capital requirement

From Dapangmao's blog on sas-analysis

<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-wa9Gz9jDSS4/ThoI79FPKWI/AAAAAAAAAoE/PD73KUGqyyo/s1600/Slide1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://3.bp.blogspot.com/-wa9Gz9jDSS4/ThoI79FPKWI/AAAAAAAAAoE/PD73KUGqyyo/s400/Slide1.JPG" width="400" /></a></div>Basel II Accord, revised by Basel Committee on Banking Supervision (BCBS) and adopted by more than 100 nations, regulates the commercial banks’ capital against risks. Major US banks are under the transition window to fully comply it (2008-2011) [Ref. 1]. I am especially interested in explore and implement Basel II by SAS codes.<br />
<br />
Basel II Accord provides the detailed requirements by its three ‘pillars’. Pillar 1 is about the minimal capital requirement and tries to hold the total capital at 8% of risk-weighted assets. Paragraph 272 gives the equations to calculate the capital requirement for a loan with its risk factors, such as PD(probability of default), LGD(loss given default) and M(effective maturity). I used a user-defined function in SAS to compute it. Then I drew three plots for 1/ 2.5/ 5-year maturity, respectively.  The function behaves like a paraboloid, which may suggest that the relationship may not hold when PD is very high. In addition, the longer maturity needs more capital.<br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
proc fcmp outlib = work.myfunclib.finance;
   function reqcap(pd, lgd, m);
      corr = 0.12*(1-exp(-50*pd))/(1-exp(-50)) + 0.24*(1-(1-exp(-50*pd))/(1-exp(-50)));
      mtradj = (0.11852 - 0.05478 * log(pd))**2;
      return( (lgd * probnorm((probit(pd) + corr**0.5 * probit(0.999))
            / (1-corr)** 0.5) - pd*lgd) * (1 + (m-2.5)*mtradj) / (1-1.5*mtradj) );
   endsub;
quit;

options cmplib = (work.myfunclib);
data reqcap01;
   do pd = 0.01 to 0.80 by 0.01;
       do lgd = 0.01 to 0.6 by 0.01;
           do m = 1 to 5 by 0.5;
               reqcap = reqcap(pd, lgd, m);
               output;
           end;
       end;
   end;
run;

proc template;
   define statgraph surface001;
      dynamic title;
      begingraph;
         entrytitle title;
         layout overlay3d / cube = true rotate = 30
                xaxisopts = (label="Probability of default")
                yaxisopts = (label="Loss given default")
                zaxisopts = (label="Required capital");
            surfaceplotparm x = pd y = lgd z = reqcap
                   / surfacetype = fill surfacecolorgradient = reqcap;
            endlayout;
      endgraph;
   end;
run;

%macro surfaceplot(mlist = 1 2.5 5);
   %do i = 1 %to 3;
      %let maturation = %scan(&amp;mlist, &amp;i, ' ');
      ods html gpath = "c:\tmp\"  style = money;
      proc sgrender data = reqcap01(where=(m=&amp;maturation)) template = surface001;
         dynamic title = "Time to maturation is &amp;maturation yr";
      run;
      ods html close;
   %end;
%mend;
%surfaceplot(mlist = 1 2.5 5);
</code></pre><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/-8lNgbUlI3r0/ThpKhP7UmYI/AAAAAAAAAoo/eZJ1EPtu3pE/s1600/Slide2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://1.bp.blogspot.com/-8lNgbUlI3r0/ThpKhP7UmYI/AAAAAAAAAoo/eZJ1EPtu3pE/s400/Slide2.JPG" width="400" /></a></div><br />
The unconditional expected lost, LGD*PD, is already subtracted by the capital requirement function, according to Basel II. It can be compared with required capital in the same plot above.<br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
proc template;
   define statgraph surface002;
      dynamic title;
      begingraph;
         entrytitle title;
         layout overlay3d / cube = false rotate = 150 tilt = 30
                xaxisopts = (label="Probability of default")
                yaxisopts = (label="Loss given default")
                zaxisopts = (label="Required capital") ;
            surfaceplotparm x = pd y = lgd z = reqcap
                   / surfacetype = fill surfacecolorgradient = reqcap;
            surfaceplotparm x = pd y = lgd z = eval(pd * lgd);
            endlayout;
      endgraph;
   end;
run;

ods html gpath = "c:\tmp\"  style = money;
proc sgrender data =  reqcap01(where=(m=2.5)) template = surface002;
   dynamic title = "Time to maturation is 2.5 yr";
run;
ods html close;
</code></pre><br />
Paragraph 273 in Pillar 1 makes firm-size adjustment for small- or medium-sized borrowers with less than 50 million Euros reported sales.  Then I made another function to reflect the adjustment.<br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
proc fcmp outlib = work.myfunclib.finance;
   function reqcap_sme(pd, lgd, m, s);
      if s lt 5 then s = 5;
      else if s gt 5 then s = 50;
      corr = 0.12*(1-exp(-50*pd))/(1-exp(-50)) + 0.24*(1-(1-exp(-50*pd))/(1-exp(-50)))
            - 0.04*(1-(s-5)/45);
      mtradj = (0.11852 - 0.05478 * log(pd))**2;
      return( (lgd * probnorm((probit(pd) + corr**0.5 * probit(0.999))
            / (1-corr)** 0.5) - pd*lgd) * (1 + (m-2.5)*mtradj) / (1-1.5*mtradj) );
   endsub;
quit;

data reqcap02;
   m = 1.5;
   do s = 5 to 50 by 5;
      do pd = 0.01 to 0.80 by 0.01;
         do lgd = 0.01 to 0.6 by 0.01;
               reqcap = reqcap_sme(pd, lgd, m, s);
               output;
           end;
       end;
   end;
run;
proc export data = reqcap02 outfile = 'c:\tmp\out.csv' replace;
run;
</code></pre><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/-sLxMPAp-v2o/ThpKULOCz-I/AAAAAAAAAog/glIsPe4IoXI/s1600/Slide3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="http://3.bp.blogspot.com/-sLxMPAp-v2o/ThpKULOCz-I/AAAAAAAAAog/glIsPe4IoXI/s400/Slide3.JPG" width="400" /></a></div><br />
Since SAS does not have an option for parallel 3d plotting yet, I switched to R’s ‘lattice’ package.  Comparing the plots, it shows that Basel II made an allowance for small size borrowers to inhibit the trend of over-lending to big entities.<br />
<pre style="background-color: #ebebeb; border: 1px dashed rgb(153, 153, 153); color: #000001; font-size: 14px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"><code>
x = read.csv('c:/tmp/out.csv')
library('lattice')
wireframe(reqcap ~ pd * lgd | s , x, shade = TRUE,
          screen = list(z = -30, x = -50), lwd = 0.01,
          xlab = "Probablity of default", ylab = "Loss given default",  
          zlab = "Required capital")
</code></pre><br />
References:<br />
1.     Philippe Jorion. ‘Financial Risk Manager Handbook’ 6th edition. Wiley, 2010<br />
2.     ‘Basel II - Third Consultative Package, Pillar One (29 April 2003)’. <!-- w --><a class="postlink" href="http://www.bis.org/bcbs/cp3part2.pdf">www.bis.org/bcbs/cp3part2.pdf</a><!-- w --><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3256159328630041416-1495272584532196775?l=www.sasanalysis.com' alt='' /></div><img src="http://feeds.feedburner.com/~r/SasAnalysis/~4/PoHFsnYBAew" height="1" width="1"/>
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SAS中文论坛  

GMT+8, 2025-6-10 01:45 , Processed in 0.135659 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表