Time Series Analysis of Blaisdell Company Data
---------------------------------------------------------------------------------------------
       log:  D:\s209\m14blais.log
  log type:  text
 opened on:  24 Apr 2006, 12:02:33

. do "C:\DOCUME~1\nielsen\LOCALS~1\Temp\STD04000000.tmp"

. use "Z:\mydocs\s209\blaisco.dta", clear

. * y is company sales, x is industry sales (mil $)
. * do regular regression
. regress y x

      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  1,    18) =14888.15
       Model |  110.256901     1  110.256901           Prob > F      =  0.0000
    Residual |  .133302302    18  .007405683           R-squared     =  0.9988
-------------+------------------------------           Adj R-squared =  0.9987
       Total |  110.390204    19  5.81001072           Root MSE      =  .08606

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1762828   .0014447   122.02   0.000     .1732475    .1793181
       _cons |  -1.454753   .2141461    -6.79   0.000    -1.904657   -1.004849
------------------------------------------------------------------------------

. * next tsset data set to make it time series
. * qtr is quarter
. generate qtr=_n

. tsset qtr
        time variable:  qtr, 1 to 20

. * next regression with DW test
. regress y x

      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  1,    18) =14888.15
       Model |  110.256901     1  110.256901           Prob > F      =  0.0000
    Residual |  .133302302    18  .007405683           R-squared     =  0.9988
-------------+------------------------------           Adj R-squared =  0.9987
       Total |  110.390204    19  5.81001072           Root MSE      =  .08606

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1762828   .0014447   122.02   0.000     .1732475    .1793181
       _cons |  -1.454753   .2141461    -6.79   0.000    -1.904657   -1.004849
------------------------------------------------------------------------------

. estat dwatson

Durbin-Watson d-statistic(  2,    20) =  .7347276

. * next do Wald-Wolfowitz runs test (first with
. * threshold = median, then with threshold=0)
. predict e, resid

. graph twoway line e qtr, yline(0)

. runtest e
 N(e <= -.0004533920437098) = 10
 N(e >  -.0004533920437098) = 10
       obs = 20
   N(runs) = 5
        z  = -2.76
  Prob>|z| = .01

. runtest e, threshold(0)
 N(e <= 0) = 10
 N(e >  0) = 10
       obs = 20
   N(runs) = 5
        z  = -2.76
  Prob>|z| = .01

. * makes no diff here
. * next do Cochrane-Orcutt regression (no iteration)
. prais y x, corc twostep

Iteration 0:  rho = 0.0000
Iteration 1:  rho = 0.6312

Cochrane-Orcutt AR(1) regression -- twostep estimates

      Source |       SS       df       MS              Number of obs =      19
-------------+------------------------------           F(  1,    17) = 3453.63
       Model |  15.5749186     1  15.5749186           Prob > F      =  0.0000
    Residual |  .076665287    17  .004509723           R-squared     =  0.9951
-------------+------------------------------           Adj R-squared =  0.9948
       Total |  15.6515839    18  .869532438           Root MSE      =  .06715

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1737583   .0029567    58.77   0.000     .1675202    .1799964
       _cons |  -1.068526   .4533976    -2.36   0.031    -2.025112   -.1119411
-------------+----------------------------------------------------------------
         rho |   .6311623
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    0.734728
Durbin-Watson statistic (transformed) 1.650247

. prais y x, rhotype(tscorr) twostep

Iteration 0:  rho = 0.0000
Iteration 1:  rho = 0.6260

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

      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  1,    18) =13684.91
       Model |  60.2240453     1  60.2240453           Prob > F      =  0.0000
    Residual |   .07921376    18  .004400764           R-squared     =  0.9987
-------------+------------------------------           Adj R-squared =  0.9986
       Total |  60.3032591    19  3.17385574           Root MSE      =  .06634

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1751424   .0022827    76.72   0.000     .1703465    .1799382
       _cons |  -1.290318   .3395938    -3.80   0.001    -2.003778   -.5768581
-------------+----------------------------------------------------------------
         rho |   .6260036
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    0.734728
Durbin-Watson statistic (transformed) 1.675555

. * next, what I think is equivalent to Hildreth-Lu method of searching for regression estima
> tes 
. * and value of rho that jointly minimize SSE
. prais y x, ssesearch

