capture log close set matsize 500 set more off log using rm4ch4, text replace *** *** RM4CLDV Ch 4: Testing and Fit - Using SPost - Verified 3/9/01 *** *** Page 87: z-test for BLM use binlfp2,clear logit lfp k5 k618 age wc hc lwg inc, nolog *** Page 92-93: Wald tests test k5 test wc hc test k5 k618 age wc hc lwg inc test wc=hc *** Page 95-97: LR tests logit lfp k5 k618 age wc hc lwg inc, nolog lrtest,saving(0) logit lfp k618 age wc hc lwg inc, nolog lrtest logit lfp k5 k618 age lwg inc, nolog lrtest logit lfp, nolog lrtest *** Page 98: Residuals and influence logit lfp k5 k618 age wc hc lwg inc, nolog * compute standardized residual predict rstd,rs * compute Cook's influence predict cook,dbeta *** This code can be used to only plot even number observations: * generate ineven = round(index/2,1) == int(index/2) * keep if ineven == 1 *** Page 100: Figure 4.4 - Index plot of standardized residuals sort inc generate index = _n set textsize 125 #delimit ; graph rstd index, title("Index Plot of Standardized Pearson Residuals") b2("Observation Number") l2("Standardized Residual") yline(0) s(o) xlabel(0,200,400,600,800) ylabel(-4,-2,0,2,4) xscale(0,800) yscale(-4,4) ; #delimit cr translate @Graph rm4ch4fig4.wmf, replace *** Page 101: Figure 4.5 - Index plot of C set textsize 125 #delimit ; graph cook index, title("Index Plot of Cook's Influence Statistic") b2("Observation Number") l2("C") xlabel(0,200,400,600,800) ylabel(0,.1,.2,.3) xscale(0,800) yscale(0,.3) yline(.1,.2) s(o) ; #delimit cr translate @Graph rm4ch4fig5.wmf, replace *** Page 106, 109, 113: Measures of fit gen age2 = age*age logit lfp k5 k618 age wc hc lwg inc, nolog fitstat, saving(0) logit lfp k5 age age2 wc inc, nolog fitstat, using(0) regress lfp k5 k618 age wc hc lwg inc fitstat, saving(0) regress lfp k5 age age2 wc inc fitstat, using(0) log close