Chapter 4 Correct for Serial Correlation

4.1 Prais-Winsten Estimation in the Event Study

Lesson: We’ll account for serial correlation with a FGLS Prais-Winsten model.

Set Time Series

cd "/Users/Sam/Desktop/Econ 645/Data/Wooldridge"
use barium.dta, clear
tsset t, monthly
/Users/Sam/Desktop/Econ 645/Data/Wooldridge

        time variable:  t, 1960m2 to 1970m12
                delta:  1 month

OLS

est clear
eststo OLS: reg lchnimp lchempi lgas lrtwex befile6 affile6 afdec6
estat dwstat
      Source |       SS           df       MS      Number of obs   =       131
-------------+----------------------------------   F(6, 124)       =      9.06
       Model |  19.4051607         6  3.23419346   Prob > F        =    0.0000
    Residual |  44.2470875       124  .356831351   R-squared       =    0.3049
-------------+----------------------------------   Adj R-squared   =    0.2712
       Total |  63.6522483       130  .489632679   Root MSE        =    .59735

------------------------------------------------------------------------------
     lchnimp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lchempi |   3.117193   .4792021     6.50   0.000     2.168718    4.065668
        lgas |   .1963504   .9066172     0.22   0.829    -1.598099      1.9908
      lrtwex |   .9830183   .4001537     2.46   0.015     .1910022    1.775034
     befile6 |   .0595739   .2609699     0.23   0.820    -.4569585    .5761064
     affile6 |  -.0324064   .2642973    -0.12   0.903    -.5555249     .490712
      afdec6 |   -.565245   .2858352    -1.98   0.050    -1.130993    .0005028
       _cons |    -17.803   21.04537    -0.85   0.399    -59.45769    23.85169
------------------------------------------------------------------------------


Durbin-Watson d-statistic(  7,   131) =  1.458414

Prais-Winsten

eststo Prais: prais lchnimp lchempi lgas lrtwex befile6 affile6 afdec6
Iteration 0:  rho = 0.0000
Iteration 1:  rho = 0.2708
Iteration 2:  rho = 0.2910
Iteration 3:  rho = 0.2930
Iteration 4:  rho = 0.2932
Iteration 5:  rho = 0.2932
Iteration 6:  rho = 0.2932
Iteration 7:  rho = 0.2932

Prais-Winsten AR(1) regression -- iterated estimates

      Source |       SS           df       MS      Number of obs   =       131
-------------+----------------------------------   F(6, 124)       =      5.24
       Model |  10.3252323         6  1.72087205   Prob > F        =    0.0001
    Residual |  40.7593886       124  .328704747   R-squared       =    0.2021
-------------+----------------------------------   Adj R-squared   =    0.1635
       Total |  51.0846209       130  .392958622   Root MSE        =    .57333

------------------------------------------------------------------------------
     lchnimp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lchempi |   2.940949   .6328402     4.65   0.000     1.688381    4.193517
        lgas |    1.04638   .9773356     1.07   0.286    -.8880406    2.980801
      lrtwex |   1.132791   .5066578     2.24   0.027     .1299738    2.135609
     befile6 |  -.0164787   .3193802    -0.05   0.959    -.6486216    .6156641
     affile6 |  -.0331563   .3218101    -0.10   0.918    -.6701086     .603796
      afdec6 |  -.5768122   .3419865    -1.69   0.094    -1.253699    .1000748
       _cons |   -37.0777    22.7783    -1.63   0.106    -82.16235    8.006941
-------------+----------------------------------------------------------------
         rho |    .293217
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    1.458414
Durbin-Watson statistic (transformed) 2.087181

First, let’s find our critical values:
https://www3.nd.edu/~wevans1/econ30331/Durbin_Watson_tables.pdf.

For the OLS Estimator \[ DW(6,131) = 1.458414 \] For the Prasi-Winsten Estimator \[ DW(6,131) = 2.087181 \] and \[ d_L \approx 1.60 \] and \[ d_U \approx 1.81 \] We reject the null hypothesis for the OLS estimator, but we fail to reject the null hypothesis for the Prais-Winsten Estimator.

Our beta-hats in Prais-Winsten Estimator are similar to our OLS estimates, but our PW standard errors account for the serial correlation. Our OLS standard errors usually understate the actual sampling variation in the OLS estimators and should be treated with suspicion.

    esttab, mtitle se stat(N rho)
                      (1)             (2)   
                      OLS           Prais   
--------------------------------------------
lchempi             3.117***        2.941***
                  (0.479)         (0.633)   

lgas                0.196           1.046   
                  (0.907)         (0.977)   

lrtwex              0.983*          1.133*  
                  (0.400)         (0.507)   

befile6            0.0596         -0.0165   
                  (0.261)         (0.319)   

