* Gauss Chapter drop _all use lbw, clear regress bwt lwt race2 race3 smoke ht ui glm bwt lwt race2 race3 smoke ht ui glm bwt lwt race2 race3 smoke ht ui, irls insheet using beta.txt, clear gen female = sex==2 gen pills = vitamin==1 | vitamin==2 glm betap age female pills kcal fat fiber alcohol chol betad predict double res, pearson hist res hist res graph export gausshistres.eps, replace sort res gen nscore = invnormal(_n/316) twoway scatter nscore res twoway scatter res kcal, yline(0) twoway scatter nscore res graph export gaussnscore.eps, replace twoway scatter res kcal, yline(0) graph export gaussreskcal.eps, replace drop if kcal > 4000 glm betap age female pills kcal fat fiber alcohol chol betad, link(log) nolog predict double betaphat, mu predict double resloglink, pearson hist resloglink twoway scatter resloglink betaphat, yline(0) hist resloglin graph export gausshistresloglink.eps, replace twoway scatter resloglink betaphat, yline(0) graph export gaussresidplot.eps, replace gen double logbetap = log(betap) glm logbetap age female pills kcal fat fiber alcohol chol betad predict double logbetaphat, mu predict double reslognormal, pearson hist reslognormal hist reslognormal graph export gausshistrespearson.eps, replace twoway scatter reslognormal logbetaphat, yline(0) sort reslognormal gen nscorelb = invnormal(_n/315) twoway scatter nscorelb reslognormal || line reslognormal reslognormal twoway scatter reslognormal kcal, yline(0) twoway scatter reslognormal logbetaphat, yline(0) graph export gausspresid.eps, replace twoway scatter nscorelb reslognormal || line reslognormal reslognormal graph export gaussnscorelogbeta.eps, replace twoway scatter reslognormal kcal, yline(0) graph export gaussreslogbetakcal.eps, replace