Announcement

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

  • Unit Root Test Error

    Hi again,

    I was trying to run a unit root test on my unbalanced panel data and I received this error. From my knowledge, the Fisher tests should work on unbalanced panel data? I am unsure what is happening. I have also tried other variables and same result.

    xtunitroot fisher roe, dfuller lags(0)
    performing unit-root test on first panel using the syntax
    dfuller roe, lags(0)
    returned error code 2000
    r(2000);

    xtunitroot fisher roe, pperron lags(0)
    performing unit-root test on first panel using the syntax
    pperron roe, lags(0)
    returned error code 2000
    r(2000);


    Thanks!


  • #2
    David.
    as always, the error description is a good first place to start from:
    Code:
    search for r(2000)                                                                                                                                                    (manual:  [R] search)
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    
    Search of official help files, FAQs, Examples, SJs, and STBs
    
    [P]     error . . . . . . . . . . . . . . . . . . . . . . . . Return code 2000
            no observations;
            You have requested some statistical calculation and there are
            no observations on which to perform it.  Perhaps you specified
            if or in and inadvertently filtered all the data.
    A careful scrutiny of your dataset and/or commands seems the way to go.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hi Carlo,

      Thanks for your help again. I looked through my dataset; however, it doesn't appear to have any missing observations. It is just unbalanced with different years. I have attached my dataset.

      Thanks!
      Attached Files

      Comment


      • #4
        Because you have singletons, when xtunitroot fisher calls dfuller it returns an error code:
        Code:
        . use "C:\Users\Scott\Desktop\Data.dta", clear
        
        . dfuller roe if companyid ==1 ,lag(0)
        no observations
        r(2000);
        You could try the user written command xtfisher (ssc desc xtfisher) which will ignore problematic cases:
        Code:
        . xtfisher roe, lag(0)
        
        
        Fisher Test for panel unit root using an augmented Dickey-Fuller test (0 lags)
        
        Ho: unit root
        
                 chi2(1070)   = 2125.7340
                 Prob > chi2  =      0.0000

        Comment


        • #5
          Hi Scott,

          Thanks so much. What does singleton mean? I'm not familiar with the jargon. I will try the xtfisher. Thanks!

          Comment


          • #6
            David:
            - missing observations are not the only cause for r(2000); more often, the reason of that call rests on the fact that your dataset has no observations that fulfill the requirements of the Stata command that you've invoked;
            - you can see what Scott meant by singleton (i.e., some of your companies have observations that refer to one year only; so lags are not allowed) via:
            Code:
            tab companyid
            Last edited by Carlo Lazzaro; 30 Aug 2015, 08:16.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Thanks for the explanation Carlo! I understand now. I have used the xtfisher user written command from Scott and it works now.

              Comment


              • #8
                I am using both the ADF and PP from xtfisher and am receiving identical chi2 for each. Is this because of the singletons as well?
                The code I am using is xtfisher var, lag(0) and xtfisher var, lag(0) pp. I was also wondering if I can still implement lags in these tests or would that not make sense? To clarify, I am unsure of how many lags to run in my data. Thanks again.
                Last edited by David Brown; 30 Aug 2015, 09:03.

                Comment


                • #9
                  The results from ADP and PP are the same because you are using zero lags. The sample sizes are the same and the interpolated critical values for Z_t are the same.

                  Code:
                  . use "C:\Users\Scott\Desktop\Data.dta", clear
                  
                  . dfuller roe if companyid ==10 ,lag(0)
                  
                  Dickey-Fuller test for unit root                   Number of obs   =         7
                  
                                                 ---------- Interpolated Dickey-Fuller ---------
                                    Test         1% Critical       5% Critical      10% Critical
                                 Statistic           Value             Value             Value
                  ------------------------------------------------------------------------------
                   Z(t)            -14.750            -3.750            -3.000            -2.630
                  ------------------------------------------------------------------------------
                  MacKinnon approximate p-value for Z(t) = 0.0000
                  
                  . pperron roe if companyid ==10 ,lag(0)
                  
                  Phillips-Perron test for unit root                 Number of obs   =         7
                                                                     Newey-West lags =         0
                  
                                                 ---------- Interpolated Dickey-Fuller ---------
                                    Test         1% Critical       5% Critical      10% Critical
                                 Statistic           Value             Value             Value
                  ------------------------------------------------------------------------------
                   Z(rho)           -7.822           -17.200           -12.500           -10.200
                   Z(t)            -14.750            -3.750            -3.000            -2.630
                  ------------------------------------------------------------------------------
                  MacKinnon approximate p-value for Z(t) = 0.0000

                  Comment


                  • #10
                    Hi all, I used xtfisher for my unbalanced panel after tsset. However, stata gives the message that "too many values", how can I solve this problem? Many thanks in advanced!!

                    Comment


                    • #11
                      Hi there,

                      Like David, I am trying to run a unit root test on my unbalanced panel data in order to find the degree of autocorrelation among my y variable (closing prices various indices). Since my data in 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?

                      Any help would be much appreciated.

                      Best,
                      Isabel

                      Comment

                      Working...
                      X