Chapter 3 Testing for Serial Correlation

3.1 Example: Revisit Phillip’s Curve

Lesson: using our t-test, Durban Watson test, Breusch-Godfrey test, and Durban’s alternative statistic to test for serial correlation

We’ll use our t-test for serial correlation with strictly exogenous regressors under the assumption that our regressors are exogenous.

Set Time Series

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

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

We estimated a static Phillips Curve and an augmented Phillips Curve last week. We’ll retest the models for serial correlation.

Static Model

Test for serial correlation in Static Model Noticeable serial correlation

*Static Model
reg inf unem if year < 1997

*Heteroskedastiity Test: Breusch-Godfrey Test
estat bgodfrey

*Serial Correlation Test: Simple AR(1) test
predict u, resid

reg u l.u, noconst
      Source |       SS           df       MS      Number of obs   =        49
-------------+----------------------------------   F(1, 47)        =      2.62
       Model |  25.6369575         1  25.6369575   Prob > F        =    0.1125
    Residual |   460.61979        47  9.80042107   R-squared       =    0.0527
-------------+----------------------------------   Adj R-squared   =    0.0326
       Total |  486.256748        48  10.1303489   Root MSE        =    3.1306

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        unem |   .4676257   .2891262     1.62   0.112    -.1140213    1.049273
       _cons |    1.42361   1.719015     0.83   0.412    -2.034602    4.881822
------------------------------------------------------------------------------


Breusch-Godfrey LM test for autocorrelation
---------------------------------------------------------------------------
    lags(p)  |          chi2               df                 Prob > chi2
-------------+-------------------------------------------------------------
       1     |         18.472               1                   0.0000
---------------------------------------------------------------------------
                        H0: no serial correlation

      Source |       SS           df       MS      Number of obs   =        55
-------------+----------------------------------   F(1, 54)        =     29.61
       Model |  161.010846         1  161.010846   Prob > F        =    0.0000
    Residual |  293.652171        54  5.43800317   R-squared       =    0.3541
-------------+----------------------------------   Adj R-squared   =    0.3422
       Total |  454.663017        55  8.26660031   Root MSE        =     2.332

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |   .5822453   .1070035     5.44   0.000     .3677161    .7967745
------------------------------------------------------------------------------

First difference

Test for serial correlation in Augmented Serial correlation is removed with the first-difference in inflation

*First Difference Model
reg d.inf unem if year < 1997
predict u2, resid
*Breusch-Godfrey Test
    estat bgodfrey
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(1, 46)        =      5.56
       Model |  33.3829996         1  33.3829996   Prob > F        =    0.0227
    Residual |  276.305138        46  6.00663344   R-squared       =    0.1078
-------------+----------------------------------   Adj R-squared   =    0.0884
       Total |  309.688138        47  6.58910932   Root MSE        =    2.4508

------------------------------------------------------------------------------
       D.inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        unem |  -.5425869   .2301559    -2.36   0.023    -1.005867    -.079307
       _cons |   3.030581    1.37681     2.20   0.033      .259206    5.801955
------------------------------------------------------------------------------

(1 missing value generated)


Breusch-Godfrey LM test for autocorrelation
---------------------------------------------------------------------------
    lags(p)  |          chi2               df                 Prob > chi2
-------------+-------------------------------------------------------------
       1     |          0.062               1                   0.8039
---------------------------------------------------------------------------
                        H0: no serial correlation

Test for Serial Correlation: Durban-Watson Test

    estat dwatson
Durbin-Watson d-statistic(  2,    48) =  1.769648

\[ d_L = 1.503 \] \[ d_U = 1.585 \] \[ 1.769648 > 1.585 \] We fail to reject the null hypothesis.

Test for Serial Correlation: AR(1) Test

    reg u2 l.u2, noconst
      Source |       SS           df       MS      Number of obs   =        54
-------------+----------------------------------   F(1, 53)        =      0.07
       Model |  .267251656         1  .267251656   Prob > F        =    0.7905
    Residual |  198.724905        53  3.74952651   R-squared       =    0.0013
