SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 40098: Newey-West correction of standard errors for heteroscedasticity and autocorrelation

DetailsAboutRate It

SAS/ETS procedures PROC MODEL and PROC AUTOREG both provide the functionality to specify Newey-West heteroscedasticity and autocorrelation standard error correction.

PROC MODEL provides the KERNEL= option with the GMM estimator in the FIT statement to correct standard errors for heteroscedasticity and autocorrelation. The procedure supports three different kernels — Bartlett, Parzen, and Quadratic.

The general form of the KERNEL= option is

KERNEL=( PARZEN | QS | BART, c, e )

where c and e are nonnegative values used to compute the bandwidth parameter

l(n) = cne

The Newey-West standard error correction is a commonly used heteroscedasticity and autocorrelation correction. The formula for the Newey-West covariance matrix estimator can be found in Greene (2000). The Newey-West estimator corresponds to the Bartlett kernel with bandwidth parameter L+1, where L is the maximum lag length. To specify the Newey-West kernel with lag length L using PROC MODEL, specify KERNEL=(BART, L+1, 0), which produces bandwidth parameter

l(n) = (L+1)n0 = L+1

For more details on the three kernels supported in PROC MODEL, see "Estimation Methods" in the Details section of the PROC MODEL documentation.

PROC AUTOREG provides the COVEST=HAC and COVEST=NEWEYWEST options in the MODEL statement to specify heteroscedasticity and autocorrelation correction. The COVEST=HAC option supports the following kernels with the KERNEL= option: BARTLETT, PARZEN, QUADRATICSPECTRAL, TRUNCATED, and TUKEYHANNING. To obtain the Newey-West covariance matrix estimator with maximum lag length L, specify the BARTLETT kernel with fixed value L+1 for the bandwidth parameter using COVEST=HAC(KERNEL=BARTLETT, BANDWIDTH=L+1).  Alternatively, specify COVEST=NEWEYWEST(GAMMA=0, RATE=0, CONSTANT=L+1), where the bandwidth parameter is calculated as

        b =  [GAMMA*TRATE+CONSTANT], where [x] denotes the largest integer less than or equal to x, and T is the sample size.

For more details on the COVEST=HAC and COVEST=NEWEYWEST options, see "MODEL Statement" in the Syntax section in the PROC AUTOREG documentation.

Example 1. Newey-West standard error correction for OLS estimates

These data are presented in Example 13.1 in Greene (2004). These statements create data set ONE with variables containing data on GNP, investment, price index, and nominal interest rate.

data one;
   input gnp invest price interest;
   year=_n_+1962;
datalines;
596.7  90.9 0.7167  3.23
637.7  97.4 0.7277  3.55
691.1 113.5 0.7436  4.04
756.0 125.7 0.7676  4.5
799.6 122.8 0.7906  4.19
873.4 133.3 0.8254  5.16
944.0 149.3 0.8679  5.87
992.7 144.2 0.9145  5.95
1077.6 166.4 0.9601  4.88
1185.9 195   1       4.5
1326.4 229.8 1.0575  6.44
1434.2 228.7 1.1508  7.83
1549.2 206.1 1.2579  6.25
1718   257.9 1.3234  5.5
1918.3 324.1 1.4005  5.46
2163.9 386.6 1.5042  7.46
2417.8 423   1.6342 10.28
2631.7 401.9 1.7842 11.77
2954.1 474.9 1.9514 13.42
3073.0 414.5 2.0688 11.02
;

These steps create and display the real variables used in the regression analysis. Real GNP and real investment are obtained by dividing the nominal figures by the price index. An approximation to the real interest rate is obtained by subtracting the rate of change in the price index from the interest rate.

data two;
   set one;
   r_gnp=gnp/price;                          /*  Real GNP                 */
   r_invest=invest/price;                    /*  Real Investment          */
   rate=((price-lag(price))/lag(price))*100; /*  Price index change rate  */
   r_int=interest-rate;                      /*  Real Interest Rate       */
   if r_int=. then delete;
   label r_gnp="Real GNP"
         r_invest="Real Investment"
         r_int="Real Interest Rate";
run;
proc print data=two noobs label;
   var r_invest r_gnp r_int;
run;
Real Investment Real GNP Real Interest
Rate
133.846 876.32 2.01519
152.636 929.40 1.85503
163.757 984.89 1.27246
155.325 1011.38 1.19365
161.497 1058.15 0.75828
172.024 1087.68 0.72098
157.682 1085.51 0.58072
173.315 1122.38 -0.10633
195.000 1185.90 0.34418
217.305 1254.28 0.69000
198.731 1246.26 -0.99270
163.845 1231.58 -3.05657
194.877 1298.17 0.29291
231.417 1369.73 -0.36590
257.014 1438.57 0.05550
258.842 1479.50 1.63753
225.255 1475.00 2.59120
243.364 1513.84 4.04885
200.358 1485.40 5.00381

These statements regress real investment on real interest rate and real GNP using ordinary least squares (OLS) using PROC MODEL.

 proc model data=two;
     parms b0 b1 b2;
     r_invest=b0 + b1*r_int + b2*r_gnp;
     fit r_invest;
 run;
 quit;

The parameter estimates and the uncorrected standard errors from the model are shown below.

Nonlinear OLS Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b0 -12.5336 24.9153 -0.50 0.6218
b1 -1.00144 2.3687 -0.42 0.6781
b2 0.169136 0.0206 8.22 <.0001

