* NON-NESTED MODEL TESTING DEMO sample 1 17 * -------------- Non-nested Cox test -------------- * H1: consume on income, H2: consume on price * See Judge, Griffiths, Hill, Lutkepohl, Lee, 1985, pp. 883-884 ols consume income / coef=b1 dn predict=y1hat gen1 s1=$sig2 ols consume price / coef=b2 dn predict=y2hat gen1 s2=$sig2 * Create the X and Z matrices, x for H1, z for H2 genr one=1 copy income one x copy price one z * Create the M matrices, m1 for H1, m2 for H2 matrix m2=iden(17)-z*inv(z'z)*z' matrix m1=iden(17)-x*inv(x'x)*x' * Test H1: the hypothesis that income is the true model * The test statistic h1 is asymptotically normally distributed matrix s21=s1+1/$n*(b1'x'm2*x*b1) matrix c12=$n/2*log(s2/s21) matrix vc12=(s1/s21**2)*(b1'x'm2*m1*m2*x*b1) matrix h1=c12/sqrt(vc12) print c12 vc12 h1 * Now test H2: the hypothesis that price is the true model * The test statistic h2 is asymptotically normally distributed matrix s12=s2+1/$n*(b2'z'm1*z*b2) matrix c21=$n/2*log(s1/s12) matrix vc21=(s2/s12**2)*(b2'z'm1*m2*m1*z*b2) matrix h2=c21/sqrt(vc21) print c21 vc21 h2 * -------------- The Davidson-Mackinnon J test -------------- * To test H1, see if the coefficient on Y2HAT is zero ols consume income y2hat * To test H2, see if the coefficient on Y1HAT is zero ols consume price y1hat STOP