capture log close log using cda02a-binary-rev.log, text replace // pgm: cda02a-binary-rev.do // task: Review 2 - Binary Regression // project: CDA // author: your name // date: today's date * 1 setup version 10 set linesize 80 clear all macro drop _all * 2 load the data use sci-review2, clear * 3 select variables and examine data keep isfac fellow phd mcit3 mnas summarize * 4 binary logit model logit isfac fellow phd mcit3 mnas * 5 store estimation results eststo estlogit * 6 predicted probabilities predict prlogit label var prlogit "Logit: Predicted Probability" sum prlogit dotplot prlogit graph export cda02a-binary-rev-fig1.emf , replace * 7 predict specific probabilities prvalue , x(fellow=1 mnas=1) rest(mean) * 8 table of predicted probabilities prtab fellow mnas * 9 discrete change 1 quietly prvalue , x(fellow=1) rest(mean) save label(Fellow) prvalue , x(fellow=0) rest(mean) dif label(NotFellow) * 10 discrete change 2 prchange, rest(mean) help * 11 plot predicted probabilities prgen mcit3, x(fellow=1) rest(mean) from(0) to(130) gen(fel1) gap(5) ci prgen mcit3, x(fellow=0) rest(mean) from(0) to(130) gen(fel0) gap(5) ci label var fel1p1 "Fellow" label var fel0p1 "Not a Fellow" graph twoway /// (rarea fel1p1ub fel1p1lb fel1x, color(gs10)) /// (rarea fel0p1ub fel0p1lb fel0x, color(gs10)) /// (connected fel1p1 fel1x, lpattern(dash) msize(zero)) /// (connected fel0p1 fel1x, lpattern(solid) msize(zero)), /// legend(on order(3 4)) /// ylabel(0(.25)1) ytitle("Pr(Faculty)") /// xlabel(0(10)130) xtitle("Mentor's # of Citations") /// title("Predicted Probability of Having a Faculty Position") graph export cda02a-binary-rev-fig2.emf , replace * 12 odds ratios listcoef, help * 13 compre to probit probit isfac fellow phd mcit3 mnas eststo estprobit esttab estlogit estprobit , mtitles(logit probit) * 14 close log file & exit do-file log close exit