* Unordered Outcome Chapter drop _all use heart, clear mlogit death anterior hcabg kk2 kk3 age2-age4, nolog glm death anterior hcabg kk2 kk3 age2-age4, fam(bin) nolog noheader use tbl19-2, clear gen cc = mod(_n-1,4)+1 gen g = int((_n-1)/4)+1 gen air = cc==1 gen bus = cc==3 gen train = cc==2 gen airinc = air*hinc gen choice = cc*mode gen hair = hinc*air gen htrain = hinc*train gen hbus = hinc*bus gen psair = psize*air gen pstrain = psize*train gen psbus = psize*bus clogit mode hair psair air htrain pstrain train hbus psbus bus, group(g) nolog mlogit choice hinc psize if choice>0, base(4) nolog clogit mode air bus train gc ttme airinc, group(g) nolog mlogit choice hinc psize if choice>0, base(4) nolog estimates store all mlogit choice hinc psize if choice!=0 & choice!=2, base(4) nolog estimates store partial hausman partial all, alleqs constant save tmp, replace use medpar, clear gen byte admit = type1 + 2*type2 + 3*type3 label define admitlab 1 "Elective" 2 "Urgent" 3 "Emergency" label values admit admitlab label define whitelab 1 "White" 0 "Other" label values white whitelab tab admit tab admit white mlogit admit white, rrr nolog mlogit admit white, base(2) nolog by admit, sort: summarize white los mlogit admit white los, nolog aic mlogit admit white los, rrr nolog predict p1 p2 p3 prtab white mlogtest, all sort white los line p1 los if white==0 || line p1 los if white==1, legend(order(1 "nonwhite" 2 "white")) title(Medicare LOS vs Admission Type) l1title( "Admit=1: Elective Admission") clpattern("-###") graph export medpar1.eps, replace line p2 los if white==0 || line p2 los if white==1, legend(order(1 "nonwhite" 2 "white")) title(Medicare LOS vs Admission Type) l1title( "Admit=2: Urgent Admission") clpattern("-###") graph export medpar2.eps, replace line p3 los if white==0 || line p3 los if white==1, legend(order(1 "nonwhite" 2 "white")) title(Medicare LOS vs Admission Type) l1title( "Admit=3: Emergency Admission") clpattern("-###") graph export medpar3.eps, replace quietly mlogit admit white los estimates store mlogit quietly ologit admit white los lrtest mlogit, force save junk, replace use tmp, clear mprobit choice hinc psize if choice>0, base(4) nolog use junk, clear mlogit admit white los, nolog aic predict pl1 pl2 pl3 mprobit admit white los, nolog aic predict pp1 pp2 pp3 list pp1 pl1 pp2 pl2 pp3 pl3 in 1/10 corr pp1 pl1 corr pp2 pl2 corr pp3 pl3 tab admit, nolabel gen admitbin = (admit==1) /* Create a binary variable */ tab admitbin probit admitbin white los, nolog mprobit admitbin white los, baseoutcome(0) nolog display "white: " _b[white]/sqrt(2) _n "los : " _b[los]/sqrt(2) _n "_cons: " _b[_cons]/sqrt(2) probit admitbin white los, nolog predict prob1 mprobit admitbin white los, probitparam baseoutcome(0) nolog predict mprob1 mprob2 corr prob1 mprob1 mprob2 list prob1 mprob1 mprob2 in 1/10 quietly mprobit admitbin white los, baseoutcome(0) nolog predict pm1 pm2 corr prob1 mprob1 mprob2 pm1 pm2 list prob1 mprob1 mprob2 pm1 pm2 in 1/5