* * Example 8.6.5 from pp 385-390 * open data w-tb3n6ms.txt calendar(w) 1958:12:12 data(format=free,org=columns) 1958:12:12 2004:8:6 tb3mo tb6mo * spgraph(vfields=2,footer="Figure 8.12 Time plots of weekly U.S. interest rates") graph(header="(a) 3-month-bill") # tb3mo graph(header="(b) 6-month-bill") # tb6mo spgraph(done) * * Dickey-Fuller tests for unit roots. Note that DFUNIT counts the number of * *additional* lags, so the AR(3) is done with lags=2) * @dfunit(lags=2) tb3mo @dfunit(lags=2) tb6mo * @varlagselect(lags=6,crit=aic) # tb3mo tb6mo * @johmle(lags=3,det=rc,cv=cv1) # tb3mo tb6mo * * Create the equation that describes the cointegrating vector * equation(coeffs=cv1) cv * # tb3mo tb6mo constant * * Setup and estimate the ECM * system(model=varmodel) var tb3mo tb6mo lags 1 to 3 ect cv end(system) * estimate compute fullmodel=%modelsubstect(varmodel) * forecast(steps=10,model=fullmodel,results=forecasts,stderrs=stderrs) * spgraph(hfields=2,footer="Figure 8.15 Forecasting plots of a fitted ECM model") set upper (2004:8:6)+1 (2004:8:6)+10 = forecasts(1)+%invnormal(.975)*stderrs(1) set lower (2004:8:6)+1 (2004:8:6)+10 = forecasts(1)+%invnormal(.025)*stderrs(1) graph(header="(a) 3-month-bill") 4 # tb3mo (2004:8:6)-49 * # forecasts(1) # upper / 3 # lower / 3 set upper (2004:8:6)+1 (2004:8:6)+10 = forecasts(2)+%invnormal(.975)*stderrs(2) set lower (2004:8:6)+1 (2004:8:6)+10 = forecasts(2)+%invnormal(.025)*stderrs(2) graph(header="(b) 6-month-bill") 4 # tb6mo (2004:8:6)-49 * # forecasts(2) # upper / 3 # lower / 3 spgraph(done)