affile6           -0.0324         -0.0332   
                  (0.264)         (0.322)   

afdec6             -0.565          -0.577   
                  (0.286)         (0.342)   

_cons              -17.80          -37.08   
                  (21.05)         (22.78)   
--------------------------------------------
N                     131             131   
rho                                 0.293   
--------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

4.2 Inflation and Prais

Lesson: our PW estimator might not be unbiased or consistent if our assumptions fail.

We’ll show another example comparing OLS and Prais-Winsten estimators. We’ll look at the static Phillips curve, which we know has serial correlation.

Set the Time Series

cd "/Users/Sam/Desktop/Econ 645/Data/Wooldridge"
use phillips.dta, clear
tsset year
est clear
/Users/Sam/Desktop/Econ 645/Data/Wooldridge

        time variable:  year, 1948 to 2003
                delta:  1 unit

OLS

quietly eststo OLS: reg inf unem if year < 1997

Prais-Winsten

quietly eststo PW: prais inf unem if year < 1997

Prais-Winsten with Cochrane-Orcutt Transformation

quietly eststo PW_CO: prais inf unem if year < 1997, corc

First Difference

quietly eststo FD: reg d.inf d.unem if year < 1997

Compare

    esttab, mtitle se stat(N rho)
                      (1)             (2)             (3)             (4)   
                      OLS              PW           PW_CO              FD   
----------------------------------------------------------------------------
unem                0.468          -0.716*         -0.665*                  
                  (0.289)         (0.313)         (0.320)                   

D.unem                                                             -0.842*  
                                                                  (0.314)   

_cons               1.424           8.296***        7.583**       -0.0782   
                  (1.719)         (2.231)         (2.381)         (0.348)   
----------------------------------------------------------------------------
N                      49              49              48              48   
rho                                 0.781           0.774                   
----------------------------------------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

The OLS and PW estimators might give very different estimators if our assumptions of strict exogeneity and the a \(Cov(x_(t+1)+x_(t-1),u_t)=0\) fail. If that is the case then using OLS with a first-difference might be a better method.

We can see that the difference is quite notable. With our OLS estimators, the tradeoff between inflation and employment is non-existent, but with the PW estimator our estimate of beta 1 is closer to our first-difference estimate of beta 1.

It is possible that there is no relationship with the static model, but the change in inflation and the change in unemployment are negatively related.

4.3 Differencing and Serial Correlation

4.3.1 Inflation and Deficits on Interest Rates

Lesson: First-differencing is a potential method to eliminate serial correlation.

Set the Time Series

cd "/Users/Sam/Desktop/Econ 645/Data/Wooldridge"
use intdef.dta, clear
tsset year
/Users/Sam/Desktop/Econ 645/Data/Wooldridge

        time variable:  year, 1948 to 2003
                delta:  1 unit

We’ll look at the relationship between interest rates from the 3-month T-bill rate (i3) and inflation rate (inf) and deficits as a percentage of GDP.

Static Model

Calculate a static model and test for serial correlation

reg i3 inf def if year < 2004
estat dwstat
      Source |       SS           df       MS      Number of obs   =        56
-------------+----------------------------------   F(2, 53)        =     40.09
       Model |  272.420338         2  136.210169   Prob > F        =    0.0000
    Residual |  180.054275        53  3.39725047   R-squared       =    0.6021
-------------+----------------------------------   Adj R-squared   =    0.5871
       Total |  452.474612        55  8.22681113   Root MSE        =    1.8432

------------------------------------------------------------------------------
          i3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         inf |   .6058659   .0821348     7.38   0.000     .4411243    .7706074
         def |   .5130579   .1183841     4.33   0.000     .2756095    .7505062
       _cons |   1.733266    .431967     4.01   0.000     .8668497    2.599682
------------------------------------------------------------------------------


Durbin-Watson d-statistic(  3,    56) =  .7161527

Critical values \(d(3,56)=.716\), at the 5% level \(dL = 1.452, dU=1.681\) \(dwstat < dL\) so we reject the null hypothesis

predict u, resid
reg u l.u, noconst
drop u
      Source |       SS           df       MS      Number of obs   =        55
-------------+----------------------------------   F(1, 54)        =     32.83
       Model |  64.1034163         1  64.1034163   Prob > F        =    0.0000
    Residual |  105.448636        54  1.95275252   R-squared       =    0.3781
-------------+----------------------------------   Adj R-squared   =    0.3666
       Total |  169.552053        55  3.08276459   Root MSE        =    1.3974

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |   .6228816   .1087148     5.73   0.000     .4049216    .8408415
------------------------------------------------------------------------------

We find that we have notable serial correlation in the error term that is statistically significant. We’ll run a first-difference model next.

