-------------------------------------------------------------------------------------------------------------
       log:  /Users/pabsta/Documents/2-Enseignement/ECON452/tutorial3/OUTPUT/analysis.log
  log type:  text
 opened on:   3 Feb 2012, 12:49:07

. use "http://www.pabsta.qc.ca/sites/default/files/threeSeries.dta"

. 
. tset t
        time variable:  t, 1 to 251
                delta:  1 unit

. 
. /*
> Basics of the Box-Jenkins methodology: 
> 1- Is the process stationary? If no -->Êwe don't know what to do yet. 
>         If yes ->Êproceed to find candidates "p & q" for an ARMA(p,q) representation.
> 2- Analysis of PAC, AC graphs to find upper bounds to p & q. Look for particuliar patterns
> 3- Proceed to ARIMA estimation and check if we can deduce the process through statistical test
> 4- Choose plausible models based on its ability to forecast and other factors. (not seen in class yet). 
> */
. 
. /* S1 is the process stationary? */
. tsline s1 if(t<100) // < 100 so we can see something

. 
. //Looks like it oscilates around a stable average -> indication of stationarity. 
. //Proceed to PAC, AC analysis: 
. ac s1

. 
. //Two things to deduce from this graph:
. /* First, only the second lag seems to be "spiking out" and is significantly different than zero. 
>         This is an indication that that there is probably an MA(2) component in the process. 
>    Second, there seems to be a pattern of oscillations in the lags (going up and down)
>         This is an indication that there might be an hidden AR process in there. 
> */
. pac s1

. /* Pretty much the same story here, but "inversed". There is a spike in the second lag, suggesting
>         an AR(2) component in the process. There also seem to be an oscillation pattern, which might hide a
> n MA process. 
>         
>         HENCE, we should start our broad estimation with and ARMA(2,2) process. 
> */
. 
. //Same thing as both previous graphs, but with an onscreen output. 
. corrgram s1

                                          -1       0       1 -1       0       1
 LAG       AC       PAC      Q     Prob>Q  [Autocorrelation]  [Partial Autocor]
-------------------------------------------------------------------------------
1       -0.0313  -0.0313   .24827  0.6183          |                  |        
2        0.2689   0.2689   18.695  0.0001          |--                |--      
3       -0.0256  -0.0113   18.863  0.0003          |                  |        
4        0.0995   0.0238    21.41  0.0003          |                  |        
5       -0.0492  -0.0357   22.036  0.0005          |                  |        
6        0.0085  -0.0263   22.054  0.0012          |                  |        
7       -0.0824  -0.0639   23.823  0.0012          |                  |        
8       -0.0335  -0.0357   24.116  0.0022          |                  |        
9       -0.0029   0.0418   24.119  0.0041          |                  |        
10      -0.0385  -0.0218   24.509  0.0064          |                  |        
11       0.0569   0.0571   25.366  0.0081          |                  |        
12       0.0154   0.0380   25.429  0.0129          |                  |        
13      -0.0064  -0.0501    25.44  0.0202          |                  |        
14      -0.0209  -0.0439   25.557  0.0294          |                  |        
15      -0.0449  -0.0581   26.101  0.0370          |                  |        
16      -0.0606  -0.0603   27.094  0.0405          |                  |        
17      -0.0890  -0.0824   29.242  0.0324          |                  |        
18      -0.0697  -0.0428   30.568  0.0323          |                  |        
19      -0.0743  -0.0253   32.079  0.0306          |                  |        
20      -0.0012   0.0267    32.08  0.0425          |                  |        
21       0.0040   0.0471   32.084  0.0574          |                  |        
22       0.0727   0.0817   33.552  0.0545          |                  |        
23       0.1166   0.1212   37.336  0.0300          |                  |        
24       0.0194  -0.0206   37.442  0.0395          |                  |        
25       0.0997   0.0415   40.237  0.0276          |                  |        
26       0.0222   0.0157   40.376  0.0358          |                  |        
27       0.0541   0.0014   41.207  0.0393          |                  |        
28       0.0256   0.0377   41.394  0.0494          |                  |        
29      -0.0413  -0.0815   41.882  0.0575          |                  |        
30       0.0907   0.1093   44.247  0.0453          |                  |        
31      -0.0464  -0.0396   44.868  0.0512          |                  |        
32       0.0467  -0.0128   45.499  0.0575          |                  |        
33      -0.0710  -0.0715   46.967  0.0545          |                  |        
34      -0.0028  -0.0748    46.97  0.0685          |                  |        
35      -0.0380  -0.0085   47.394  0.0788          |                  |        
36      -0.0263  -0.0349   47.599  0.0935          |                  |        
37      -0.0625  -0.0431   48.757  0.0935          |                  |        
38      -0.0711  -0.0551   50.264  0.0879          |                  |        
39       0.0091   0.0750   50.289  0.1063          |                  |        
40      -0.0887  -0.0240   52.659  0.0867          |                  |        

