* Reference: Chapters 4, 7, 8, 9 of * Jeffrey M. Wooldridge, Introductory Econometrics: A Modern Approach, * South-Western College Publishing, 2000. SAMPLE 1 88 READ (HPRICE1.shd) price assess bdrms lotsize sqrft colonial & lprice lassess llotsize lsqrft * Section 4.5 - Testing General Linear Restrictions, pp. 149-150. OLS lprice lassess llotsize lsqrft bdrms TEST TEST lassess=1 TEST llotsize=0 TEST lsqrft=0 TEST bdrms=0 END * Note that on a TEST command the variable names represent * coefficients. * Example 7.4, pp. 218-219 OLS lprice llotsize lsqrft bdrms colonial / COEF=BETA STDERR=SE * Estimate the expected percentage difference in price for a colonial * style house. * An interpretation of the coefficients is discussed in * Peter Kennedy, 1981, "Estimation with Correctly Interpreted Dummy * Variables in Semi-Logarithmic Equations," American Economic Review, * p. 801. GEN1 BC=BETA:4 GEN1 SEC=SE:4 * The calculation is a corrected form of Equation (7.10), p. 219. GEN1 P = 100*(EXP(BC - SEC*SEC/2) - 1) PRINT P * Example 8.4 * Scale the price variable GENR price=price/1000 * Equation (8.17), p. 258 OLS price lotsize sqrft bdrms / RESID=U DIAGNOS / HET * The DIAGNOS / HET command reports tests for heteroskedasticity * based on the previous regression. * The output for this example includes the test statistics: * E**2 ON X TEST: * KOENKER(R2): 14.092 3 0.00278 * B-P-G (SSR) : 30.023 3 0.00000 * The first test statistic above is the LM test (from * Equation (8.16), p. 257 of the text). * The second test statistic is based on the Breusch-Pagan * form of the test that assumes the errors are normally distributed. * Alternatively, test statistics can be programmed with SHAZAM * commands. The commands below compute the LM statistic. * Generate the squared residuals. GENR U2=U*U * Regress the squared residuals on the explanatory variables. OLS U2 lotsize sqrft bdrms * Obtain the LM statistic for heteroskedasticity. * SHAZAM temporary variables contain results from the previous * regression. The number of observations is stored in the variable * $N and the R-square is stored in the variable $R2. GEN1 LM=$N*$R2 PRINT LM * Now use a logarithmic functional form as a possible means for * reducing heteroskedasticity * Equation (8.18), p. 258 OLS lprice llotsize lsqrft bdrms / RESID=U PREDICT=YHAT * Report test statistics for heteroskedasticity DIAGNOS / HET * Example 8.5, p. 260. * Special form of the White test for heteroskedasticity. GENR U2=U*U GENR YHAT2=YHAT*YHAT * Run the auxiliary regression. OLS U2 YHAT YHAT2 * Compute the test statistic using the results from the * auxiliary regression. GEN1 LM=$N*$R2 GEN1 DF=$K-1 SAMPLE 1 1 * Use the DISTRIB command to compute a p-value for the test statistic. DISTRIB LM / TYPE=CHI DF=DF CDF=CDF GEN1 p_value=1-CDF * Print the test statistic and the p-value. PRINT LM p_value * Example 9.2 - RESET specification error test, p. 282 SAMPLE 1 88 * Equation (9.4) - see estimation results in Equation (8.17), p. 258. OLS price lotsize sqrft bdrms DIAGNOS / RESET * Following an OLS estimation command, the DIAGNOS / RESET command * reports a variety of specification error tests. * Further details are in the SHAZAM User's Reference Manual * in the chapter DIAGNOSTIC TESTS. * The textbook proposes a test based on an auxiliary regression that * includes squared amd cubed terms of the fitted values from the * initial estimation (see Equation (9.3), p. 282). * The test statistic based on this form of the RESET test is * reported as RESET(3) on the SHAZAM output from the * DIAGNOS / RESET command. * Equation (9.5) - see estimation results in Equation (8.18), p. 258. OLS lprice llotsize lsqrft bdrms DIAGNOS / RESET STOP