First differencing

Run a first-difference and test for serial correlation

reg d.i3 d.inf d.def if year < 2004
dwstat
      Source |       SS           df       MS      Number of obs   =        55
-------------+----------------------------------   F(2, 52)        =      5.57
       Model |  17.8058164         2  8.90290822   Prob > F        =    0.0065
    Residual |  83.1753707        52  1.59952636   R-squared       =    0.1763
-------------+----------------------------------   Adj R-squared   =    0.1446
       Total |  100.981187        54  1.87002198   Root MSE        =    1.2647

------------------------------------------------------------------------------
        D.i3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         inf |
         D1. |   .1494892   .0921555     1.62   0.111    -.0354343    .3344127
             |
         def |
         D1. |  -.1813151   .1476825    -1.23   0.225    -.4776618    .1150315
             |
       _cons |   .0417738   .1713874     0.24   0.808    -.3021401    .3856877
------------------------------------------------------------------------------


Durbin-Watson d-statistic(  3,    55) =  1.796365

Critical values \(d(3,56)=1.796\), at the 5% level \(dL = 1.452, dU=1.681\) \(dwstat > dU\) so we fail to reject the null hypothesis

predict u, resid
reg u l.u, noconst
(1 missing value generated)

      Source |       SS           df       MS      Number of obs   =        54
-------------+----------------------------------   F(1, 53)        =      0.29
       Model |  .427058269         1  .427058269   Prob > F        =    0.5921
    Residual |  77.8807184        53  1.46944752   R-squared       =    0.0055
-------------+----------------------------------   Adj R-squared   =   -0.0133
       Total |  78.3077766        54  1.45014401   Root MSE        =    1.2122

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |   .0717246    .133046     0.54   0.592    -.1951318    .3385811
------------------------------------------------------------------------------

The serial correlation is no longer a problem with our first difference model, since first differencing can transform a unit root process \(I(1)\) into a \(I(0)\) process.

4.4 Serial Correlation Robust Standard Errors

Lesson: We can use the Newey estimator for estimates with Heteroskedastic and Autocorrelation Consistent (HAC) standard errors.

We’ll revisit our Puerto Rican examination of the impact of minimum wage importance We’ll use Heteroskedastic and Autocorrelation Consistent (HAC) standard errors, and we’ll compare OLS, OLS with HAC standard errors, and Prais-Winsten estimates We’ll allow a maximum lag order of autocorrelation up to 2 with the lag(2) option.

Set Time Series

cd "/Users/Sam/Desktop/Econ 645/Data/Wooldridge"
use prminwge.dta, clear
tsset year, yearly
/Users/Sam/Desktop/Econ 645/Data/Wooldridge

        time variable:  year, 1950 to 1987
                delta:  1 year

OLS

est clear
eststo OLS: quietly reg lprepop lmincov lprgnp lusgnp t if year < 1988

Newey-West Estimator Order of 1

Newey with lag order 1

eststo Newey1: quietly newey lprepop lmincov lprgnp lusgnp t if year < 1988, lag(1)

Newey-West Estimator Order of 2

eststo Newey2: quietly newey lprepop lmincov lprgnp lusgnp t if year < 1988, lag(2)

Prais-Winsten

eststo PW: quietly prais lprepop lmincov lprgnp lusgnp t if year < 1988

With t-stats below estimated parameters

esttab, mtitle scalars(F N)
                      (1)             (2)             (3)             (4)   
                      OLS          Newey1          Newey2              PW   
----------------------------------------------------------------------------
lmincov            -0.212***       -0.212***       -0.212***       -0.148** 
                  (-5.29)         (-4.67)         (-4.64)         (-3.22)   

lprgnp              0.285**         0.285**         0.285**         0.251*  
                   (3.54)          (2.85)          (2.86)          (2.16)   

lusgnp              0.486*          0.486           0.486           0.256   
                   (2.19)          (1.79)          (1.74)          (1.10)   

t                 -0.0267***      -0.0267***      -0.0267***      -0.0205** 
                  (-5.76)         (-4.86)         (-4.63)         (-3.50)   

_cons              -6.663***       -6.663***       -6.663***       -4.653** 
                  (-5.30)         (-4.52)         (-4.34)         (-3.38)   
----------------------------------------------------------------------------
N                      38              38              38              38   
F                   66.23           40.98           37.84           24.87   
----------------------------------------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

With standard errors below the estimated parameters

esttab, mtitle se scalars(F N)
                      (1)             (2)             (3)             (4)   
                      OLS          Newey1          Newey2              PW   
----------------------------------------------------------------------------
lmincov            -0.212***       -0.212***       -0.212***       -0.148** 
                 (0.0402)        (0.0455)        (0.0457)        (0.0458)   

