* * SHORTANDLONGVECM.RPF * Example of VECM with short-and-long run restrictions for structural model. * * From Lutkepohl, New Introduction to Multiple Time Series Analysis * Example 9.4 from pp 377-383 * open data kpswdata.rat calendar(q) 1947 data(format=rats) 1947:1 1988:4 c in y mp dp r * * Data are already in logs. We need to scale by 100. * set c = c*100.0 set y = y*100.0 set in = in*100.0 * graph(footer="Figure 9.1 Quarterly U.S. data",\$ key=below,klabels=||"Income","Consumption","Investment"||) 3 # y # c # in * * Number of lags in the VECM (one more than the number of lags on the * differences). * compute p=4 * * With two cointegrating vectors, this would be easier to analyze using * CATS. * * This does the testing * @johmle(lags=p,det=constant) # y c in * * This estimates given a chosen rank of 2 and defines two error * correction equations and the beta matrix of cointegration vectors. * @johmle(lags=p,det=constant,rank=2,ect=ecteqns,vectors=beta) # y c in * * Define and estimate the VECM * system(model=vecm) variables y c in det constant lags 1 to p ect ecteqns end(system) * estimate(resids=resids) * * Get the matrix of coefficients * compute vecmbeta=%modelgetcoeffs(vecm) * * Compute the sum of the coefficients on the short-run polynomial and * the derivative of its z-transform evaluated at z=1. * compute lagsums=%identity(%nvar) compute lagsumprime=%zeros(%nvar,%nvar) do k=1,p-1 ewise lagsums(i,j)=lagsums(i,j)-vecmbeta((j-1)*(p-1)+k,i) ewise lagsumprime(i,j)=lagsumprime(i,j)-k*vecmbeta((j-1)*(p-1)+k,i) end do k * * Compute the long-run response matrix for the VECM. * compute masums=%perp(beta)*\$ inv(tr(%perp(%vecmalpha))*lagsums*%perp(beta))*\$ tr(%perp(%vecmalpha)) * dec rect lr(3,3) sr(3,3) * * Because of rank 2 cointegration, the masums matrix is rank one. As a * result, restricting the (1,2) and (1,3) long-run responses to zero * also forces the responses of the other two variables to zero as well. * So three restrictions (in this pattern) will just identify the model. * input lr . 0 0 . . . . . . input sr . . . . . 0 . . . @ShortAndLong(lr=lr,sr=sr,masum=masums) %sigma f disp ###.### "Impact Responses" f disp ###.### "Long run Responses" masums*f * @varirf(factor=f,steps=30,model=vecm,shocklabels=||"Permanent","Trans 1","Trans 2"||)