* * Example 8.3 from page 155 * Cox non-nested tests * open data tablef5-1[1].txt calendar(q) 1950 data(format=prn,org=columns) 1950:1 2000:4 year qtr realgdp realcons realinvs realgovt realdpi * * Do the two hypothesized regressions. Save the residuals, ML estimates of the * residual variance, and fitted values. * linreg realcons / resids0 # constant realdpi{0 1} compute s0=%rss/%nobs prj fit0 * linreg realcons / resids1 # constant realdpi realcons{1} compute s1=%rss/%nobs prj fit1 * * Do the calculations for testing 0 vs 1 * linreg(noprint) fit0 / resids01 # constant realdpi realcons{1} compute s01=s0+%rss/%nobs linreg(noprint) resids01 # constant realdpi{0 1} compute c01=.5*%nobs*log(s1/s01),v01=s0*%rss/(s01**2),q01=c01/sqrt(v01) * * Do the calculations for testing 1 vs 0 * linreg(noprint) fit1 / resids10 # constant realdpi{0 1} compute s10=s1+%rss/%nobs linreg(noprint) resids10 # constant realdpi realcons{1} compute c10=.5*%nobs*log(s0/s10),v10=s1*%rss/(s10**2),q10=c10/sqrt(v10) * cdf(title="Cox Test for 0 vs 1") normal q01 cdf(title="Cox Test for 1 vs 0") normal q10