SAS中文论坛

 找回密码
 立即注册

扫一扫,访问微社区

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

Bootstrap prediction models for probability of default

[复制链接]

49

主题

76

帖子

1462

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1462
楼主
 楼主| 发表于 2011-6-27 14:45:30 | 只看该作者

Bootstrap prediction models for probability of default

From Dapangmao's blog on sas-analysis

<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-poEoATHR00w/TfAvLO6j0hI/AAAAAAAAAm0/GDezikXiNuE/s1600/plot1.jpg" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="300" width="400" src="http://2.bp.blogspot.com/-poEoATHR00w/TfAvLO6j0hI/AAAAAAAAAm0/GDezikXiNuE/s400/plot1.jpg" /></a></div>Not like consumer credit scoring, corporate default study is usually jeopardized by the low-n-low-p data sizes. In the fourth chapter of their book, Gunter and Peter, demonstrated an example about how to construct prediction models for IDR (invesment grade default rate) using VBA and therefore evaluate them by residual sum of squares [Ref. 1]. The only shortcoming is that the variables are limited and the observations are scarce (25 total, 22 valid), which makes me feel awkward to estimate the distribution. In this case, bootstrapping may be a good alternative, since it is a simple and straightforward method to increase predictability. Previously, Wensui showed the logit bootstrapping for credit risk by Proc LOGISTIC and Proc GENMOD [Ref. 2]. Data transformation was conducted by Data Step merge first raised by Liang Xie [Ref. 3].<br />
<br />
The GLMSELECT procedure in SAS 9.2.2 harnesses the power of variable selection and bootstrapping together. In the example, the trend of IDR is hard to tell, even with a 3-year moving average chart. Thus, I chose 10000 times of resampling. As the result, 3 of the four predictors remained with their corresponding satisfying parameters. <br />
<br />
References:<br />
1. Gunter Loeffler and Peter Posch. ‘Credit Risk Modeling using Excel and VBA’. The 2nd edition. Wiley.<br />
2. Wensui Liu. ‘Improving credit scoring by generalized additive model’. SAS Global 2007.<br />
3. Liang Xie. <!-- m --><a class="postlink" href="http://www.sas-programming.com">http://www.sas-programming.com</a><!-- m --><br />
<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>/*******************READ ME*********************************************
* - Bootstrap prediction models for probability of default -
*
* SAS VERSION:    9.2.2
* DATE:           09jun2011
* AUTHOR:         <!-- e --><a href="mailto:hchao8@gmail.com">hchao8@gmail.com</a><!-- e -->
****************END OF READ ME******************************************/

****************(1) DATA INTEGRATION/TRANSFORMATION STEP*****************;
data idr;
   infile datalines delimiter = ',' missover dsd lrecl=32767;
   format year idr prf age bbb spr best12.;
   input year idr prf age bbb spr;
   datalines;
   1981,0,-7.340255411,,27.02456779,2.77
   /*To buy Gunter and Peter's book will have the full data*/
   2005,0.030637255,3.183410997,6.673717385,45.77112235,1.91
;;;
run;

data idr_t;
   merge idr(keep=idr firstobs=2 )
      idr(rename=(idr=_idrforward year=_yearforward));
   year = _yearforward + 1;
   label idr = 'invesment grade default rate'
        prf = 'forecasted change in corporate profits'
        age = 'fraction of new issuers'
        bbb = 'fraction of bbb-rated issuers'
        spr = 'spread on baa bonds';
run;

****************(2) MODULE-BUILDING STEP********************************;
%macro idrbs(data =, nsamp =, out =);
   /*****************************************************************
   *  MACRO:      idrbs()
   *  GOAL:       build prediction model by variable selection and
   *              bootstrapping
   *  PARAMETERS: data     = dataset to use
   *              nsamp    = numbers of bootstrapping
   *              out      = name of scored dataset
   *****************************************************************/
   proc sgplot data = &data;
      title 'the invesment grade default rates by years';
      series x = year y = idr;
      yaxis grid;
   run;

   ods graphics on;
   proc macontrol data = &data;
      title 'three year moving average chart for invesment grade default rate';
      machart idr*year / span = 3 odstitle = title;
   run;
   proc glmselect data = &data plots = all;
      model idr = prf age bbb spr/selection = stepwise(select = press);
      modelaverage nsamples = &nsamp subset(best = 1);
      output out = &out(drop = _:) p = pred_idr;
   run;
   ods graphics off;
%mend idrbs;

%idrbs(data = idr_t, nsamp = 10000, out = idr_scored);

****************END OF ALL CODING***************************************;
</code></pre><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3256159328630041416-7044535008479155781?l=www.sasanalysis.com' alt='' /></div><img src="http://feeds.feedburner.com/~r/SasAnalysis/~4/iike7jPzzeQ" height="1" width="1"/>
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-10 04:04 , Processed in 0.069803 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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