. 
. //First estimation of an ARMA(2,2) model: 
. /*
> The command below asks stata "perform a maximum likelihood estimation on the following model:
> 
> s1 = cons + a1 L.s1 + a2 L2.s1 + err + b1 L.err + b2 L2.err
> 
> and give us the estimates" 
> */
. arima s1, ar(1,2) ma(1,2)

(setting optimization to BHHH)
Iteration 0:   log likelihood = -356.30611  
Iteration 1:   log likelihood = -354.27742  
Iteration 2:   log likelihood = -354.06593  
Iteration 3:   log likelihood = -354.04218  
Iteration 4:   log likelihood = -354.03837  
(switching optimization to BFGS)
Iteration 5:   log likelihood = -354.03744  
Iteration 6:   log likelihood = -354.03703  
Iteration 7:   log likelihood = -354.03703  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(4)       =     25.40
Log likelihood =  -354.037                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s1           |
       _cons |   20.20444   .0848579   238.10   0.000     20.03812    20.37076
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L1. |  -.0756083   .2145822    -0.35   0.725    -.4961817     .344965
         L2. |    .348233   .2264562     1.54   0.124    -.0956129     .792079
          ma |
         L1. |   .0579677   .2207284     0.26   0.793     -.374652    .4905873
         L2. |  -.0850186   .2457602    -0.35   0.729    -.5666997    .3966624
-------------+----------------------------------------------------------------
      /sigma |   .9912897   .0440894    22.48   0.000     .9048761    1.077703
------------------------------------------------------------------------------

. /*
> None of the coefficients are independently significant (zero belongs to the confidence interval everywhere)
> , 
> but if we look at the F test of the joint restriction that they are all equal to zero (F test in the upper 
> right corner), 
> we see that the p-value is close to zero, which indicates that some variables are somehow significant. 
> 
> Lets test if the MA component is jointly insignificant: 
> */
. test ([ARMA]L.ma = 0) ([ARMA]L2.ma = 0)

 ( 1)  [ARMA]L.ma = 0
 ( 2)  [ARMA]L2.ma = 0

           chi2(  2) =    0.22
         Prob > chi2 =    0.8967

. /*
> The p-value of this test is 0.89, so we cannot reject the null hypothesis that both coefficients are equal 
> to zero. 
> 
> Before we proceed to estimate the process without an MA component, lets test that the AR component is joint
> ly equal to zero.
> */
. test ([ARMA]L.ar = 0) ([ARMA]L2.ar = 0)

 ( 1)  [ARMA]L.ar = 0
 ( 2)  [ARMA]L2.ar = 0

           chi2(  2) =    2.85
         Prob > chi2 =    0.2401

. /*
> p-value of 0.24 (higher than 5%) so we also keep h0. 
> 
> The two tests contradict themselves somehow. One suggest that we should drop the AR component while the oth
> er says we should
> drop the MA component. We should proceed with additional tests before going further.
> */
. 
. test ([ARMA]L.ar = 0) ([ARMA]L.ma = 0) //Test if the process is solely an AR(2), MA(2)

 ( 1)  [ARMA]L.ar = 0
 ( 2)  [ARMA]L.ma = 0

           chi2(  2) =    0.19
         Prob > chi2 =    0.9074

. test ([ARMA]L.ar = 0) ([ARMA]L.ma = 0) ([ARMA]L2.ma = 0) //Test if the process is solely an AR(2)

 ( 1)  [ARMA]L.ar = 0
 ( 2)  [ARMA]L.ma = 0
 ( 3)  [ARMA]L2.ma = 0

           chi2(  3) =    0.39
         Prob > chi2 =    0.9419