lprgnp              0.285**         0.285**         0.285**         0.251*  
                 (0.0805)         (0.100)        (0.0996)         (0.116)   

lusgnp              0.486*          0.486           0.486           0.256   
                  (0.222)         (0.272)         (0.279)         (0.232)   

t                 -0.0267***      -0.0267***      -0.0267***      -0.0205** 
                (0.00463)       (0.00549)       (0.00576)       (0.00586)   

_cons              -6.663***       -6.663***       -6.663***       -4.653** 
                  (1.258)         (1.475)         (1.536)         (1.376)   
----------------------------------------------------------------------------
N                      38              38              38              38   
F                   66.23           40.98           37.84           24.87   
----------------------------------------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

Notice how our t-stat have fallen and our standard errors have risen for our Newey1 and Newey2 compared to OLS. Also, notice how the Prais-Winsten beta-hat on minimum coverage is closer to 0, then OLS or OLS with HAC standard errors.

4.5 Testing for Heteroskedasticity in Time Series

We’ll revisit our test of the Efficient Market Hypothesis with stock return data. We can test to see if our assumption of homoskedasticity is valid with our time series. This is a separate test than the test for serial correlation.

Set the time series

cd "/Users/Sam/Desktop/Econ 645/Data/Wooldridge"
use nyse.dta, clear
tsset t, weekly
/Users/Sam/Desktop/Econ 645/Data/Wooldridge

        time variable:  t, 1960w2 to 1973w16
                delta:  1 week

OLS

We’ll test heteroskedasticity with estat hettest

reg return l.return
estat hettest
      Source |       SS           df       MS      Number of obs   =       689
-------------+----------------------------------   F(1, 687)       =      2.40
       Model |  10.6866231         1  10.6866231   Prob > F        =    0.1218
    Residual |  3059.73817       687  4.45376735   R-squared       =    0.0035
-------------+----------------------------------   Adj R-squared   =    0.0020
       Total |  3070.42479       688  4.46282673   Root MSE        =    2.1104

------------------------------------------------------------------------------
      return |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      return |
         L1. |   .0588984   .0380231     1.55   0.122    -.0157569    .1335538
             |
       _cons |    .179634   .0807419     2.22   0.026     .0211034    .3381646
------------------------------------------------------------------------------


Breusch-Pagan / Cook-Weisberg test for heteroskedasticity 
         Ho: Constant variance
         Variables: fitted values of return

         chi2(1)      =    95.22
         Prob > chi2  =   0.0000

We’ll manually calculate the Breusch-Pagan test

predict u, residu
gen u2=u^2
reg u2 l.return
(2 missing values generated)

(2 missing values generated)

      Source |       SS           df       MS      Number of obs   =       689
-------------+----------------------------------   F(1, 687)       =     30.05
       Model |  3755.56877         1  3755.56877   Prob > F        =    0.0000
    Residual |  85846.2961       687  124.958219   R-squared       =    0.0419
-------------+----------------------------------   Adj R-squared   =    0.0405
       Total |  89601.8649       688  130.235269   Root MSE        =    11.178

------------------------------------------------------------------------------
          u2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      return |
         L1. |  -1.104133   .2014029    -5.48   0.000    -1.499572   -.7086934
             |
       _cons |   4.656501   .4276789    10.89   0.000     3.816786    5.496216
------------------------------------------------------------------------------

Test for serial correlation

reg u l.u, noconst
      Source |       SS           df       MS      Number of obs   =       688
-------------+----------------------------------   F(1, 687)       =      0.00
       Model |   .00603936         1   .00603936   Prob > F        =    0.9706
    Residual |  3059.08227       687  4.45281262   R-squared       =    0.0000
-------------+----------------------------------   Adj R-squared   =   -0.0015
       Total |  3059.08831       688  4.44634929   Root MSE        =    2.1102

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |    .001405   .0381496     0.04   0.971    -.0734987    .0763087
------------------------------------------------------------------------------

We can see we reject the null hypothesis that the variance of the error term is constant, and heteroskedasticity is a problem.

Newey-West Estimator

We can use robust, or HAC standard errors, but since serial correlation is not a problem, then we don’t need newey estimator.

newey return l.return, lag(1)
Regression with Newey-West standard errors      Number of obs     =        689
maximum lag: 1                                  F(  1,       687) =       0.74
                                                Prob > F          =     0.3895

------------------------------------------------------------------------------
             |             Newey-West
      return |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      return |
         L1. |   .0588984   .0684001     0.86   0.389       -.0754    .1931968
             |
       _cons |    .179634   .0855634     2.10   0.036     .0116369    .3476311
------------------------------------------------------------------------------

Expected value does not depend on past returns, but the variance of the error term is not constant, and needs to be corrected.