* * Cointegration analysis of exchange rate data using ML procedure, pp 647-650 * cal(m) 1973 open data exdata.rat data(format=rats) 1973:1 1989:10 pc6it pzunew exritl * * Transform and normalize the data series * set italcpi = 100*log(pc6it) set uscpi = 100*log(pzunew) set exrat = -100*log(exritl) * set ditcpi = italcpi-italcpi{1} set duscpi = uscpi-uscpi{1} set dexrat = exrat-exrat{1} * cmom 1974:2 * # duscpi dexrat ditcpi uscpi{1} exrat{1} italcpi{1} $ ditcpi{1 to 11} duscpi{1 to 11} dexrat{1 to 11} constant * * "Sweeping" on a cross product matrix, in effect, regresses a set of variables * on the pivots, leaving behind both regression coefficients and the cross * product of residuals (or, in this case, because we've already scaled down by * %nobs, the covariance matrix of residuals). * compute [rect] s=%cmom*(1.0/%nobs) compute s=%sweeplist(s,%seq(7,%ncmom)) * compute [symm] suu=%xsubmat(s,1,3,1,3) compute [symm] svv=%xsubmat(s,4,6,4,6) compute [rect] suv=%xsubmat(s,1,3,4,6) compute [symm] vuuv=tr(suv)*inv(suu)*suv * eigen(general=svv) vuuv eigval eigvec disp disp "Unrestricted eigenvalues and T log(1-lambda)" do i=1,3 disp i eigval(i) %nobs*log(1-eigval(i)) end do i * * Pull the first eigenvector. * compute a1=%xcol(eigvec,1) * * This normalizes a1 to have a unit coefficient in the first element. * compute a1=a1/a1(1) disp "Cointegrating vector" disp a1 * * Restriction from page 649 * disp disp "Test of restriction that exrate doesn't enter cointegrating relation" compute d=||1.0,0.0|0.0,0.0|0.0,1.0|| eigen(general=%mqform(svv,d)) %mqform(vuuv,d) eigvalr eigvecr disp disp "Restricted eigenvalues and T log(1-lambda)" do i=1,2 disp i eigvalr(i) %nobs*log(1-eigvalr(i)) end do i * * LR test of restriction given 1 cointegrating relation * compute lr=%nobs*log(1-eigvalr(1))-%nobs*log(1-eigval(1)) cdf chisqr lr 1 * compute [vect] x1r=d*%xcol(eigvecr,1) compute x1r=x1r*x1r(1) disp "Restricted cointegrating vector" disp x1r * * Restriction from page 650 * disp disp "Test of restriction that cointegrating relation is PPP" compute d=||1.0|-1.0|-1.0|| eigen(general=%mqform(svv,d)) %mqform(vuuv,d) eigvalr eigvecr disp disp "Restricted eigenvalues and T log(1-lambda)" do i=1,1 disp i eigvalr(i) %nobs*log(1-eigvalr(i)) end do i * * LR test of restriction given 1 cointegrating relation * compute lr=%nobs*log(1-eigvalr(1))-%nobs*log(1-eigval(1)) cdf chisqr lr 2 * compute x1r=d*%xcol(eigvecr,1) compute x1r=x1r/x1r(1) disp "Restricted cointegrating vector" disp x1r