. test ([ARMA]L.ar = 0) ([ARMA]L.ma = 0) ([ARMA]L2.ar = 0) //Test if the process is solely an MA(2)

 ( 1)  [ARMA]L.ar = 0
 ( 2)  [ARMA]L.ma = 0
 ( 3)  [ARMA]L2.ar = 0

           chi2(  3) =    3.00
         Prob > chi2 =    0.3919

. 
. /*
> These tests suggest that we have might have either an ar(2) process or an ma(2) process. 
> */
. 
. //This model is a candidate solution to the process at hand. 
. arima s1, ar(2) 

(setting optimization to BHHH)
Iteration 0:   log likelihood = -354.22133  
Iteration 1:   log likelihood = -354.21179  
Iteration 2:   log likelihood = -354.21174  
Iteration 3:   log likelihood = -354.21174  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(1)       =     23.18
Log likelihood = -354.2117                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s1           |
       _cons |   20.20459   .0855724   236.11   0.000     20.03687     20.3723
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L2. |   .2725027   .0566023     4.81   0.000     .1615641    .3834412
-------------+----------------------------------------------------------------
      /sigma |   .9919883   .0431874    22.97   0.000     .9073424    1.076634
------------------------------------------------------------------------------

. 
. //Here a new variable res1_1 is built
. predict res1_1, r 

. //The variable contains the residuals (estimated error terms) 
. //This is a statistical test to see of the residuals are somehow a white noise (we have not seen this test 
> yet)
. wntestq res1_1

Portmanteau test for white noise
---------------------------------------
 Portmanteau (Q) statistic =    22.0573
 Prob > chi2(40)           =     0.9905

. /*High p-value: indication that we should keep h0*/
. //This model is also a candidate solution to the process at hand. 
. arima s1, ma(2) 

(setting optimization to BHHH)
Iteration 0:   log likelihood = -355.55437  
Iteration 1:   log likelihood =  -355.2815  
Iteration 2:   log likelihood = -355.27871  
Iteration 3:   log likelihood = -355.27866  
Iteration 4:   log likelihood = -355.27866  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(1)       =     16.30
Log likelihood = -355.2787                      Prob > chi2        =    0.0001

------------------------------------------------------------------------------
             |                 OPG
          s1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s1           |
       _cons |   20.20281    .078254   258.17   0.000     20.04943    20.35618
-------------+----------------------------------------------------------------
ARMA         |
          ma |
         L2. |   .2451739   .0607324     4.04   0.000     .1261407    .3642071
-------------+----------------------------------------------------------------
      /sigma |   .9962722   .0429808    23.18   0.000     .9120314    1.080513
------------------------------------------------------------------------------

. predict res1_2, r

. wntestq res1_1

Portmanteau test for white noise
---------------------------------------
 Portmanteau (Q) statistic =    22.0573
 Prob > chi2(40)           =     0.9905

. 
. /*
> We still have to pick one of the two models we have found so far. We do not know yet how to do this, but if
>  a model
> is better at forecasting, this should be taken as an indication that the process is somehow "better. 
> 
> To do this, we check the variance of the residuals. If the variance is higher, the forecasting error are gr
> eater and thus, 
> the model is less performant. 
> */
. sum res1_1 res1_2

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
      res1_1 |       251   -.0018225    .9947077  -2.952494   2.925214
      res1_2 |       251   -.0011087    .9988701  -2.919931   2.963723

. /* The first model has a slightly smaller variance so perhaps we should keep it.*/
. 
. 
. //Second series
. tsline s2 if(t<100)

. ac s2

. pac s2

. corrgram s2

                                          -1       0       1 -1       0       1
 LAG       AC       PAC      Q     Prob>Q  [Autocorrelation]  [Partial Autocor]
