* * Example 6.2 on page 193 * This is based upon random numbers, so the results won't match those shown in * the book. If you want the results to be consistent from one run to the next, * use the SEED instruction at the top of the program. The syntax of this is SEED * big integer, like SEED 53430. If you don't the "random" number seed is set * based upon the date and time when the program in run, and so will be different * each time you run the program. * cal(a) 1950 all 1990:1 set(first=5) x = 10 + %ran(5.0) set(first=0.0) y = 2+2*x-.5*x{1}+.7*y{1}+%ran(5.0) linreg y / resids # constant x x{1} y{1} * * Durbin's H Test (6.46, p.183) * compute denom=1-%nobs*%stderrs(4)**2 if denom>0 compute h = %rho*sqrt(%nobs/denom) else compute h = 0.0 end if cdf(title="Durbin H Test") normal h * * Breusch-Godfrey test * linreg resids # constant x x{1} y{1} resids{1} exclude(title="Breusch-Godfrey Test for AR(1)") # resids{1} cdf(title="Breusch-Godfrey Test, TR**2 Variant") chisqr %trsq 1 * * Estimation of a misspecified relation, p.194 * linreg y # constant x * * Cochrane-Orcutt estimation, p.195 * ar1(method=corc) y # constant x * * Test of the Cochrane-Orcutt (common factor) restrictions, p.195 * linreg y # constant x{0 to 1} y{1} test(title="Test of Common Factor Restrictions") # 2 3 # %beta(4) 1.0 * * LM test for the presence of ARCH(1) pp.195-197 * set residsq = resids**2 linreg residsq # constant residsq{1} cdf(title="Test for ARCH(1) Residuals") chisqr %trsquared 1