Announcement

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

  • How to fix errors in unit root test panel data

    Dear All,

    I am trying to run a unit root test in order to find the degree of autocorrelation among my y variable ( which is closing prices of various indices). Since my data is unbalanced, I used the fisher xtunitroot test but, still, Stata only produces this error r(2000):

    . xtunitroot fisher closing_px_0, dfuller lags(10)
    performing unit-root test on first panel using the syntax
    dfuller closing_px_0, lags(10)
    returned error code 2000

    I checked my data, and there are is no missing data and no string variable so I don"t know what is wrong. I read about the fact that my data on closing prices could be a singleton but how do I solve this problem so that I can perform this test?

    In case you need it: Overall, I am trying to assess the impact of terrorism on stock markets using daily data on the main stock index of the respective country (closing_px_0).

    Any help would be much appreciated.

    Best,
    Isabel

  • #2
    How does this problem differ from the one resolved on the earlier topic to which you posted http://www.statalist.org/forums/foru...66#post1308266 ?

    Specifically, you presumably have too few consecutive observations in your first panel to calculate enough observations with 10 lagged differences to perform the test. The suggestion on that thread at post #4 was to use the user-written xtfisher command (see the output of search xtfisher).
    Last edited by William Lisowski; 29 May 2017, 07:27.

    Comment


    • #3
      I would second William Lisowski's reply.

      One way to identify singleton would be use egen's count() and then exclude those panels with less than 10 observations.

      For example:
      Code:
      . webuse grunfeld, clear
      
      . replace invest = . in 1/10
      (10 real changes made, 10 to missing)
      
      . xtunitroot fisher invest, lag(10) dfuller
      (10 missing values generated)
      performing unit-root test on first panel using the syntax
      dfuller invest, lags(10) 
      returned error code 2000
      r(2000);
      
      .  egen count =count(invest), by(com)
      
      . table com, c(mean count)
      
      -----------------------
        company | mean(count)
      ----------+------------
              1 |          10
              2 |          20
              3 |          20
              4 |          20
              5 |          20
              6 |          20
              7 |          20
              8 |          20
              9 |          20
             10 |          20
      -----------------------
      
      . xtunitroot fisher invest if count>10, lag(10) dfuller
      (10 missing values generated)
      
      Fisher-type unit-root test for invest
      Based on augmented Dickey-Fuller tests
      --------------------------------------
      Ho: All panels contain unit roots           Number of panels  =      9
      Ha: At least one panel is stationary        Number of periods =     20
      
      AR parameter: Panel-specific                Asymptotics: T -> Infinity
      Panel means:  Included
      Time trend:   Not included
      Drift term:   Not included                  ADF regressions: 10 lags
      ------------------------------------------------------------------------------
                                        Statistic      p-value
      ------------------------------------------------------------------------------
       Inverse chi-squared(18)   P         0.0000       1.0000
       Inverse normal            Z              .            .
       Inverse logit t(4)        L*             .            .
       Modified inv. chi-squared Pm       -3.0000       0.9987
      ------------------------------------------------------------------------------
       P statistic requires number of panels to be finite.
       Other statistics are suitable for finite or infinite number of panels.
      ------------------------------------------------------------------------------
      
      . xtfisher invest, lag(10)
      
      
      Fisher Test for panel unit root using an augmented Dickey-Fuller test (10 lags)
      
      Ho: unit root
      
               chi2(18)     =    0.0000
               Prob > chi2  =      1.0000

      Comment

      Working...
      X