* * Martin, Hurn and Harris, "Econometric Modelling with Time Series" * Examples 9.20, 9.21, from pp 335-339 * Forward Market Efficiency Revisited * open data sf.dat calendar(m) 1979:4 data(format=prn,nolabels,org=columns) 1979:04 2011:11 forward spot * set y = spot{-3}-forward set spotlead = spot{-3} * spgraph(hfields=2,footer="Figure 9.2 Monthly data on the spot and three-month forward exchange rates") graph(header="(a) Spot and Forward Rates") 2 # spotlead # forward graph(header="(b) Spread") # y spgraph(done) * linreg y # constant y{3} corr(number=6) %resids set uy3 = %resids*y{3} corr(number=6) uy3 * * Be careful about integer divides in the calculations below. Write * 2.0/9.0 rather than 2/9. The latter is interpreted as an integer * divide and will be zero. Similarly, the 1/3 later is written as * 1.0/3.0. * compute lags=fix(4*(.01*%nobs)^(2.0/9.0)) * linreg(lwindow=newey,lags=lags) y # constant y{3} * * Compute the revised lag * mcov(lwindow=flat,lags=lags,lastreg,matrix=flat) / %resids mcov(lwindow=newey,lags=lags,lastreg,matrix=newey) / %resids compute units=%fill(%nreg,1,1.0) compute v0hat=%qform(flat,units),v1hat=%qform((lags+1)*(flat-newey),units) * compute newlags=fix(1.1447*(v1hat^2/v0hat^2*%nobs)^(1.0/3.0)) disp "Revised lags" newlags