To perform Newey-West standard error correction, PROC MODEL is run again specifying the GMM estimation method in the FIT statement. KERNEL=(BART, 5, 0) is also specified which requests the Bartlett kernel with a lag length of 4. The VARDEF=n option is specified to be consistent with the original Newey-West formula.

proc model data=two;
   endo r_invest;
   exog r_int r_gnp;
   instruments _exog_;
   parms b0 b1 b2;
   r_invest=b0 + b1*r_int + b2*r_gnp;
   fit r_invest / gmm kernel=(bart,5,0) vardef=n;
run;
quit; 

The parameter estimates and the Newey-West corrected standard errors from the above analysis appear below. Note that with GMM estimation, when the instruments used are all the exogenous variables in the OLS regression model, then the parameter estimates are identical to the OLS estimates. The results are consistent with table 13.2 in Greene (2000).

Nonlinear GMM Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b0 -12.5336 18.9583 -0.66 0.5179
b1 -1.00144 3.3424 -0.30 0.7683
b2 0.169136 0.0168 10.10 <.0001

In the above example, the lag length of 4 is chosen to be the same as in Greene (2000). Neither PROC MODEL nor PROC AUTOREG provides an option to determine the maximum lag length in Newey West correction. Greene (2000) contains this discussion about choosing the maximum lag length:

"The maximum lag L must be determined in advance to be large enough that autocorrelations at lags longer than L are small enough to ignore. For a moving-average process, this can be expected to be a relatively small number. For autoregressive process or mixtures, however, the autocorrelations are never zero, and the researcher must make a judgment as to how far back it is necessary to go."

To specify the Newey-West standard error correction using PROC AUTOREG, either one of the following steps can be used. The same results are obtained as those produced in PROC MODEL:

proc autoreg data=two;
   model r_invest = r_int r_gnp / covest=hac(kernel=bartlett, bandwidth=5);
run;      

or

proc autoreg data=two; 
   model r_invest = r_int r_gnp / covest=neweywest(gamma=0,rate=0,constant=5);
run;

Example 2. Newey-West standard error correction for the sample mean of a series

To obtain the Newey-West standard error correction for the sample mean of a series, fit an intercept-only model to the series. The estimated intercept is the sample mean, and the Newey-West standard error correction can be obtained as in Example 1.

The following PROC MEANS step computes the sample mean of the variable R_INVEST.

proc means data=two mean;
   var r_invest;
run;
Analysis Variable
: r_invest Real Investment
Mean
192.4258285

These statements fit an intercept-only model to the real investment series and perform the Newey-West standard error correction on the sample mean. The intercept-only model is specified by fitting the equation R_INVEST=B0. The INTONLY option in the INSTRUMENTS statement indicates that the only instrument used in the estimation is the intercept.

proc model data=two;
   endo r_invest;
   instruments / intonly;
   parms b0;
   r_invest=b0;
   fit r_invest / gmm kernel=(bart,5,0) vardef=n;
run;
quit;

The parameter estimates and the standard errors appear below. The B0 parameter estimate is the sample mean of the R_INVEST series. The reported standard errors are Newey-West corrected standard errors for the B0 estimate.

Nonlinear GMM Parameter Estimates
Parameter Estimate Approx Std Err t Value Approx
Pr > |t|
b0 192.4258 14.8539 12.95 <.0001

The same results can be obtained using the AUTOREG procedure with either the COVEST=HAC option or the COVEST=NEWEYWEST option:

proc autoreg data=two;
   model r_invest = / covest=hac(kernel=bartlett, bandwidth=5);
run;         

or

proc autoreg data=two ;
   model r_invest = /covest=neweywest(gamma=0, rate=0, constant=5);
run;

____

Greene, William H. (2000), Econometric Analysis, Fourth Edition, Upper Saddle River, NJ: Prentice-Hall.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/ETSz/OS
OpenVMS VAX
Microsoft® Windows® for 64-Bit Itanium-based Systems
Microsoft Windows Server 2003 Datacenter 64-bit Edition
Microsoft Windows Server 2003 Enterprise 64-bit Edition
Microsoft Windows XP 64-bit Edition
Microsoft® Windows® for x64
OS/2
Microsoft Windows 95/98
Microsoft Windows 2000 Advanced Server
Microsoft Windows 2000 Datacenter Server
Microsoft Windows 2000 Server
Microsoft Windows 2000 Professional
Microsoft Windows NT Workstation
Microsoft Windows Server 2003 Datacenter Edition
Microsoft Windows Server 2003 Enterprise Edition
Microsoft Windows Server 2003 Standard Edition
Microsoft Windows Server 2003 for x64
Microsoft Windows Server 2008
Microsoft Windows Server 2008 for x64
Microsoft Windows XP Professional
Windows 7 Enterprise 32 bit
Windows 7 Enterprise x64
Windows 7 Home Premium 32 bit
Windows 7 Home Premium x64
Windows 7 Professional 32 bit
Windows 7 Professional x64
Windows 7 Ultimate 32 bit
Windows 7 Ultimate x64
Windows Millennium Edition (Me)
Windows Vista
Windows Vista for x64
64-bit Enabled AIX
64-bit Enabled HP-UX
64-bit Enabled Solaris
ABI+ for Intel Architecture
AIX
HP-UX
HP-UX IPF
IRIX
Linux
Linux for x64
Linux on Itanium
OpenVMS Alpha
OpenVMS on HP Integrity
Solaris
Solaris for x64
Tru64 UNIX
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.