* Reference: Chapter 8 of * Jeffrey M. Wooldridge, Introductory Econometrics: A Modern Approach, * South-Western College Publishing, 2000. SAMPLE 1 807 READ (SMOKE.shd) educ cigpric white age income cigs restaurn & lincome agesq lcigpric * Example 8.7 * Equation (8.35), p. 269. * The RESID= option is used to save the estimated residuals in * the variable U. OLS cigs lincome lcigpric educ age agesq restaurn / RESID=U * For the age variable, estimate the turning point. TEST -age/(2*agesq) * Test for heteroskedasticity DIAGNOS / HET NOWHITE * Calculate the LM test statistic (see equation (8.16), p. 257) GENR U2=U*U * Auxiliary regression - the ? prefix suppresses the output ?OLS U2 lincome lcigpric educ age agesq restaurn ?GEN1 LM=$N*$R2 ?GEN1 DF=$K-1 * Use the DISTRIB command for computing p-values DISTRIB LM / TYPE=CHI DF=DF GEN1 PVALUE=1-$CDF * Print the LM test statistic for heteroskedasticity PRINT LM PVALUE * Feasible GLS GENR LU=LOG(U*U) * The ? prefix is used to suppress the output from the command. ?OLS LU lincome lcigpric educ age agesq restaurn / PREDICT=g GENR hw=1/exp(g) * Equation (8.36), p. 270. * The WEIGHT= option specifies the weight variable for WLS. * A companion option is the NONORM option (for more details see * the SHAZAM User's Reference Manual). OLS cigs lincome lcigpric educ age agesq restaurn / WEIGHT=hw NONORM * The feasible GLS procedure can be viewed as a two-step procedure. * In the first step the OLS residuals are used to obtain an estimate * of the variance function. In the second step, GLS estimation * is implemented. * Another estimation approach is to consider the method of * maximum likelihood estimation. See Appendix C.4 of the text. * With SHAZAM, the HET command is available for maximum likelihood * estimation of models with heteroskedastic errors. * The MODEL=MULT option assumes a variance equation of the form * stated in Equation (8.30), p. 267. HET cigs lincome lcigpric educ age agesq restaurn / MODEL=MULT STOP