ECO 341: Autoregressions Stata Log

——————————————————————————–
name:  <unnamed>
log:  C:\Users\pshea\dailystocks.log
log type:  text
opened on:  27 Sep 2013, 12:54:19

. /*Telling Stata which is the time series indicator*/
>
> tsset time;
time variable:  time, 1 to 14282
delta:  1 unit

. /*Unit root tests for S&P 500 and Federal Funds Rate*/
>
> dfgls lnstock;

DF-GLS for lnstock                                       Number of obs = 14240
Maxlag = 41 chosen by Schwert criterion

DF-GLS tau      1% Critical       5% Critical      10% Critical
[lags]     Test Statistic        Value             Value             Value
——————————————————————————
41           -1.825           -3.480            -2.836            -2.548
40           -1.805           -3.480            -2.836            -2.548
39           -1.824           -3.480            -2.836            -2.548
38           -1.809           -3.480            -2.836            -2.548
37           -1.814           -3.480            -2.836            -2.548
36           -1.812           -3.480            -2.836            -2.548
35           -1.819           -3.480            -2.836            -2.549
34           -1.804           -3.480            -2.836            -2.549
33           -1.875           -3.480            -2.836            -2.549
32           -1.848           -3.480            -2.837            -2.549
31           -1.820           -3.480            -2.837            -2.549
30           -1.831           -3.480            -2.837            -2.549
29           -1.814           -3.480            -2.837            -2.549
28           -1.764           -3.480            -2.837            -2.549
27           -1.762           -3.480            -2.837            -2.549
26           -1.725           -3.480            -2.837            -2.549
25           -1.762           -3.480            -2.837            -2.549
24           -1.784           -3.480            -2.837            -2.549
23           -1.764           -3.480            -2.837            -2.550
22           -1.762           -3.480            -2.837            -2.550
21           -1.761           -3.480            -2.838            -2.550
20           -1.801           -3.480            -2.838            -2.550
19           -1.779           -3.480            -2.838            -2.550
18           -1.769           -3.480            -2.838            -2.550
17           -1.811           -3.480            -2.838            -2.550
16           -1.820           -3.480            -2.838            -2.550
15           -1.760           -3.480            -2.838            -2.550
14           -1.778           -3.480            -2.838            -2.550
13           -1.779           -3.480            -2.838            -2.550
12           -1.779           -3.480            -2.838            -2.550
11           -1.724           -3.480            -2.838            -2.551
10           -1.753           -3.480            -2.839            -2.551
9            -1.733           -3.480            -2.839            -2.551
8            -1.749           -3.480            -2.839            -2.551
7            -1.734           -3.480            -2.839            -2.551
6            -1.768           -3.480            -2.839            -2.551
5            -1.776           -3.480            -2.839            -2.551
4            -1.799           -3.480            -2.839            -2.551
3            -1.819           -3.480            -2.839            -2.551
2            -1.814           -3.480            -2.839            -2.551
1            -1.885           -3.480            -2.839            -2.551

Opt Lag (Ng-Perron seq t) = 34 with RMSE  .0099562
Min SC   = -9.208317 at lag  2 with RMSE       .01
Min MAIC = -9.213884 at lag 34 with RMSE  .0099562

. dfuller lnstock, lag(2) trend;

Augmented Dickey-Fuller test for unit root         Number of obs   =     14279

———- Interpolated Dickey-Fuller ———
Test         1% Critical       5% Critical      10% Critical
Statistic           Value             Value             Value
——————————————————————————
Z(t)             -2.047            -3.960            -3.410            -3.120
——————————————————————————
MacKinnon approximate p-value for Z(t) = 0.5757

. gen d1stock=lnstock-lnstock[_n-1];
(1 missing value generated)

. dfgls d1stock;

DF-GLS for d1stock                                       Number of obs = 14239
Maxlag = 41 chosen by Schwert criterion

