* * CHAPTER 11 * Page 387 * open data ch11_hmda_sw.xls data(format=xls,org=columns) 1 2380 seq s3 s4 s5 s6 s7 s9 s11 s13 s14 s15 s16 s17 s18 s20 married s24a s25a s26a s27a $ s30a s30c s31a s31c s32 s33 s34 s35 s39 s40 s41 s42 s43 s44 s45 s46 s47 s48 s50 s51 s52 s53 s55 s56 s57 $ netw uria rtdum bd mi old vr school chval dnotown dprop * * Compute transformations of the original data. Note that s7==3 evaluates as 1 if * s7 is 3 and 0 otherwise. You need the == for the test for equality, not just * one =. * set denied = s7==3 set piratio = s46/100 set black = s13==3 * * LPM * * Equation 11.1 linreg(robust) denied # constant piratio * * Equation 11.3 linreg(robust) denied # constant piratio black * * Probit * * Equation 11.7 ddv denied # constant piratio * * Predicted probabilities. The PRJ instruction computes fitted values based upon * the most recent estimation. The XVECT option feeds in a particular set of * values for the "X" in the linear part Xb. PRJ produces no printed output, but * %prjcdf is the predicted probability for the normal distribution. Note that the * values are slightly different from those in the text, as these are calculated * at full precision, while those in the text are rounded. * prj(xvect=||1.0,.3||) compute prob_3=%prjcdf prj(xvect=||1.0,.4||) compute prob_4=%prjcdf prj(xvect=||1.0,.5||) compute prob_5=%prjcdf * disp "Probability at PI=.3" prob_3 disp "Probability at PI=.4" prob_4 disp "Probability at PI=.5" prob_5 * * Equation 11.8 ddv denied # constant piratio black * prj(xvect=||1.0,.3,0.0||) compute prob_w=%prjcdf prj(xvect=||1.0,.3,1.0||) compute prob_b=%prjcdf disp "Probability for Non-Black at .3" prob_w disp "Probability for Black at .3" prob_b * * Logit models * * Equation 11.10 ddv(dist=logit) denied # constant piratio black * * Computing probabilities off a logit is the same as for the probit, except that * you need to add in the DIST=LOGIT option. * prj(xvect=||1.0,.3,0.0||,dist=logit) compute prob_w=%prjcdf prj(xvect=||1.0,.3,1.0||,dist=logit) compute prob_b=%prjcdf disp "Probability for Non-Black at .3" prob_w disp "Probability for Black at .3" prob_b * * Compute various transformations off the original data. Note that s53==1 * evaluates as 1 if s53 is 1 and 0 otherwise. Remember to use == for the test for * equality, not just one =. * set hse_inc = s45/100 set loan_val = s6/s50 set ccred = s43 set mcred = s42 set pubrec = (s44>0) set denpmi = (s53==1) set selfemp = (s27a==1) set single = 1-married set hischl = (school>=12) set probunmp = uria set condo = (s51==1) set ltv_med = loan_val>=0.80.and.loan_val<=0.95 set ltv_high = loan_val>0.95 set blk_pi = black*piratio set blk_hse = black*hse_inc set ccred3 = ccred==3 set ccred4 = ccred==4 set ccred5 = ccred==5 set ccred6 = ccred==6 set mcred3 = mcred==3 set mcred4 = mcred==4 * * Expanded model estimated with all three techniques * * Table 11.2 * Column 1 * linreg(robust) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp constant disp "Difference in Predicted Probability of Denial, Black vs White" %beta(1) * * Column 2 * ddv(robust,dist=logit) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp constant * * Calculation of predicted probability of denial for black vs white. This is * computed (in all cases) with all other explanatory variables set to their means. * The PRJ instruction is used extensively. Its first use is to get the mean vector * itself. PRJ(ATMEAN) evaluates xb at the mean of the explanatory variables; we're * doing this only because, as a side effect, it produces the vector of means. * We'll then use PRJ to compute the required probabilities after patching over * the first element of a copy of the mean vector with 1 (for black) or 0 (for * white). * prj(atmean) compute testv=%meanv compute testv(1)=1 prj(xvect=testv,dist=logit) compute prob_b=%prjcdf compute testv(1)=0 prj(xvect=testv,dist=logit) compute prob_w=%prjcdf disp "Difference in Predicted Probability of Denial, Black vs White" prob_b-prob_w * * Column 3 * ddv(robust) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp constant prj(atmean) compute testv=%meanv compute testv(1)=1 prj(xvect=testv) compute prob_b=%prjcdf compute testv(1)=0 prj(xvect=testv) compute prob_w=%prjcdf disp "Difference in Predicted Probability of Denial, Black vs White" prob_b-prob_w * * Probit only for the remaining models. Each is followed by the tests given in * table 11.2 on page 403. * * Column 4 * ddv(robust) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp single hischl uria constant exclude # single hischl uria prj(atmean) compute testv=%meanv compute testv(1)=1 prj(xvect=testv) compute prob_b=%prjcdf compute testv(1)=0 prj(xvect=testv) compute prob_w=%prjcdf disp "Difference in Predicted Probability of Denial, Black vs White" prob_b-prob_w * * Column 5 * ddv(robust) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp $ single hischl uria condo mcred3 mcred4 ccred3 ccred4 ccred5 ccred6 constant exclude # single hischl uria exclude # mcred3 mcred4 ccred3 ccred4 ccred5 ccred6 prj(atmean) compute testv=%meanv compute testv(1)=1 prj(xvect=testv) compute prob_b=%prjcdf compute testv(1)=0 prj(xvect=testv) compute prob_w=%prjcdf disp "Difference in Predicted Probability of Denial, Black vs White" prob_b-prob_w * * Column 6 * ddv(robust) denied # black piratio hse_inc ltv_med ltv_high ccred mcred pubrec denpmi selfemp $ single hischl uria blk_pi blk_hse constant exclude # single hischl uria exclude # black blk_pi blk_hse exclude # blk_pi blk_hse * * The calculation of the black vs white probabilities here are a bit more * complicated because of the interaction terms. We're going to want the test * values for the blk_pi and blk_hse to be zero for white, but the sample average * for piratio and hse_inc for black. blk_pi is the 14 slot and blk_hse is 15. We * can pull the sample averages from the 2 and 3 slots respectively * prj(atmean) compute testv=%meanv compute testv(1)=1,testv(14)=testv(2),testv(15)=testv(3) prj(xvect=testv) compute prob_b=%prjcdf compute testv(1)=testv(14)=testv(15)=0 prj(xvect=testv) compute prob_w=%prjcdf disp "Difference in Predicted Probability of Denial, Black vs White" prob_b-prob_w