** Chapter 8.4 ** for W.H. Greene, Econometric Analysis 6th ed. **************** * (c) Noel Roy 2003, 2008 * * 8.4 HETEROSKEDASTICITY * 8.4.4 Estimating the Appropriate Covariance Matrix for Ordinary Least Squares * *=============================================================================== * * Example 8.2 (p. 164) The White Estimator * READ (TableF8-1.prn) /NAMES * * First generate the variable INCOME2. * GENR Income2=Income**2 * * Use only those observations for which Avgexp is nonzero. * The SKIPIF (expression) command will cause subsequent commands to skip * observations for which the value of the expression is positive or true. * SET NOWARNSKIP SKIPIF (Avgexp .EQ. 0) * * Run the regression of Avgexp on Age, Ownrent, Income and Income squared using OLS. * OLS Avgexp Age Ownrent Income Income2 / RESID=U STDERR=SE * * Test the joint significance of INCOME and INCOME2. * TEST TEST INCOME TEST INCOME2 END * * The HETCOV option with the OLS command uses White's (1980, cited in Greene) * heteroscedastic-consistent covariance matrix estimation to correct estimates * for an unknown form of heteroscedasticity. * OLS Avgexp Age Ownrent Income Income2 / HETCOV STDERR=WHITE * * Compute the Wald test statistic using the robust covariance matrix. * (The F-statistic is also given, even though it is not applicable here). * TEST TEST INCOME=0 TEST INCOME2=0 END * * The Davidson/MacKinnon corrections can be calculated using SHAZAM. See pp. 430-32 * of the SHAZAM Manual. * Davidson/MacKinnon (1) (DM1) can be calculated by multiplying the White standard * errors by the square root of N/(N-K). * Davidson/MacKinnon (2) DM2 can be calculated by COPYing the independent variables * (including the constant) into the matrix labelled X. GENR CON=1 COPY Age Ownrent Income Income2 CON X * Calculate the "hat" values xi'inv(X'X)xi. MATRIX HII=DIAG(X*INV(X'X)*X') * Scale the squared residuals by their true variances mii=1-hii (see p. 164) GENR U2=U**2 COPY U2 E2 MATRIX S0=E2/(1-HII) * Calculate the adjusted standard errors as per (8-27), with the ei squared scaled by mii. MATRIX DM2=SQRT(DIAG(INV(X'X)*X'*DIAG(S0)*X*INV(X'X))) * * Now present all four standard errors together, replicating Table 8.1. * GEN1 MULT = $N/$DF SAMPLE 1 5 GENR DM1 = SQRT(MULT)*WHITE PRINT SE WHITE DM1 DM2 * STOP *=============================================================================== * Updated September 4, 2008