BookmarkSubscribeRSS Feed
drdan
Calcite | Level 5

I used the Tobit type 2 example in the QLIM examples and modified it (below). CREDIT is whether or not someone gets credit (converted to var Z1 in regression).  DEFAULT (0,1) is whether or not someone defaults given they get credit (converted to var Z2 in regression). I have an "VALIDATION" indicator variable : =0 means include in the regression; =1 means not to include in regression, but give estimates of Defaults (Z2) assuming they are given credit (Z1=1). So when V=1, z1 is assigned =1 (different than the random Credit variable), and Z2= missing (.) (different than the random Default variable). Therefore I can compare the predictions with the original Validation Defaults.

================================================================

PROBLEM

I am converting this into an application and need to compute the Prob(Default=1).  I figured I should only get predictions for DEFAULT=0 or 1, but I also get predictions for DEFAULT=.! Seems wrong because these shouldn't be in the ! But I could deal with it if I knew how to compute XBETA for DEFAULT=.,0,1 .  I can match Prob1_Z2 (DEFAULT=.) using the estimated BETAs but I can't find the documentation that tells me how to calculate the Prob2_Z2 or Prob3_Z2.

 

data a2;
keep x: CREDIT DEFAULT Z: VALIDATION;
do i = 1 to 1000;
x1 = rannor( 19283 ); x2 = rannor( 19283 ); x3 = rannor( 19283 );
u1 = rannor( 19283 ); u2 = rannor( 19283 );
y1t = 1 + 2 * x1 + 3 * x2 + u1; y2t = -4 + 5 * x1 - 2 * x3 + u1*.2 + u2*X2;

 

/*ACTUAL OBSERVATIONS*/
if ( y1t > 0 ) then CREDIT = 1; else CREDIT = 0;

 

IF y2t>0 THEN y2x=1;ELSE y2x=0; if ( CREDIT > 0 ) then DEFAULT = y2x; else DEFAULT = .;

/*CENSORED OBSERVATIONS*/
Z1=CREDIT; Z2=DEFAULT;
IF MOD(I,3)=0 THEN VALIDATION=1; ELSE VALIDATION=0;
/*SETUP VALIDATION OBSERVATIONS*/ IF VALIDATION=1 THEN DO; Z1=1; Z2=.;END;

output;
end;
run;

 

/*-- Type 2 Tobit --*/
proc qlim data=a2 method=qn outest=MYEST COVOUT;
model Z1 = x1 x2 / discrete;
model Z2 = x1 x3 / select(Z1=1) DISCRETE;
HETERO Z2 ~ X2;
OUTPUT OUT=MYOUT PREDICTED PROB PROBALL XBETA ERRSTD;
run;

1 REPLY 1
drdan
Calcite | Level 5
Ok. So I actually identified a bug. From SAS "... [the] PROC QLIM developer ... confirmed that the behavior you are observing, that when Z1 = 1, Z2 = ., the procedure treats the missing value for Z2 as a different level, is indeed a defect in the procedure. The developer also confirmed that this defect has been fixed in the next release, SAS 9.4TS1M6. "

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1118 views
  • 0 likes
  • 1 in conversation