version 8 capture log close set matsize 500 set more off log using st8ch3, text replace // * // * RM4STATA Ch 3: Estimation, Testing and Fit - 5/26/2003 // * // * Section 3.1.1: stata's output for ML estimation use binlfp2, clear logit lfp k5 k618 age wc hc lwg inc // * Section 3.1.4: syntax of estimation commands use binlfp2, clear logit lfp k5 k618 age wc lwg logit lfp k5 k618 age wc lwg if hc==1 * hypothetical example of using weights: * logit lfp k5 k618 age wc lwg [pweight=wgtvar] * using if and level options logit lfp k5 k618 age wc lwg if hc==1, level(90) * dealing with (artifically created) missing data use binlfp2, clear replace k5 = . in 1/5 replace age = . in 20/30 replace k618 = . in 3/12 logit lfp k5 k618 age wc hc lwg inc, nolog logit lfp k5 age wc hc lwg inc, nolog * using -mark- and -markmiss- to delete cases with missing data mark nomiss markout nomiss lfp k5 k618 age wc hc lwg inc tab nomiss logit lfp k5 k618 age wc hc lwg inc if nomiss==1, nolog logit lfp k5 age wc hc lwg inc if nomiss==1, nolog // * Section 3.1.5: reading the output use binlfp2, clear logit lfp k5 k618 age wc hc lwg inc, nolog // * Section 3.1.6: reformatting output with -estimates table- logit lfp k5 k618 age wc hc lwg, nolog estimates table, b(%9.3f) t label varwidth(30) // * Section 3.1.7: alternative output with -listcoef- use science2, clear regress job female phd mcit3 fellow pub1 cit1 listcoef female cit1, help // * Section 3.3.1: Wald tests use binlfp2, clear logit lfp k5 k618 age wc hc lwg inc, nolog test k5 test k5 k618 test k5 k618 age wc hc lwg inc test k5=k618 * -accumulate- option test k5=k618 test wc=hc, accumulate // * Section 3.3.2: LR tests logit lfp k5 k618 age wc hc lwg inc, nolog estimates store fmodel logit lfp age wc hc lwg inc, nolog estimates store nmodel lrtest fmodel nmodel // * Section 3.4: measures of fit logit lfp k5 k618 age wc hc lwg inc, nolog fitstat quietly fitstat, saving(mod1) generate agesq = age*age logit lfp k5 age agesq wc inc, nolog fitstat, using(mod1) logit lfp k5 k618 age wc hc lwg inc, nolog lstat // * Section 3.5.2: predictions using -predict- logit lfp k5 k618 age wc hc lwg inc, nolog predict pr1 sum pr1 log close