-------------------------------------------------------------------------------
1        0.5965   0.5966   90.386  0.0000          |----              |----    
2        0.0060  -0.5457   90.395  0.0000          |              ----|        
3       -0.3173   0.0012   116.18  0.0000        --|                  |        
4       -0.3172  -0.0522   142.04  0.0000        --|                  |        
5       -0.1747  -0.0770   149.92  0.0000         -|                  |        
6        0.0038   0.0677   149.92  0.0000          |                  |        
7        0.1450   0.0509    155.4  0.0000          |-                 |        
8        0.1087  -0.1538   158.49  0.0000          |                 -|        
9        0.0127   0.0895   158.53  0.0000          |                  |        
10      -0.0520  -0.0379   159.24  0.0000          |                  |        
11      -0.0724  -0.0459   160.63  0.0000          |                  |        
12      -0.0840  -0.0366    162.5  0.0000          |                  |        
13      -0.0859  -0.0532   164.47  0.0000          |                  |        
14      -0.0724  -0.0747   165.88  0.0000          |                  |        
15      -0.0611  -0.0369   166.88  0.0000          |                  |        
16      -0.0076   0.0461    166.9  0.0000          |                  |        
17       0.0626  -0.0069   167.96  0.0000          |                  |        
18       0.0703  -0.0550   169.31  0.0000          |                  |        
19      -0.0004  -0.0354   169.31  0.0000          |                  |        
20      -0.0729  -0.0315   170.77  0.0000          |                  |        
21      -0.0816  -0.0081   172.61  0.0000          |                  |        
22      -0.0679  -0.0656   173.89  0.0000          |                  |        
23      -0.0434  -0.0350   174.41  0.0000          |                  |        
24       0.0180   0.0369    174.5  0.0000          |                  |        
25       0.0362  -0.1094   174.87  0.0000          |                  |        
26       0.0568   0.1266   175.78  0.0000          |                  |-       
27       0.1249   0.1320   180.21  0.0000          |                  |-       
28       0.1830   0.0363   189.74  0.0000          |-                 |        
29       0.1134  -0.0254   193.42  0.0000          |                  |        
30      -0.0148   0.0661   193.48  0.0000          |                  |        
31      -0.0671   0.0381   194.78  0.0000          |                  |        
32      -0.0649  -0.0014      196  0.0000          |                  |        
33      -0.0500  -0.0029   196.73  0.0000          |                  |        
34      -0.0125   0.0070   196.78  0.0000          |                  |        
35       0.0561   0.0484   197.71  0.0000          |                  |        
36       0.0634  -0.0054   198.89  0.0000          |                  |        
37      -0.0085  -0.0472   198.91  0.0000          |                  |        
38      -0.0707   0.0017   200.41  0.0000          |                  |        
39      -0.1070  -0.0762   203.84  0.0000          |                  |        
40      -0.1336  -0.0876   209.21  0.0000         -|                  |        

. 
. /*
> The PAC command reveals a clear and bright picture. Both the first lag and the second lag spikes out while 
> the 
> remaining lags seems to be non-significant withouth any distinguishable pattern. This is an indication that
>  the 
> process at hand is an AR(2) with both lags (first and second) being important. 
> 
> On the other hand, the AC command suggest that the AR model dominates since there are clear patterns of osc
> illation.
> Nonetheless, we will keep up to four lags in our first estimation, simply to encompass the whole possibilit
> ies.
> 
> Both have exponential decay, so they also suggest stationarity. 
> */
. arima s2, ar(1,2) ma(1,2, 3, 4)

(setting optimization to BHHH)
Iteration 0:   log likelihood = -362.35339  
Iteration 1:   log likelihood =  -361.6368  
Iteration 2:   log likelihood = -361.54328  
Iteration 3:   log likelihood = -361.40068  
Iteration 4:   log likelihood =  -361.3617  
(switching optimization to BFGS)
Iteration 5:   log likelihood = -361.29259  
Iteration 6:   log likelihood = -361.17544  
Iteration 7:   log likelihood = -361.09042  
Iteration 8:   log likelihood = -361.07164  
Iteration 9:   log likelihood = -361.06925  
Iteration 10:  log likelihood = -361.06908  
Iteration 11:  log likelihood = -361.06902  
Iteration 12:  log likelihood = -361.06901  
Iteration 13:  log likelihood = -361.06901  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(6)       =    362.95
Log likelihood =  -361.069                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s2           |
       _cons |  -10.06652   .1049567   -95.91   0.000    -10.27223    -9.86081
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L1. |   1.158292   .2169143     5.34   0.000     .7331478    1.583436
         L2. |  -.6251838   .1733191    -3.61   0.000    -.9648831   -.2854846
          ma |
         L1. |  -.2391491    .234635    -1.02   0.308    -.6990253    .2207272
         L2. |  -.1339535   .1403526    -0.95   0.340    -.4090396    .1411325
         L3. |  -.0567033   .1358303    -0.42   0.676    -.3229258    .2095192
         L4. |   .1651303   .1310021     1.26   0.207    -.0916292    .4218897