-------------+----------------------------------   Adj R-squared   =   -0.0175
       Total |  198.992157        54  3.68503994   Root MSE        =    1.9364

------------------------------------------------------------------------------
          u2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          u2 |
         L1. |  -.0308131   .1154154    -0.27   0.791     -.262307    .2006808
------------------------------------------------------------------------------

Test change in error terms for FD assumption on serial correlation so that the differences in errors are not correlated.

gen u2_1=l.u2
reg d.u2 d.u2_1, noconst
drop u2
(2 missing values generated)

      Source |       SS           df       MS      Number of obs   =        53
-------------+----------------------------------   F(1, 52)        =      2.01
       Model |  13.6239993         1  13.6239993   Prob > F        =    0.1623
    Residual |  352.532902        52  6.77947888   R-squared       =    0.0372
-------------+----------------------------------   Adj R-squared   =    0.0187
       Total |  366.156901        53  6.90862078   Root MSE        =    2.6037

------------------------------------------------------------------------------
        D.u2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        u2_1 |
         D1. |  -.1661051   .1171734    -1.42   0.162    -.4012307    .0690204
------------------------------------------------------------------------------

We fail to reject the null hypothesis that there is no serial correlation in the difference in error term.

FDL Model

Let’s add a lag in inflation to change our static model into a FDL model. We can also use the estat dwatson or dwstat

reg inf l.inf unem if year < 1997
estat dwatson
*Or
dwstat
      Source |       SS           df       MS      Number of obs   =        48
-------------+----------------------------------   F(2, 45)        =     19.72
       Model |  219.518187         2  109.759094   Prob > F        =    0.0000
    Residual |  250.471823        45  5.56604051   R-squared       =    0.4671
-------------+----------------------------------   Adj R-squared   =    0.4434
       Total |   469.99001        47  9.99978744   Root MSE        =    2.3592

------------------------------------------------------------------------------
         inf |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         inf |
         L1. |   .7278693   .1263167     5.76   0.000     .4734544    .9822841
             |
        unem |  -.2443814     .26124    -0.94   0.355    -.7705457    .2817829
       _cons |    2.43082   1.354276     1.79   0.079    -.2968325    5.158473
------------------------------------------------------------------------------


Durbin-Watson d-statistic(  3,    48) =  1.477467


Durbin-Watson d-statistic(  3,    48) =  1.477467

First, let’s find our critical values:
https://www3.nd.edu/~wevans1/econ30331/Durbin_Watson_tables.pdf.
\[ DW(3,48)=1.48 \] and \[ d_L \approx 1.4 \] and \[ d_U \approx 1.67 \] so our DW test is inconclusive. We’ll look at Durban-Watson and DW Tables again a bit later.

3.2 Example: Revisit Puerto Rican Employment and Minimum Wage

Lesson: We can use Durban’s alternative statistic to test for serial correlation if our regressors are not strictly exogenous.

Durban’s alternative statistic

Set Time Series

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

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

We’ll rerun our static model and regress the natural log of the employment-population ratio onto the natural log of the importance of minimum wage, the natural log of Puerto Rican Gross National Product, the natural log of US GNP, and a time trend.

Durbin-Watson Test

reg lprepop lmincov lprgnp lusgnp t if year < 1988
predict u, resid
      Source |       SS           df       MS      Number of obs   =        38
-------------+----------------------------------   F(4, 33)        =     66.23
       Model |  .284430187         4  .071107547   Prob > F        =    0.0000
    Residual |  .035428331        33  .001073586   R-squared       =    0.8892
-------------+----------------------------------   Adj R-squared   =    0.8758
       Total |  .319858518        37  .008644825   Root MSE        =    .03277

------------------------------------------------------------------------------
     lprepop |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     lmincov |  -.2122612   .0401524    -5.29   0.000    -.2939518   -.1305706
      lprgnp |   .2852386   .0804922     3.54   0.001      .121476    .4490012
      lusgnp |   .4860463   .2219829     2.19   0.036     .0344188    .9376739
           t |  -.0266633   .0046267    -5.76   0.000    -.0360765   -.0172502
       _cons |  -6.663432   1.257831    -5.30   0.000    -9.222508   -4.104356