DF-GLS tau      1% Critical       5% Critical      10% Critical
[lags]     Test Statistic        Value             Value             Value
——————————————————————————
41          -16.873           -3.480            -2.836            -2.548
40          -16.997           -3.480            -2.836            -2.548
39          -17.425           -3.480            -2.836            -2.548
38          -17.482           -3.480            -2.836            -2.548
37          -17.878           -3.480            -2.836            -2.548
36          -18.086           -3.480            -2.836            -2.548
35          -18.378           -3.480            -2.836            -2.549
34          -18.588           -3.480            -2.836            -2.549
33          -19.037           -3.480            -2.836            -2.549
32          -18.599           -3.480            -2.837            -2.549
31          -19.171           -3.480            -2.837            -2.549
30          -19.800           -3.480            -2.837            -2.549
29          -20.017           -3.480            -2.837            -2.549
28          -20.567           -3.480            -2.837            -2.549
27          -21.569           -3.480            -2.837            -2.549
26          -22.026           -3.480            -2.837            -2.549
25          -22.995           -3.480            -2.837            -2.549
24          -23.009           -3.480            -2.837            -2.549
23          -23.242           -3.480            -2.837            -2.550
22          -24.062           -3.480            -2.837            -2.550
21          -24.677           -3.480            -2.838            -2.550
20          -25.343           -3.480            -2.838            -2.550
19          -25.423           -3.480            -2.838            -2.550
18          -26.454           -3.480            -2.838            -2.550
17          -27.382           -3.480            -2.838            -2.550
16          -27.553           -3.480            -2.838            -2.550
15          -28.274           -3.480            -2.838            -2.550
14          -30.280           -3.480            -2.838            -2.550
13          -31.076           -3.480            -2.838            -2.550
12          -32.299           -3.480            -2.838            -2.550
11          -33.674           -3.480            -2.838            -2.551
10          -36.473           -3.480            -2.839            -2.551
9           -37.765           -3.480            -2.839            -2.551
8           -40.497           -3.480            -2.839            -2.551
7           -42.777           -3.480            -2.839            -2.551
6           -46.482           -3.480            -2.839            -2.551
5           -49.549           -3.480            -2.839            -2.551
4           -54.438           -3.480            -2.839            -2.551
3           -60.437           -3.480            -2.839            -2.551
2           -69.414           -3.480            -2.839            -2.551
1           -86.156           -3.480            -2.839            -2.551

Opt Lag (Ng-Perron seq t) = 40 with RMSE  .0099712
Min SC   = -9.205108 at lag  1 with RMSE  .0100195
Min MAIC = -7.679436 at lag 32 with RMSE  .0099801

. dfuller d1stock, lag(1) trend;

Augmented Dickey-Fuller test for unit root         Number of obs   =     14279

———- Interpolated Dickey-Fuller ———
Test         1% Critical       5% Critical      10% Critical
Statistic           Value             Value             Value
——————————————————————————
Z(t)            -86.708            -3.960            -3.410            -3.120
——————————————————————————
MacKinnon approximate p-value for Z(t) = 0.0000

. dfgls ffr;

DF-GLS for ffr                                           Number of obs = 14240
Maxlag = 41 chosen by Schwert criterion

DF-GLS tau      1% Critical       5% Critical      10% Critical
[lags]     Test Statistic        Value             Value             Value
——————————————————————————
41           -1.971           -3.480            -2.836            -2.548
40           -1.999           -3.480            -2.836            -2.548
39           -1.989           -3.480            -2.836            -2.548
38           -1.960           -3.480            -2.836            -2.548
37           -2.022           -3.480            -2.836            -2.548
36           -2.046           -3.480            -2.836            -2.548
35           -2.028           -3.480            -2.836            -2.549
34           -1.993           -3.480            -2.836            -2.549
33           -1.933           -3.480            -2.836            -2.549
32           -1.900           -3.480            -2.837            -2.549
31           -1.917           -3.480            -2.837            -2.549
30           -1.955           -3.480            -2.837            -2.549
29           -1.869           -3.480            -2.837            -2.549
28           -1.780           -3.480            -2.837            -2.549
27           -1.795           -3.480            -2.837            -2.549
26           -1.883           -3.480            -2.837            -2.549
25           -1.882           -3.480            -2.837            -2.549
24           -1.851           -3.480            -2.837            -2.549
23           -1.722           -3.480            -2.837            -2.550
22           -1.687           -3.480            -2.837            -2.550
21           -1.671           -3.480            -2.838            -2.550
20           -1.622           -3.480            -2.838            -2.550
19           -1.515           -3.480            -2.838            -2.550
18           -1.514           -3.480            -2.838            -2.550
17           -1.574           -3.480            -2.838            -2.550
16           -1.642           -3.480            -2.838            -2.550
15           -1.666           -3.480            -2.838            -2.550
14           -1.592           -3.480            -2.838            -2.550
13           -1.558           -3.480            -2.838            -2.550
12           -1.598           -3.480            -2.838            -2.550
11           -1.613           -3.480            -2.838            -2.551
10           -1.594           -3.480            -2.839            -2.551
9            -1.480           -3.480            -2.839            -2.551
8            -1.551           -3.480            -2.839            -2.551
7            -1.773           -3.480            -2.839            -2.551
6            -2.055           -3.480            -2.839            -2.551
5            -2.315           -3.480            -2.839            -2.551
4            -2.311           -3.480            -2.839            -2.551
3            -2.708           -3.480            -2.839            -2.551
2            -3.376           -3.480            -2.839            -2.551
1            -4.184           -3.480            -2.839            -2.551

