* cda05a-review5.do - CDA Lab Guide 5: Testing and Assessing Fit - 23May2007 capture log close set more off estimates clear * 1 open the log log using cda05a-review5.log, replace text version 9.2 set scheme s2mono * 2 load and clean the data use sci-review, clear keep isfac fellow phd mcit3 mnas female tab1 _all, m mark nomiss markout nomiss _all tab nomiss keep if nomiss==1 drop nomiss * Verify that cases with missing values have been dropped vardesc , style(missing) squeeze minl * 3 compute a z-test logit isfac female fellow phd mcit3 mnas, nolog * 4 single coefficient Wald test test female * 5 multiple coefficients Wald test test mcit3 mnas * 6 equal coefficients Wald test test mcit3 = mnas * 7 the LR test - store the estimation results logit isfac female fellow phd mcit3 mnas estimates store base * 8 single coefficient LR test logit isfac fellow phd mcit3 mnas estimates store nofemale lrtest base nofemale * 9 multiple coefficient LR test logit isfac female fellow phd estimates store nomcit3mnas lrtest base nomcit3mnas * 10 LR test all coefficients are zero logit isfac estimates store intercept lrtest base intercept * 11 fit statistics logit isfac female fellow phd mcit3 mnas fitstat, save gen phd2 = phd * phd label var phd2 "phd squared." logit isfac female fellow phd phd2 fitstat, dif * 12 plot Cook's distance quietly logit isfac female fellow phd mcit3 mnas predict cook,dbeta sort phd gen index = _n twoway scatter cook index, ysize(1) xsize(2) /// xlabel(0(100)400) ylabel(0(.2)1., grid) /// xscale(range(0, 400)) yscale(range(0, 1.)) msymbol(Oh) graph export cda05a-review5-fig1.emf, replace * 13 close log file log close exit