RATS 10.1
RATS 10.1

HANNAN.RPF is an example of Hannan's Efficient (spectral-based GLS) estimator. Hannan’s Efficient (Hannan (1963)) is a frequency domain procedure for serial correlation correction. It allows for arbitrary patterns of serial correlation as long as the disturbance process is covariance stationary. It may be applied to any regression for which GLS is consistent. The idea is this: for the model

\begin{equation} y_t = X_t \beta + u_t \end{equation}

we need a filter which transforms the residuals (\(u\)) to white noise. In the frequency domain, this means we are seeking a filter \(a(L)\) whose transfer function \(\tilde a(\omega )\) satisfies:

\begin{equation} \left| {\tilde a(\omega )} \right|^2 f_u (\omega ) = {\rm{constant}} \end{equation}

Any filter which satisfies this will have the desired effect. For convenience, we can choose the real-valued solution:

\begin{equation} \tilde a(\omega ) = \sqrt {1/f_u (\omega )} \end{equation}

Note that the “filter” used is very different from the standard autoregressive filters used for serial correlation correction in the time domain. Because it has a real-valued transfer function, the filter is, in fact, symmetric and two-sided. Thus, the filtered series will look very different from series quasi-differenced in the time domain.

 

To implement Hannan’s Efficient estimator, we need to compute the reciprocal square root of the spectral density of the residuals, and do a frequency domain filter of the dependent and independent variables. The actual regression is still done in the time domain. Because the number of variables which must be filtered depends upon the regression, this is not as readily converted into a standardized procedure as the frequency domain techniques. It's simpler here because this is being applied to a distributed lag, where the explanatory variables are all lags of a single variable.

 

A related technique is Engle's(1974) Band Spectrum Regression. In this procedure, the “filtering” procedure is to zero out certain bands in the Fourier transforms of the dependent variable and regressors. This is basically identical to Hannan efficient, except that a masking series is used instead of the one computed from the spectral density of residuals. For instance, to include just the lowest 3/4 of frequencies, use

 

cset 1 = t<=nords*3/8.or.t>nords*5/8

 

in place of the FFT, CMULT, WINDOW and CSET instructions (the calculations between the **** lines).

 

Full Program

 

cal(m) 1977:3
open data haversample.rat
data(format=rats) 1977:3 2007:4 fcm30 ftbs3
*
* Do OLS regression. Save the regression range (into N1 and N2) and save
* the lag coefficients in a series
*
linreg fcm30
# constant ftbs3{0 to 12}
compute n1=%regstart(),n2=%regend()
set olslags 1 13 = %beta(t+1)
*
* Do the Hannan filter on the independent and dependent variables.
*
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
*
* Run the regression over the original range. (LFILT and SFILT can get
* extended by the filtering process).
*
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

Output

Linear Regression - Estimation by Least Squares

Dependent Variable FCM30

Monthly Data From 1978:03 To 2007:04

Usable Observations                       350

Degrees of Freedom                        336

Centered R^2                        0.8262570

R-Bar^2                             0.8195348

Uncentered R^2                      0.9837519

Mean of Dependent Variable       7.8936000000

Std Error of Dependent Variable  2.5390073552

Standard Error of Estimate       1.0786007111

Sum of Squared Residuals         390.89551001

Regression F(13,336)                 122.9147

Significance Level of F             0.0000000

Log Likelihood                      -515.9672

Durbin-Watson Statistic                0.0655

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      3.247865847  0.129902540     25.00233  0.00000000

2.  FTBS3                         0.420367521  0.129239721      3.25262  0.00125951

3.  FTBS3{1}                     -0.100007054  0.230416044     -0.43403  0.66454655

4.  FTBS3{2}                      0.114770343  0.249970865      0.45913  0.64643420

5.  FTBS3{3}                     -0.123840118  0.252670240     -0.49013  0.62436500

6.  FTBS3{4}                      0.066769480  0.255120744      0.26172  0.79369986

7.  FTBS3{5}                      0.022466577  0.260938354      0.08610  0.93143886

8.  FTBS3{6}                      0.102745312  0.267477448      0.38413  0.70112729

9.  FTBS3{7}                     -0.080115584  0.260847743     -0.30714  0.75893056

10. FTBS3{8}                      0.118286874  0.255079661      0.46373  0.64314488

11. FTBS3{9}                     -0.114684516  0.252614725     -0.45399  0.65012925

12. FTBS3{10}                     0.101395308  0.249763424      0.40597  0.68502643

13. FTBS3{11}                    -0.107632113  0.229941598     -0.46808  0.64002760

14. FTBS3{12}                     0.349489735  0.128898882      2.71135  0.00704544


 

Linear Regression - Estimation by Hannan Efficient

Dependent Variable LFILT

Monthly Data From 1978:03 To 2007:04

Usable Observations                       350

Degrees of Freedom                        336

Centered R^2                        0.5150223

R-Bar^2                             0.4962583

Uncentered R^2                      0.8350987

Mean of Dependent Variable       0.3563607265

Std Error of Dependent Variable  0.2561511173

Standard Error of Estimate       0.1818026540

Sum of Squared Residuals         11.105540880

Regression F(13,336)                  27.4473

Significance Level of F             0.0000000

Log Likelihood                       107.2071

Durbin-Watson Statistic                1.6517

 

    Variable                        Coeff      Std Error      T-Stat      Signif

************************************************************************************

1.  Constant                      0.154064252  0.020234347      7.61400  0.00000000

2.  SFILT                         0.431002814  0.027802705     15.50219  0.00000000

3.  SFILT{1}                     -0.060786607  0.030921650     -1.96583  0.05014175

4.  SFILT{2}                      0.112081884  0.030920517      3.62484  0.00033390

5.  SFILT{3}                     -0.066583350  0.030881028     -2.15612  0.03178326

6.  SFILT{4}                      0.096726869  0.030402998      3.18149  0.00160184

7.  SFILT{5}                      0.047137867  0.031475884      1.49759  0.13517946

8.  SFILT{6}                      0.033676515  0.032129970      1.04813  0.29533020

9.  SFILT{7}                      0.001649475  0.031419979      0.05250  0.95816335

10. SFILT{8}                      0.082694517  0.030361058      2.72370  0.00679280

11. SFILT{9}                     -0.069027689  0.030898428     -2.23402  0.02613928

12. SFILT{10}                     0.010190246  0.030901156      0.32977  0.74177995

13. SFILT{11}                     0.045824610  0.030751085      1.49018  0.13711537

14. SFILT{12}                     0.080485136  0.027773858      2.89787  0.00400369

 

Graph


Copyright © 2025 Thomas A. Doan