Opt Lag (Ng-Perron seq t) = 38 with RMSE  .3705378
Min SC   = -1.962382 at lag 30 with RMSE  .3709822
Min MAIC = -1.979718 at lag 39 with RMSE  .3705077

. dfuller ffr, lag(30) trend;

Augmented Dickey-Fuller test for unit root         Number of obs   =     14251

———- Interpolated Dickey-Fuller ———
Test         1% Critical       5% Critical      10% Critical
Statistic           Value             Value             Value
——————————————————————————
Z(t)             -2.770            -3.960            -3.410            -3.120
——————————————————————————
MacKinnon approximate p-value for Z(t) = 0.2082

. gen d1ffr=ffr-ffr[_n-1];
(1 missing value generated)

. dfgls d1ffr;

DF-GLS for d1ffr                                         Number of obs = 14239
Maxlag = 41 chosen by Schwert criterion

DF-GLS tau      1% Critical       5% Critical      10% Critical
[lags]     Test Statistic        Value             Value             Value
——————————————————————————
41           -2.366           -3.480            -2.836            -2.548
40           -2.373           -3.480            -2.836            -2.548
39           -2.360           -3.480            -2.836            -2.548
38           -2.322           -3.480            -2.836            -2.548
37           -2.273           -3.480            -2.836            -2.548
36           -2.279           -3.480            -2.836            -2.548
35           -2.263           -3.480            -2.836            -2.549
34           -2.223           -3.480            -2.836            -2.549
33           -2.175           -3.480            -2.836            -2.549
32           -2.116           -3.480            -2.837            -2.549
31           -2.072           -3.480            -2.837            -2.549
30           -2.053           -3.480            -2.837            -2.549
29           -2.042           -3.480            -2.837            -2.549
28           -1.982           -3.480            -2.837            -2.549
27           -1.928           -3.480            -2.837            -2.549
26           -1.911           -3.480            -2.837            -2.549
25           -1.914           -3.480            -2.837            -2.549
24           -1.893           -3.480            -2.837            -2.549
23           -1.868           -3.480            -2.837            -2.550
22           -1.832           -3.480            -2.837            -2.550
21           -1.820           -3.480            -2.838            -2.550
20           -1.816           -3.480            -2.838            -2.550
19           -1.821           -3.480            -2.838            -2.550
18           -1.851           -3.480            -2.838            -2.550
17           -1.883           -3.480            -2.838            -2.550
16           -1.908           -3.480            -2.838            -2.550
15           -1.935           -3.480            -2.838            -2.550
14           -1.986           -3.480            -2.838            -2.550
13           -2.106           -3.480            -2.838            -2.550
12           -2.255           -3.480            -2.838            -2.550
11           -2.396           -3.480            -2.838            -2.551
10           -2.606           -3.480            -2.839            -2.551
9            -2.940           -3.480            -2.839            -2.551
8            -3.627           -3.480            -2.839            -2.551
7            -4.355           -3.480            -2.839            -2.551
6            -5.037           -3.480            -2.839            -2.551
5            -5.809           -3.480            -2.839            -2.551
4            -6.957           -3.480            -2.839            -2.551
3           -10.055           -3.480            -2.839            -2.551
2           -14.219           -3.480            -2.839            -2.551
1           -20.988           -3.480            -2.839            -2.551

Opt Lag (Ng-Perron seq t) = 39 with RMSE  .3746878
Min SC   = -1.937082 at lag 35 with RMSE  .3750745
Min MAIC = -1.956927 at lag 39 with RMSE  .3746878

. dfuller d1ffr, lag(30) trend;

Augmented Dickey-Fuller test for unit root         Number of obs   =     14250

———- Interpolated Dickey-Fuller ———
Test         1% Critical       5% Critical      10% Critical
Statistic           Value             Value             Value
——————————————————————————
Z(t)            -20.521            -3.960            -3.410            -3.120
——————————————————————————
MacKinnon approximate p-value for Z(t) = 0.0000

. /*Running an AR(1) for stock prices*/
>
> var d1stock, lag(1);

Vector autoregression

Sample:  3 – 14282                                 No. of obs      =     14280
Log likelihood =  45497.12                         AIC             = -6.371865
FPE            =  .0001001                         HQIC            = -6.371513
Det(Sigma_ml)  =     .0001                         SBIC            = -6.370806

Equation           Parms      RMSE     R-sq      chi2     P>chi2
—————————————————————-
d1stock               2     .010002   0.0007   9.302039   0.0023
—————————————————————-

