* * Example 8.4 on pp 158-159 * Pesaran-Hall version of the Cox non-nested hypothesis test * open data tablef8-1[1].txt calendar(q) 1972 data(format=prn,org=columns) 1972:1 1985:2 pa pe * * Do the restricted regressions. These are both done by estimating the * unrestricted regression, then doing an MRESTRICT(CREATE) to impose the * restriction. Since a MRESTRICT(CREATE) changes the base regression, it has to * be redone when going to the second formulation. * * MRESTRICT is used rather than RESTRICT because it's necessary to do each * restriction on three different forms of the regression. MRESTRICT is like * RESTRICT, but uses matrices for the restrictions. With the restrictions written * as Rb=r, you create a "capR" matrix and a "lowR" vector for each restriction. * * In each case, save the residuals, the sum of squared residuals and the * restricted x'x**-1 etc. matrix. * dec rect capr0(3,5) lowr0(3,1) input capr0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 input lowr0 0 0 1 dec rect capr1(3,5) lowr1(3,1) input capr1 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 input lowr1 1 0 0 linreg pe # pe{1 2} pa{0 1 2} compute xx0=inv(%xx) mrestrict(create) 3 capr0 lowr0 res0 compute g0=%xx,v0=%rss,s0=%seesq * linreg pe # pe{1 2} pa{0 1 2} compute xx1=inv(%xx) mrestrict(create) 3 capr1 lowr1 res1 compute g1=%xx,v1=%rss,s1=%seesq * set fit0 = pe-res0 set fit1 = pe-res1 * linreg(noprint) fit0 # pe{1 2} pa{0 1 2} mrestrict(create,noprint) 3 capr1 lowr1 res10 compute v10=%rss linreg(noprint) fit1 # pe{1 2} pa{0 1 2} mrestrict(create,noprint) 3 capr0 lowr0 res01 compute v01=%rss * set fit10 = pe-res10 set fit01 = pe-res01 * linreg(noprint) fit10 # pe{1 2} pa{0 1 2} mrestrict(create,noprint) 3 capr0 lowr0 res100 compute v100=%rss linreg(noprint) fit01 # pe{1 2} pa{0 1 2} mrestrict(create,noprint) 3 capr1 lowr1 res011 compute v011=%rss * * Compute * compute traceval=%nobs-%dot(g0,xx0)-%dot(g1,xx1)+%dot(g0,xx0*g1*xx0) compute s10=v10+s0*traceval compute s01=v01+s1*traceval * compute w0=sqrt(%nobs)*(v1-v0-v10)/sqrt(4*v0*v100) compute w1=sqrt(%nobs)*(v0-v1-v01)/sqrt(4*v1*v011) compute n0=.5*%nobs*log(s1/s10)/sqrt(4*v100*s0/s10**2) compute n1=.5*%nobs*log(s0/s01)/sqrt(4*v011*s1/s01**2) * ?? s1/s10 clearly has a scale problem