-------------+----------------------------------------------------------------
      /sigma |   1.017297   .0492341    20.66   0.000     .9208002    1.113794
------------------------------------------------------------------------------

. test ([ARMA]L3.ma = 0) ([ARMA]L2.ma = 0)

 ( 1)  [ARMA]L3.ma = 0
 ( 2)  [ARMA]L2.ma = 0

           chi2(  2) =    0.95
         Prob > chi2 =    0.6216

. arima s2, ar(1,2) ma(1, 4)

(setting optimization to BHHH)
Iteration 0:   log likelihood = -362.40997  
Iteration 1:   log likelihood = -361.76211  
Iteration 2:   log likelihood =  -361.6814  
Iteration 3:   log likelihood = -361.67435  
Iteration 4:   log likelihood =  -361.6737  
(switching optimization to BFGS)
Iteration 5:   log likelihood = -361.67365  
Iteration 6:   log likelihood = -361.67364  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(4)       =    389.38
Log likelihood = -361.6736                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s2           |
       _cons |  -10.06621   .1137148   -88.52   0.000    -10.28909   -9.843335
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L1. |   1.103689   .1393275     7.92   0.000     .8306123    1.376766
         L2. |  -.6713611   .0964976    -6.96   0.000    -.8604929   -.4822292
          ma |
         L1. |  -.1814701   .1612964    -1.13   0.261    -.4976054    .1346651
         L4. |    .161433   .1054755     1.53   0.126    -.0452951    .3681611
-------------+----------------------------------------------------------------
      /sigma |   1.019786   .0493092    20.68   0.000     .9231413     1.11643
------------------------------------------------------------------------------

. arima s2, ar(1,2) ma(1)

(setting optimization to BHHH)
Iteration 0:   log likelihood = -362.69039  
Iteration 1:   log likelihood = -362.66453  
Iteration 2:   log likelihood = -362.66356  
Iteration 3:   log likelihood = -362.66351  
Iteration 4:   log likelihood = -362.66351  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(3)       =    279.22
Log likelihood = -362.6635                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s2           |
       _cons |  -10.06682   .1069846   -94.10   0.000     -10.2765   -9.857132
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L1. |   .9168512   .0970015     9.45   0.000     .7267317    1.106971
         L2. |  -.5413305   .0722583    -7.49   0.000    -.6829542   -.3997069
          ma |
         L1. |   .0027421   .1150565     0.02   0.981    -.2227645    .2282488
-------------+----------------------------------------------------------------
      /sigma |   1.023979   .0492696    20.78   0.000     .9274126    1.120546
------------------------------------------------------------------------------

. arima s2, ar(1,2) //Most compact representation. 

(setting optimization to BHHH)
Iteration 0:   log likelihood = -362.67043  
Iteration 1:   log likelihood = -362.66389  
Iteration 2:   log likelihood = -362.66373  
Iteration 3:   log likelihood = -362.66373  

ARIMA regression

Sample:  1 - 251                                Number of obs      =       251
                                                Wald chi2(2)       =    279.79
Log likelihood = -362.6637                      Prob > chi2        =    0.0000

------------------------------------------------------------------------------
             |                 OPG
          s2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
s2           |
       _cons |  -10.06689    .106284   -94.72   0.000     -10.2752   -9.858578
-------------+----------------------------------------------------------------
ARMA         |
          ar |
         L1. |   .9187994   .0550185    16.70   0.000     .8109651    1.026634
         L2. |  -.5425169   .0558461    -9.71   0.000    -.6519732   -.4330607
-------------+----------------------------------------------------------------
      /sigma |   1.023938   .0489107    20.93   0.000     .9280751    1.119801
------------------------------------------------------------------------------

. 
. predict res2, r

. wntestq res2

Portmanteau test for white noise
---------------------------------------
 Portmanteau (Q) statistic =    43.2427
 Prob > chi2(40)           =     0.3346

. 
. //Third series
. tsline s3 if(t <100)

. /*
> Woah! No way this is stationarry! The process is ever increasing with time!
> */
. 
. ac s3

. //No exponential decay. 
. 
. pac s3

