'Data manipulation series cons_total=cons_nondur+cons_services series lnc=log(cons_total) series real_ret=(1+vwret)/(1+cpi) series real_ret1=(1+ewret)/(1+cpi) series real_ret2=(1+gb)/(1+cpi) series real_ret3=(1+cb)/(1+cpi) series real_ret4=(1+tb)/(1+cpi) series lnr=log(real_ret) 'The OLS approach equation ols.ls(n) lnc(+1) c lnc lnr(+1) scalar gamma=1/ols.@coefs(3) scalar ro=@exp(-ols.@coefs(1)/ols.@coefs(3)+0.5*(@var(cons_total)/(@mean(cons_total))^2))-1 'Two tests and a histogram freeze(OLS_Wald) ols.wald c(2)=1 'Note that we actually assume a unit root process for log-consumption. So none of the usual inference under OLS will be valid if the null is true. This will become clear later in the course, when Time Series Econometrics is presented. For our purpopses it suffices to say that the interpretation of the coefficients is highly questionable. freeze(OLS_White) ols.white(c) 'White's test as a general test for model misspecification, since the null hypothesis underlying the test assumes that the errors are both homoskedastic and independent of the regressors, and that the linear specification of the model is correct. Failure of any one of these conditions could lead to a significant test statistic. freeze(OLS_Histogram)ols.hist 'GMM with the linear specification equation gmm_linear.gmm(b=a,q,i) lnc(+1) c lnc lnr(+1) @ c lnc(-1) lnr lnr(-1) scalar gamma1=1/gmm_linear.@coefs(3) scalar ro1=@exp(-gmm_linear.@coefs(1)/gmm_linear.@coefs(3)+0.5*(@var(cons_total)/(@mean(cons_total))^2))-1 'Two tests and a histogram again freeze(GMM_Wald) gmm_linear.wald c(2)=1 freeze(GMM_White) gmm_linear.white(c) freeze(GMM_Histogram)gmm_linear.hist 'J-test is a misspecification test, based on the number of overidentifying restrictions. In gmm_linear we have only one overidentifying restriction since we estimate 3 parameters with four moment restrictions. scalar j_test=gmm_linear.@regobs*gmm_linear.@jstat scalar j_test_p=1-@cchisq(j_test,1) 'Note that the value of gmm_linear.@jstat still has the interpretation as the distance from zero of the moment restrictions, but has no clear economic interpretation. 'GMM approach equation gmm_nonlinear.gmm(b=a,q,i) (1/(1+C(1)))*(real_ret(+1))*(cons_total/cons_total(+1))^C(2)-1 @ c cons_total(-1) real_ret real_ret(-1) scalar j_test1=gmm_nonlinear.@regobs*gmm_nonlinear.@jstat scalar j_test_p1=1-@cchisq(j_test,2) 'GMM system approach system sys1 sys1.append 1=(1/(1+C(1)))*(real_ret(+1))*(cons_total/cons_total(+1))^C(2) sys1.append 1=(1/(1+C(1)))*(real_ret1(+1))*(cons_total/cons_total(+1))^C(2) sys1.append 1=(1/(1+C(1)))*(real_ret2(+1))*(cons_total/cons_total(+1))^C(2) sys1.append 1=(1/(1+C(1)))*(real_ret3(+1))*(cons_total/cons_total(+1))^C(2) sys1.append 1=(1/(1+C(1)))*(real_ret4(+1))*(cons_total/cons_total(+1))^C(2) sys1.append inst c cons_total(-1) real_ret(-1) real_ret1(-1) real_ret2(-1) real_ret3(-1) real_ret4(-1) sys1.gmm(b=a,q,i) scalar j_test2=sys1.@regobs*sys1.@jstat scalar j_test_p2=1-@cchisq(j_test,33)