version 12.1 * hettest use https://www3.nd.edu/~rwilliam/statafiles/reg01.dta, clear reg income educ jobexp rvfplot estat hettest * imtest use https://www3.nd.edu/~rwilliam/statafiles/reg01.dta, clear quietly reg income educ jobexp estat imtest, white * Could also do with hettest specifiying vars quietly reg income educ jobexp estat hettest educ jobexp c.educ#c.educ c.jobexp#c.jobexp c.educ#c.jobexp, iid * Robust standard errors reg income educ jobexp, robust reg income educ jobexp, vce(robust) *** Appendix A: hettest & imtest * do it yourself hettest use https://www3.nd.edu/~rwilliam/statafiles/reg01.dta, clear quietly reg income educ jobexp * compute yhat predict yhat if e(sample) * Compute the residual predict e if e(sample), resid * Square the residual, and rescale it so that the squared values * have a mean of 1. This is needed for the eventual test statistic. gen esquare = e^2 / (e(rss)/e(N)) * Regress squared residuals on yhat reg esquare yhat * Compute test statistic. display "Chi Square (1) = " e(mss) / 2 * Display the p value for the chi-square statistic display "Prob > chi2 = " chi2tail(1, e(mss)/ 2) quietly reg income educ jobexp estat hettest * Do it yourself imtest use https://www3.nd.edu/~rwilliam/statafiles/reg01.dta, clear quietly reg income educ jobexp * Compute the residual. No need to rescale but it doesn't hurt if you do predict e if e(sample), resid * Square the residual gen esquare = e^2 * Compute squares and cross-products. gen educ2 = educ ^2 gen jobexp2 = jobexp ^2 gen jobed = jobexp * educ * Regress the squared residuals on all the X terms reg esquare educ jobexp educ2 jobexp2 jobed * Test stat = N * R-squared display 20* e(r2) quietly reg income educ jobexp estat imtest, white *** Appendix B: Goldfeldt-Quant use https://www.nd.edu/~rwilliam/statafiles/reg01.dta, clear reg income educ jobexp if educ <=10 reg income educ jobexp if educ >=15 *** Appendix C: WLS use https://www3.nd.edu/~rwilliam/statafiles/reg01.dta, clear gen inveduc = (1/educ)^2 reg income educ jobexp [aw = inveduc]