* * HANNAN.RPF * RATS Version 8, User's Guide, Example 14.1. * cal(m) 1977:3 open data haversample.rat data(format=rats) 1977:3 2007:4 fcm30 ftbs3 * * Do OLS regression. Save the lag coefficients in a series * linreg fcm30 # constant ftbs3{0 to 12} set olslags 1 13 = %beta(t+1) * * Do the Hannan filter on the independent and dependent variables. * inquire(lastreg) n1 n2 compute nords = 2*%freqsize(%nobs) freq 3 nords rtoc # %resids fcm30 ftbs3 # 1 2 3 * * Compute the transfer function of the whitening filter * fft 1 cmult 1 1 window 1 cset 1 = 1./%csqrt(%z(t,1)) * * To make the HE regression more comparable (in terms of such things as * sum of squared residuals), normalize the transfer function so it * represents a filter with a 1 at 0 lag. Because the IFT has a 1/N * divisor, we need to rescale to make the sum of the entries of the IFT * to be N. Note that this will have no effect on the lag coefficients, * since both the filtered dependent and explanatory variables are scaled * by the same factor. * sstats 1 nords %real(%z(t,1))>>sumtr cset 1 = %z(t,1)*nords/sumtr * dofor i = 2 3 fft i cmult i 1 ift i end dofor * * Send the filtered variables back to the time domain and run the GLS * regression. * ctor # 2 3 # lfilt sfilt * linreg(title="Hannan Efficient") lfilt n1 n2 # constant sfilt{0 to 12} set hannanlags 1 13 = %beta(t+1) * graph(number=0,header="Distributed Lag Coefficients",$ key=below,klabels=||"OLS Estimates","Hannan GLS Estimates"||) 2 # olslags # hannanlags