——————————————————————————
d1stock |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
————-+—————————————————————-
d1stock      |
d1stock |
L1. |   .0255144   .0083656     3.05   0.002     .0091181    .0419106
|
_cons |   .0002451   .0000837     2.93   0.003      .000081    .0004092
——————————————————————————

. fcast compute for, step(20) bs;
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . .

. fcast graph ford1stock;

. /*Running an AR(p)*/
>
> varsoc d1stock;

Selection-order criteria
Sample:  6 – 14282                           Number of obs      =     14277
+—————————————————————————+
|lag |    LL      LR      df    p      FPE       AIC      HQIC      SBIC    |
|—-+———————————————————————-|
|  0 |  45481.7                        .0001  -6.37118    -6.371  -6.37065  |
|  1 |  45486.3  9.2853    1  0.002    .0001  -6.37169  -6.37134  -6.37063  |
|  2 |  45497.1  21.613*   1  0.000    .0001* -6.37306* -6.37253* -6.37147* |
|  3 |  45497.2  .11315    1  0.737    .0001  -6.37293  -6.37223  -6.37081  |
|  4 |    45498  1.6462    1  0.199    .0001  -6.37291  -6.37202  -6.37026  |
+—————————————————————————+
Endogenous:  d1stock
Exogenous:  _cons

. var d1stock, lag(1,2);

Vector autoregression

Sample:  4 – 14282                                 No. of obs      =     14279
Log likelihood =  45504.39                         AIC             = -6.373189
FPE            =  .0000999                         HQIC            = -6.372661
Det(Sigma_ml)  =  .0000999                         SBIC            =   -6.3716

Equation           Parms      RMSE     R-sq      chi2     P>chi2
—————————————————————-
d1stock               3     .009995   0.0022   30.94456   0.0000
—————————————————————-

——————————————————————————
d1stock |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
————-+—————————————————————-
d1stock      |
d1stock |
L1. |   .0265103   .0083622     3.17   0.002     .0101207    .0428998
L2. |  -.0388874   .0083622    -4.65   0.000     -.055277   -.0224978
|
_cons |    .000255   .0000837     3.05   0.002      .000091     .000419
——————————————————————————

. fcast compute for2, step(20) bs;
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  . . . .

. fcast graph for2d1stock;

. /*Running an ADL model*/
>
> gen d1stock_lag1=d1stock[_n-1];
(21 missing values generated)

. gen d1stock_lag2=d1stock[_n-2];
(21 missing values generated)

. gen d1ffr_lag1=d1ffr[_n-1];
(21 missing values generated)

. reg d1stock d1stock_lag1 d1stock_lag2 d1ffr_lag1, robust;

Linear regression                                      Number of obs =   14279
F(  3, 14275) =    4.39
Prob > F      =  0.0043
R-squared     =  0.0027
Root MSE      =  .00999

——————————————————————————
|               Robust
d1stock |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
————-+—————————————————————-
d1stock_lag1 |   .0262643   .0195553     1.34   0.179    -.0120666    .0645952
d1stock_lag2 |  -.0393555   .0215377    -1.83   0.068    -.0815723    .0028612
d1ffr_lag1 |  -.0005671   .0001971    -2.88   0.004    -.0009535   -.0001807
_cons |   .0002551   .0000859     2.97   0.003     .0000867    .0004234
——————————————————————————

. estat ic;

—————————————————————————–
Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
————-+—————————————————————
. |  14279    45488.93    45508.36      4    -91008.71   -90978.45
—————————————————————————–
Note:  N=Obs used in calculating BIC; see [R] BIC note

. reg d1stock d1stock_lag1 d1stock_lag2, robust;

Linear regression                                      Number of obs =   14279
F(  2, 14276) =    2.58
Prob > F      =  0.0758
R-squared     =  0.0022
Root MSE      =     .01

——————————————————————————
|               Robust
d1stock |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
————-+—————————————————————-
d1stock_lag1 |   .0265103    .019573     1.35   0.176    -.0118553    .0648758
d1stock_lag2 |  -.0388874   .0215553    -1.80   0.071    -.0811386    .0033638
_cons |    .000255   .0000859     2.97   0.003     .0000866    .0004234
——————————————————————————

. estat ic;

—————————————————————————–
Model |    Obs    ll(null)   ll(model)     df          AIC         BIC
————-+—————————————————————
. |  14279    45488.93    45504.39      3    -91002.77   -90980.07
—————————————————————————–
Note:  N=Obs used in calculating BIC; see [R] BIC note

.
end of do-file

. save “C:\Users\pshea\dailystocks2.dta”
file C:\Users\pshea\dailystocks2.dta saved

. exit