Iteration 1:  rho = 0.8944 , criterion =  -.08340677
Iteration 2:  rho = 0.6525 , criterion =  -.07905246
Iteration 3:  rho = 0.6525 , criterion =  -.07905246
Iteration 4:  rho = 0.6525 , criterion =  -.07905246
Iteration 5:  rho = 0.6708 , criterion =  -.07902978
Iteration 6:  rho = 0.6677 , criterion =  -.07902861
Iteration 7:  rho = 0.6677 , criterion =  -.07902861
Iteration 8:  rho = 0.6677 , criterion =  -.07902861
Iteration 9:  rho = 0.6677 , criterion =  -.07902861
Iteration 10:  rho = 0.6677 , criterion =  -.07902861
Iteration 11:  rho = 0.6677 , criterion =  -.07902861
Iteration 12:  rho = 0.6677 , criterion =  -.07902861
Iteration 13:  rho = 0.6677 , criterion =  -.07902861
Iteration 14:  rho = 0.6677 , criterion =  -.07902861
Iteration 15:  rho = 0.6677 , criterion =  -.07902861

Prais-Winsten AR(1) regression -- SSE search estimates

      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  1,    18) =13899.09
       Model |  61.0236379     1  61.0236379           Prob > F      =  0.0000
    Residual |  .079028607    18  .004390478           R-squared     =  0.9987
-------------+------------------------------           Adj R-squared =  0.9986
       Total |  61.1026665    19  3.21592981           Root MSE      =  .06626

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1748963   .0024432    71.58   0.000     .1697633    .1800293
       _cons |  -1.254568   .3637293    -3.45   0.003    -2.018735   -.4904015
-------------+----------------------------------------------------------------
         rho |   .6677295
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    0.734728
Durbin-Watson statistic (transformed) 1.728405

. * these results are different from ALSM4e and 5e
. * try default prais
. prais y x

Iteration 0:  rho = 0.0000
Iteration 1:  rho = 0.6312
Iteration 2:  rho = 0.6500
Iteration 3:  rho = 0.6528
Iteration 4:  rho = 0.6532
Iteration 5:  rho = 0.6533
Iteration 6:  rho = 0.6533
Iteration 7:  rho = 0.6533
Iteration 8:  rho = 0.6533

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

      Source |       SS       df       MS              Number of obs =      20
-------------+------------------------------           F(  1,    18) =13848.94
       Model |  60.8198448     1  60.8198448           Prob > F      =  0.0000
    Residual |  .079049867    18  .004391659           R-squared     =  0.9987
-------------+------------------------------           Adj R-squared =  0.9986
       Total |  60.8988947    19  3.20520498           Root MSE      =  .06627

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .1749874   .0023848    73.38   0.000     .1699773    .1799976
       _cons |  -1.267818   .3549307    -3.57   0.002      -2.0135   -.5221362
-------------+----------------------------------------------------------------
         rho |   .6532947
------------------------------------------------------------------------------
Durbin-Watson statistic (original)    0.734728
Durbin-Watson statistic (transformed) 1.711080

. * prais y x, corc not run because of non-convergence
. * note prais y x, corc gives results closest to ALSM4e and 5e
. * for Hildreth-Lu method, with rho=.9580877, b1=.1605672
. * next do first-differences regression
. * note D operator, no constant regression
. regress D.y D.x, nocon

      Source |       SS       df       MS              Number of obs =      19
-------------+------------------------------           F(  1,    18) = 1093.14
       Model |   5.2637264     1   5.2637264           Prob > F      =  0.0000
    Residual |  .086674155    18  .004815231           R-squared     =  0.9838
-------------+------------------------------           Adj R-squared =  0.9829
       Total |  5.35040055    19  .281600029           Root MSE      =  .06939

------------------------------------------------------------------------------
         D.y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |
         D1. |   .1684878    .005096    33.06   0.000     .1577814    .1791941
------------------------------------------------------------------------------

. * results identical with AMSM4e and 5e for first-differences
. 
end of do-file

. log close
       log:  D:\s209\m14blais.log
  log type:  text
 closed on:  24 Apr 2006, 12:03:47
---------------------------------------------------------------------------------------------

Last modified 24 Apr 2006