The HPBIN Procedure
Example 3.3 Bucket Binning and Weight-of-Evidence Computation
This example shows bucket binning and weight-of-evidence (WOE) computation in two steps. In the first step, PROC HPBIN does bucket binning and generates the mapping table. In the second step, PROC HPBIN takes the mapping table that is generated in the first step as the BINS_META data set and computes the WOE and the information value (IV).
data ex12;
input cl1 $ x0 x1 x2 y $ freq id;
datalines;
a 2 . 7 n 2 1
a 2 2 6 . 3 2
a 3 0 1 o 0 3
c 2 3 7 y . 4
c 2 . 4 n -5 5
a 3 6 7 n 3 6
b 1 4 4 y 4 7
b 2 5 6 y 3 8
b 1 6 4 o 1 9
b 2 3 2 n 3 10
;
proc hpbin data=ex12 numbin=5;
ods output Mapping=Mapping;
input x1/numbin=4;
input x2;
run;
proc hpbin data=ex12 WOE BINS_META=Mapping;
target y/level=nominal order=desc;
run;
Figure 8: Number of Observations Table
The HPBIN Procedure
| Number of Observations Read | 10 |
|---|---|
| Number of Observations Used | 7 |
Figure 9: Weight-of-Evidence Table
| Weight of Evidence | ||||||||
|---|---|---|---|---|---|---|---|---|
| Variable | Binned Variable | Range | Non-event Count | Non-event Rate | Event Count | Event Rate | Weight of Evidence | Information Value |
| x1 | BIN_x1 | 2 | 1 | 0 | 0 | 0.91629073 | 0.30543024 | |
| x1 < 1.5 | 1 | 1 | 0 | 0 | 0.40546511 | 0.06757752 | ||
| 1.5 <= x1 < 3 | 0 | 0 | 0 | 0 | 0 | 0 | ||
| 3 <= x1 < 4.5 | 1 | 0.33333333 | 2 | 0.66666667 | -1.3862944 | 0.69314718 | ||
| 4.5 <= x1 | 2 | 0.66666667 | 1 | 0.33333333 | 0 | 0 | ||
| x2 | BIN_x2 | 0 | 0 | 0 | 0 | 0 | 0 | |
| x2 < 2.2 | 2 | 1 | 0 | 0 | 0.91629073 | 0.30543024 | ||
| 2.2 <= x2 < 3.4 | 0 | 0 | 0 | 0 | 0 | 0 | ||
| 3.4 <= x2 < 4.6 | 2 | 0.66666667 | 1 | 0.33333333 | 0 | 0 | ||
| 4.6 <= x2 < 5.8 | 0 | 0 | 0 | 0 | 0 | 0 | ||
| 5.8 <= x2 | 2 | 0.50000000 | 2 | 0.50000000 | -0.6931472 | 0.23104906 | ||
Figure 10: Variable Information Value Table
| Variable Information Value | |
|---|---|
| Variable | Information Value |
| x1 | 1.06615494 |
| x2 | 0.53647930 |
Last updated: March 06, 2023