* Use SMOKE.dta regress cigs lincome lcigpric educ age agesq restaurn estat hettest predict uhat, residual generate uhat2 = uhat^2 * Breusch-Pagan test for heteroskedasticity regress uhat2 lincome lcigpric educ age agesq restaurn * The R2 of this test equation is R2 = 0.04. Therefore, * the LM test is n*R2 = 807*0.04 = 32.28. The p-value for this * test is given in the below display statement (p=0.00001442). * Alternatively, one could examine the overall F-statistic in * the above BP test equation and we find that it is f = 5.55 with a * p = 0.0000. * The equation has heteroskedastic errors. Compare this to * the above hettest result: * chi2(1) = 56.17 * Prob > chi2 = 0.0000 * This version of the BP test tests the null hypothesis that t=0 * in Var(e)=sigma^2*exp(zt) which is the reason the degrees of freedom of * of this version of the BP test has one degree of treedom * The errors are heteroskedastic by either test display chi2tail(6,32.28) * Now to proceed to the estimation of the equation using Feasible GLS and * the exponential specification of heteroskeasticity (See equations (8.32) and * (8.33) in Wooldridge, 6th ed.) generate luhat2 = log(uhat2) regress luhat2 lincome lcigpric educ age agesq restaurn predict luhat2_hat generate hhat = exp(luhat2_hat) generate weight = 1/sqrt(hhat) * WLS equation generate cigsstar = cigs*weight generate lincomestar = lincome*weight generate lcigpricstar = lcigpric*weight generate educstar = educ*weight generate agestar = age*weight generate agesqstar = agesq*weight generate restaurnstar = restaurn*weight generate onestar = 1*weight regress cigsstar onestar lincomestar lcigpricstar educstar agestar agesqstar restaurnstar, noconstant * In case you want to hedge that the exponential heteroskedasticity is not quite right * in correcting the heteroskedastcity in the errors you can use the robust * option on the WLS equation. Doesn't make much difference in the significance * of the variables. regress cigsstar onestar lincomestar lcigpricstar educstar agestar agesqstar restaurnstar, noconstant robust