* * Empirical example from pp 111-115 * open data cigarett.prn data(format=prn,org=columns) 1 47 obs lnc lnp lny * linreg lnc # constant lnp lny scatter(footer="Figure 5.1 Plots of Residuals vs Log Y",hlabel="Log Y",vlabel="Residuals") # lny %resids set u = %resids * * Glejser tests for various powers of log y * set absu = abs(u) set reclny = 1.0/lny set sqrlny = sqrt(lny) set rsqrlny = 1.0/sqrlny * linreg absu # constant lny linreg absu # constant reclny linreg absu # constant rsqrlny linreg absu # constant sqrlny * * Goldfeld-Quandt Test. Rank the data according to lny and run the subsample * regressions on the first 17 and the last 17 data points. * order(ranks=ranky) lny linreg(smpl=ranky<=17) lnc # constant lnp lny compute rss1=%rss linreg(smpl=ranky>=30) lnc # constant lnp lny compute rss2=%rss cdf(title="Goldfeld-Quandt Test") ftest rss1/rss2 17 17 * * Spearman's Rank Correlation. This can be computed by looking at the t-stat in a * regression of the rank of absolute value of u on the ranks of y. (We already * have the ranks of y from the GQ test * order(ranks=ranku) absu linreg ranku # constant ranky * * Harvey's test * set logusq = log(absu**2) set loglogy = log(lny) linreg logusq # constant loglogy compute harvey=(%variance*(%nobs-1)-%rss)/4.9348 cdf(title="Harvey Test") chisqr harvey 1 * * White test - done using auxiliary regression * set lnpsq = lnp**2 set lnysq = lny**2 set lnpy = lnp*lny set usq = u**2 linreg usq # constant lnp lny lnpsq lnysq lnpy cdf(title="White test") chisqr %trsquared %nreg-1 * * White test done using the RegWhiteTest procedure * linreg lnc # constant lnp lny @RegWhiteTest * * Estimation with "White" standard errors. Note that the standard errors shown in * the text are scaled up by sqrt(46/43) over those that RATS computes. * linreg(robusterrors) lnc # constant lnp lny * * The Jarque-Bera test is part of the standard output from the STATISTICS * instruction. Note that RATS lists the "excess" kurtosis, which measures the * thickness of the tails relative to those of a Normal distribution. RATS also * uses slightly different formulas for the skewness and kurtosis. * stats %resids