Announcement

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

  • How to determine the number of lags in time series

    Hi I am running the following model:
    Code:
    reg CSAD RtnMrktPort AbsRtnMrktPort SquDiffRtnMrktPort
    predict residual, r
    Below you can see the partial auto correlation of the residual for this model.

    Click image for larger version

Name:	Graph21.jpg
Views:	2
Size:	49.7 KB
ID:	1595605


    How would I test for how many lags of CSAD should I be using on the RHS of my regression in order to remove auto correlation from the model? I know that one may use the
    Code:
    varsoc
    command, but I am unsure whether I need to use
    Code:
    varsoc CSAD
    or
    Code:
    varsoc CSAD RtnMrktPort AbsRtnMrktPort SquDiffRtnMrktPort
    to determine the number of lags.



    Also, it will help me a lot if you could tell me other alternative tests I could run in Stata and how to read them.

    Thank you.

  • #2
    basically in your chart the gray area is a good indicator how many lags are significant. I think it is based on ljung box statistics if i remember correctly
    so the first lag is sky high and must be included. after you include it relook at the PACF and is you see 2nd lag sticking out include that too. then redo PACF and check 3rd lag etc until the rest of the lags are about the same height. and check the significant of acoeffcients of lags. it would be ok to have no 2nd lag but include 4th. i.e. you would have 1st, 2nd, 4th, but not third if that turns out to be the case

    Comment


    • #3
      What you probably want to estimate is an ARDL model. You can use our ardl command from SSC:
      Code:
      ssc describe ardl
      The command obtains the optimal lag orders with the Akaike or Schwarz/Bayesian information criterion. For more information, please see my 2018 London Stata Conference presentation:
      Last edited by Sebastian Kripfganz; 01 Mar 2021, 05:09.
      https://www.kripfganz.de/stata/

      Comment


      • #4
        Originally posted by Sebastian Kripfganz View Post
        What you probably want to estimate is an ARDL model. You can use our ardl command from SSC:
        Code:
        ssc describe ardl
        The command obtains the optimal lag orders with the Akaike or Schwarz/Bayesian information criterion. For more information, please see my 2018 London Stata Conference presentation:
        Hi, I have computed the results using the method you just mentioned and I also looked over the slides and added the options for 'aic' and 'bic' my dependent variable is 'CSAD' and the rest are the independent variables. I am unsure of how to interpret the results table. However, I used a max lag of 15 and I see that for CSAD the lags stop at 8, would this be infomative of the fact that I should be using 8 lags of my dependent variable to reduce autocorrelation. Could you please tell me if my interpretation is correct?


        Code:
        . ardl CSAD RtnMrktPort SquDiffRtnMrktPort AbsRtnMrktPort, aic bic maxlag(15) 
        > matcrit(data)
        
        ARDL(8,0,1,0) regression
        
        Sample:        17 -      1152                   Number of obs     =      1,136
                                                        F(  12,   1123)   =     229.23
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.7101
                                                        Adj R-squared     =     0.7070
        Log likelihood =  3683.1831                     Root MSE          =     0.0095
        
        ------------------------------------------------------------------------------
                CSAD |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                CSAD |
                 L1. |   .3665477   .0257583    14.23   0.000     .3160078    .4170876
                 L2. |   .0721833   .0258589     2.79   0.005     .0214462    .1229204
                 L3. |    .062255   .0258824     2.41   0.016     .0114716    .1130384
                 L4. |   .0217986   .0259814     0.84   0.402     -.029179    .0727761
                 L5. |   .0816112   .0259944     3.14   0.002     .0306082    .1326142
                 L6. |   .0088785   .0259251     0.34   0.732    -.0419885    .0597455
                 L7. |   .0480239   .0257391     1.87   0.062    -.0024783    .0985261
                 L8. |   .0883302    .024115     3.66   0.000     .0410147    .1356458
                     |
         RtnMrktPort |   .0937725   .0065156    14.39   0.000     .0809884    .1065567
                     |
        SquDiffRtn~t |
                 --. |   .2399237   .1010571     2.37   0.018     .0416418    .4382057
                 L1. |  -.1841277    .056281    -3.27   0.001    -.2945554   -.0737001
                     |
        AbsRtnMrkt~t |   .1465559   .0172538     8.49   0.000     .1127026    .1804091
               _cons |   .0012414    .000633     1.96   0.050    -5.51e-07    .0024833
        ------------------------------------------------------------------------------
        
        . estat ic
        
        Akaike's information criterion and Bayesian information criterion
        
        -----------------------------------------------------------------------------
               Model |          N   ll(null)  ll(model)      df        AIC        BIC
        -------------+---------------------------------------------------------------
                   . |      1,136   2979.874   3683.183      13  -7340.366  -7274.908
        -----------------------------------------------------------------------------

        Comment


        • #5
          First of all, only use either aic or bic, not both options together. In your case, the bic option dominates the aic option. Thus, the optimal lag order is obtained with the Bayesian information criterion.

          Yes, according to the BIC, 8 lags of the dependent variable (and 1 lag of of SquDiffRtnMrktPort) are deemed sufficient to account for the serial correlation.
          https://www.kripfganz.de/stata/

          Comment


          • #6
            Originally posted by Sebastian Kripfganz View Post
            First of all, only use either aic or bic, not both options together. In your case, the bic option dominates the aic option. Thus, the optimal lag order is obtained with the Bayesian information criterion.

            Yes, according to the BIC, 8 lags of the dependent variable (and 1 lag of of SquDiffRtnMrktPort) are deemed sufficient to account for the serial correlation.
            Thank you Sebastian, this has been very helpful, I appreciate the patience and help tremendously.

            Comment

            Working...
            X