** Chapter 8.5 ** for W.H. Greene, Econometric Analysis 6th ed. **************** * (c) Noel Roy 2003, 2008 * * 8.5 TESTING FOR HETEROSKEDASTICITY * *=============================================================================== * * Example 8.3 (p. 167) Testing for Heteroskedasticity * * 8.5.1 White's General Test * * The DIAGNOS command (with the HET option) reports results for a number * of tests for heteroskedasticity, including the White test. See pp. 184-85 * of the SHAZAM Manual for details. (Recall that * the DIAGNOS command must immediately follow estimation). * READ (TableF8-1.prn) /NAMES GENR Income2=Income**2 SET NOWARNSKIP SKIPIF (Avgexp .EQ. 0) ?OLS Avgexp Age Ownrent Income Income2 /RESID=U DIAGNOS /HET * * The DIAGNOS command fails to compute the White test statistic, because * (as noted in the text) not all of the variables in the set of x and * its squares and cross-products are unique (Income squared appears twice, * and Ownrent being a binary dummy has the same value as its square). * DIAGNOS fails because of perfect multicollinearity in the regressors). * However, the White test can be computed manually. * GENR U2=U**2 GENR AGE2=AGE**2 GENR INCOME3=INCOME**3 GENR INCOME4=INCOME**4 GENR AGEINC=AGE*INCOME GENR AGEINC2=AGE*INCOME2 GENR AGEOWN=AGE*OWNRENT GENR OWNINC=OWNRENT*INCOME GENR OWNINC2=OWNRENT*INCOME2 ?OLS U2 AGE OWNRENT INCOME INCOME2 INCOME3 INCOME4 AGE2 AGEINC AGEINC2 AGEOWN OWNINC OWNINC2 * The test statistic is N R-squared, and is asymptotically chi-squared. * N is stored in the temporary variable $N, R-squared as $R2, and the number of variables * (including the ocnstant) as $K. GEN1 CHISTAT=$N*$R2 * Degrees of freedom GEN1 DF=$K-1 PRINT CHISTAT * p-value of CHISTAT DISTRIB CHISTAT /TYPE=CHI DF=DF * * 8.5.2 The Breusch-Pagan/Godfrey Test * * The DIAGNOS /HET command produces both Breusch-Pagan/Godfrey (B-P-G) and * Koenker test statistics, for the alternative hypothesis the vector of * independent variables zi in the stockastic equation is the same as the * vector of independent variables xi in the estimation equation. * Example 8.3, however uses the alternative hypothesis that * the variance is a quadratic function in Income. For this alternative * hypothesis, the test statistics must be computed manually. * ?OLS AVGEXP AGE OWNRENT INCOME INCOME2 /RESID=E GENR EE=E**2 GEN1 SSE=$SSE * Compute the gi vector in (8-28). GENR g=EE/(SSE/$N)-1 * The LM statistic is 1/2 the SSR of the regression of gi on (1,zi). ?OLS g INCOME INCOME2 * $SSR is a temporary variable for the regression (explained) sum of squares. GEN1 BP=.5*$SSR gen1 DF=$K-1 DISTRIB BP /TYPE=CHI DF=DF * * Now compute the Koenker-Bassett LM statistic KB. * GENR DIFF=EE-SSE/$N * DIFF is the term in brackets for the expression for V on p. 166. GENR BRACKETS=DIFF**2 * The mean of BRACKETS is the variable V. ?STAT BRACKETS / MEAN=V * Make DIFF a vector. COPY DIFF A * The matrix A corresponds to the vector (u - ubar i) in the text. GENR I=1 COPY I INCOME INCOME2 Z * Z is the matrix of independent variables in the stochastic equation. MATRIX KB=(1/V)*A'Z*(INV(Z'Z))*Z'A * KB is the LM statistic at the bottom of p. 166. DISTRIB KB /TYPE=CHI DF=DF * * The Bera-Jarque test for normality can be applied to the OLS residuals * by the /GF option (see pp. 18-20 of the SHAZAM Manual). * OLS AVGEXP AGE OWNRENT INCOME INCOME2 /GF * STOP *=============================================================================== * Updated September 25, 2008