. //Huge spike in the first lag, suggesting that we have an AR(1) with the coefficient being equal to one. 
. //This is obviously not a stationarry process. 
. corrgram s3

                                          -1       0       1 -1       0       1
 LAG       AC       PAC      Q     Prob>Q  [Autocorrelation]  [Partial Autocor]
-------------------------------------------------------------------------------
1        0.9871   0.9979   247.48  0.0000          |-------           |------- 
2        0.9742  -0.0420   489.51  0.0000          |-------           |        
3        0.9612  -0.0134   726.09  0.0000          |-------           |        
4        0.9482  -0.0649   957.22  0.0000          |-------           |        
5        0.9351   0.0200     1183  0.0000          |-------           |        
6        0.9220  -0.0233   1403.3  0.0000          |-------           |        
7        0.9089   0.0197   1618.3  0.0000          |-------           |        
8        0.8958   0.1050     1828  0.0000          |-------           |        
9        0.8828   0.0808   2032.5  0.0000          |-------           |        
10       0.8700   0.0069   2231.9  0.0000          |------            |        
11       0.8574  -0.0252   2426.4  0.0000          |------            |        
12       0.8447   0.0159     2616  0.0000          |------            |        
13       0.8318  -0.0074   2800.6  0.0000          |------            |        
14       0.8189  -0.0612   2980.3  0.0000          |------            |        
15       0.8063  -0.0221   3155.2  0.0000          |------            |        
16       0.7937   0.0333   3325.5  0.0000          |------            |        
17       0.7810  -0.0698     3491  0.0000          |------            |        
18       0.7684  -0.0695   3651.9  0.0000          |------            |        
19       0.7560  -0.0319   3808.3  0.0000          |------            |        
20       0.7438  -0.0008   3960.4  0.0000          |-----             |        
21       0.7316  -0.0640   4108.2  0.0000          |-----             |        
22       0.7194  -0.0805   4251.7  0.0000          |-----             |        
23       0.7072  -0.0592     4391  0.0000          |-----             |        
24       0.6950  -0.1093   4526.1  0.0000          |-----             |        
25       0.6829   0.0288   4657.2  0.0000          |-----             |        
26       0.6708  -0.0674   4784.2  0.0000          |-----             |        
27       0.6589   0.0221   4907.3  0.0000          |-----             |        
28       0.6471  -0.0609   5026.5  0.0000          |-----             |        
29       0.6354  -0.0598     5142  0.0000          |-----             |        
30       0.6237   0.0342   5253.8  0.0000          |----              |        
31       0.6118  -0.0377   5361.8  0.0000          |----              |        
32       0.6002   0.1087   5466.3  0.0000          |----              |        
33       0.5886   0.0272   5567.2  0.0000          |----              |        
34       0.5771   0.1247   5664.7  0.0000          |----              |        
35       0.5657  -0.0063   5758.7  0.0000          |----              |        
36       0.5544   0.0526   5849.5  0.0000          |----              |        
37       0.5432  -0.0441   5937.1  0.0000          |----              |        
38       0.5322   0.0148   6021.5  0.0000          |----              |        
39       0.5211   0.0119   6102.9  0.0000          |----              |        
40       0.5101   0.0609   6181.2  0.0000          |----              |        

. 
. //We try to differenciate the series to see if its stationary: 
. gen diff_s3 = D.s3
(1 missing value generated)

. tsline diff_s3 if(t<100)

. 
. ac diff_s3

. pac diff_s3

. //Seems stationary. It also seem we have no lag explaining the difference. 
. /*
> This means that the first difference of the series is somehow a white noise. 
> */
. 
. wntestq diff_s3

Portmanteau test for white noise
---------------------------------------
 Portmanteau (Q) statistic =    38.5701
 Prob > chi2(40)           =     0.5347

. //This is also suggested by this test. 
. //The statistics are : 
. sum diff_s3

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
     diff_s3 |       250    1.094539    .9899983  -2.694153   3.912323

. /* This suggest that the model is given by 
> 
> y = 1.09 + L.y + u where u ~N(0, 1)
> */
. log close
       log:  /Users/pabsta/Documents/2-Enseignement/ECON452/tutorial3/OUTPUT/analysis.log
  log type:  text
 closed on:   3 Feb 2012, 12:49:36
-------------------------------------------------------------------------------------------------------------

