Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running multiple regressions for lag selection determination in the Augmentd Dickey Fuller test.

    Dear all,

    I want to peform a unit root test using the Augmentd Dickey Fuller test. Therefore, I type in


    dfuller var, trend lags(OL)

    where OL is the optimum number of lags.

    To specify OL, I want to use the Schwert criterion. So I type in

    . dis int(12*(T/100)^0.25)
    13
    where T is the sample size (the rest values are tailed-made). My result tells me the that maximun number of lags I should start with is 13.
    Now, in order to choose how may of these lags I should eventually include in the ADF regression, I have to run the ADF regression for 1,2...,13 lags. and calculate for each regression the AIC/BIC.

    For example for the ADF with first lagged difference I run

    regress d.var l.var L1.d.var trend

    For the ADF with tw0 lagged differences I run

    regress d.var l.var L1.d.var L2.d.var trend

    and so on and so forth.


    But it is difficult to do that for each of the 13 regressions separately and then choose the model that minimizes the AIC or BIC criterion..
    Is there a consice way to get the results for AIC/BIC for all these models in one table?

    Best,
    John,
    Stata 14SE
    Windows 10









    Last edited by John Andrews; 14 Dec 2019, 15:42.

  • #2
    I have been thinking something like

    forvalues q=1/13 {
    quietly regress d.var l.var L(1/`q').d.var trend
    }

    I am not sure how to proceed further and gather together in one table the AIC and BIC from each regression

    Any help is greatly appreciated.

    Comment


    • #3
      any suggestions?

      Comment


      • #4
        How about dfgls?

        From the help file:

        Elliott, Rothenberg, and Stock and later studies have shown that this test has significantly greater power than the previous versions of the augmented Dickey–Fuller test.
        So you would type

        Code:
        dfgls var, maxlag(#)
        Also see this Stata blog post on unit-root tests.

        Hope this helps.

        Comment


        • #5
          I have been thinking something like

          forvalues q=1/13 {
          quietly regress d.var l.var L(1/`q').d.var trend
          }

          I am not sure how to proceed further and gather together in one table the AIC and BIC from each regression
          Someone will likely have a more sophisticated approach, but for what it's worth try:

          Code:
          eststo clear 
          
          forvalues q=1/13 {
          qui eststo: regress d.var l.var L(1/`q').d.var trend
          
          }
          esttab, compress cells(none) scalars( bic aic) nomtitles
          You'll need estout (ssc install estout).

          Comment


          • #6
            Thank you Justing. I get this


            esttab, compress cells(none) scalars( bic aic) nomtitles

            {hline 1380}
            (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13)
            > (14) (15) (16) (17) (18) (19) (20) (21) (22) (23) (24) (25) (26) (27)
            > (28) (29) (30) (31) (32) (33) (34) (35) (36) (37) (38) (39) (40) (41) (4
            > 2) (43) (44) (45) (46) (47) (48) (49) (50) (51) (52) (53) (54) (55) (56)
            > (57) (58) (59) (60) (61) (62) (63) (64) (65) (66) (67) (68) (69) (70)
            > (71) (72) (73) (74) (75) (76) (77) (78) (79) (80) (81) (82) (83) (84)
            > (85) (86) (87) (88) (89) (90) (91) (92) (93) (94) (95) (96) (97) (98)
            > (99) (100) (101) (102) (103) (104) (105) (106) (107) (108) (109) (110) (111) (112) (11
            > 3) (114) (115) (116) (117) (118) (119) (120) (121) (122) (123) (124) (125) (126) (127)
            > (128) (129) (130) (131) (132) (133) (134) (135) (136) (137)
            {hline 1380}
            N 126 125 124 123 122 121 120 119 118 117 116 115 126
            > 125 124 123 122 121 120 119 118 117 116 115 126 125 124
            > 123 122 121 120 119 118 117 116 115 126 125 124 123 122 1
            > 21 120 119 118 117 116 115 126 125 124 123 122 121 120 119
            > 118 117 116 115 126 125 124 123 122 121 120 119 118 117
            > 116 115 126 125 124 123 122 121 120 119 118 117 116 115
            > 126 125 124 123 122 121 120 119 118 117 116 115 114 126
            > 125 124 123 122 121 120 119 118 117 116 115 114 126 125 1
            > 24 123 122 121 120 119 118 117 116 115 114 116 115 126 125
            > 124 123 122 121 120 119 118 117 116 115
            bic -378.2 -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -378.2
            > -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -378.2 -369.4 -362.2 -3
            > 59.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -378.2 -369.4 -362.2 -359.0 -354.0 -345
            > .2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -378.2 -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7
            > -321.4 -312.7 -304.3 -296.6 -378.2 -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7
            > -304.3 -296.6 -378.2 -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6
            > -378.2 -369.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -288.1 -378.2 -3
            > 69.4 -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -288.1 -378.2 -369.4 -362
            > .2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6 -288.1 -304.3 -296.6 -378.2 -369.4
            > -362.2 -359.0 -354.0 -345.2 -336.6 -329.7 -321.4 -312.7 -304.3 -296.6
            aic -389.6 -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -389.6
            > -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -389.6 -383.6 -379.2 -3
            > 78.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -389.6 -383.6 -379.2 -378.7 -376.4 -370
            > .3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -389.6 -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2
            > -354.7 -348.6 -342.9 -337.8 -389.6 -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6
            > -342.9 -337.8 -389.6 -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8
            > -389.6 -383.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -331.8 -389.6 -3
            > 83.6 -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -331.8 -389.6 -383.6 -379
            > .2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8 -331.8 -342.9 -337.8 -389.6 -383.6
            > -379.2 -378.7 -376.4 -370.3 -364.5 -360.2 -354.7 -348.6 -342.9 -337.8
            {hline 1380}

            .

            I am not sure why. Any ideas?

            Comment


            • #7
              Not sure, here's an alternate way:

              Code:
              version 14
              
              set obs 100
              gen t = _n
              gen var = runiform()
              tsset t
              
              tempname memhold
              tempfile results
              
              postfile `memhold' lags aic bic using `results', replace
              
              forvalues q= 1/13 {
                  quietly regress d.var l.var L(1/`q').d.var
                  estat ic
                  post `memhold' (`q') (r(S)[1,5]) (r(S)[1,6])
              }
              
              postclose `memhold'
              use `results', clear
              list, noobs
              
                +----------------------------+
                | lags        aic        bic |
                |----------------------------|
                |    1   29.35565   37.11055 |
                |    2   29.75716     40.056 |
                |    3   29.46458   42.28632 |
                |    4   28.47763   43.80089 |
                |    5   31.01501   48.81807 |
                |----------------------------|
                |    6   29.10595   49.36674 |
                |    7   31.84402   54.54012 |
                |    8   33.03206   58.14066 |
                |    9   35.35831   62.85622 |
                |   10   36.50708   66.37071 |
                |----------------------------|
                |   11   38.55014   70.75552 |
                |   12   34.26356   68.78627 |
                |   13   36.04538   72.86059 |
                +----------------------------+
              Last edited by Justin Niakamal; 20 Dec 2019, 06:38. Reason: spacing

              Comment


              • #8
                Thank you!, it worked!

                Comment

                Working...
                X