------------------------------------------------------------------------------

Durbin’s Alternative Statistics

Test Serial Correlation with Durbin’s alternative statistic, which is valid when we don’t have strictly exogenous regressors.

reg u l.u lmincov lprgnp lusgnp t, noconst 
      Source |       SS           df       MS      Number of obs   =        37
-------------+----------------------------------   F(5, 32)        =      1.92
       Model |  .007182064         5  .001436413   Prob > F        =    0.1191
    Residual |  .023990478        32  .000749702   R-squared       =    0.2304
-------------+----------------------------------   Adj R-squared   =    0.1101
       Total |  .031172542        37  .000842501   Root MSE        =    .02738

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |   .4757945   .1653074     2.88   0.007     .1390742    .8125147
             |
     lmincov |    .041425   .0346345     1.20   0.240    -.0291232    .1119732
      lprgnp |  -.0522061   .0615544    -0.85   0.403    -.1775883    .0731762
      lusgnp |   .0606233   .0644769     0.94   0.354     -.070712    .1919585
           t |  -.0005264   .0015194    -0.35   0.731    -.0036213    .0025685
------------------------------------------------------------------------------

We can see that we reject the null hypothesis, since our \(\hat{rho} = 0.48\) and statistically significant.

3.3 Test AR(3) serial correlation

Lesson: We can test for serial correlation among prior periods beside AR(1).

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

We’ll look at our barium chloride model again to see if ITC complaints affect behavior of foreign exporters. We may have higher order of serial correlation since we are using monthly data.

reg lchnimp lchempi lgas lrtwex befile6 affile6 afdec6
predict u, resid
      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
------------------------------------------------------------------------------

Test for \(H_{0}: p1=p2=p3=0\) jointly with an F-test.

reg u l.u l2.u l3.u lchempi lgas lrtwex befile6 affile6 afdec6, noconst
test l.u l2.u l3.u
      Source |       SS           df       MS      Number of obs   =       128
-------------+----------------------------------   F(9, 119)       =      1.67
       Model |   4.8836741         9  .542630456   Prob > F        =    0.1024
    Residual |  38.5511192       119  .323958985   R-squared       =    0.1124
-------------+----------------------------------   Adj R-squared   =    0.0453
       Total |  43.4347933       128  .339334323   Root MSE        =    .56917

------------------------------------------------------------------------------
           u |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           u |
         L1. |    .215573   .0910635     2.37   0.020     .0352581    .3958878
         L2. |   .1296804   .0917465     1.41   0.160    -.0519868    .3113477
         L3. |   .1209405   .0906816     1.33   0.185    -.0586181    .3004992
             |
     lchempi |   -.105758   .4679356    -0.23   0.822    -1.032317    .8208012
        lgas |   .0125667   .1187882     0.11   0.916    -.2226459    .2477792
      lrtwex |   .0518992   .3452261     0.15   0.881     -.631683    .7354815
     befile6 |  -.0730016    .249775    -0.29   0.771     -.567581    .4215779
     affile6 |   -.122359   .2541453    -0.48   0.631    -.6255919     .380874
      afdec6 |  -.0694522   .2737453    -0.25   0.800    -.6114953    .4725909
------------------------------------------------------------------------------


 ( 1)  L.u = 0
 ( 2)  L2.u = 0
 ( 3)  L3.u = 0

       F(  3,   119) =    4.98
            Prob > F =    0.0027

Our reject the null hypothesis that all of the lags are equal to zero using an F-test.

However, when we test our last two lags, they are jointly insignificant.

test l2.u l3.u
drop u
 ( 1)  L2.u = 0
 ( 2)  L3.u = 0

       F(  2,   119) =    2.42
            Prob > F =    0.0930

We have evidence of at least serial correlation to the order of one.