Announcement

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

  • "no observations r(2000)" error when using Wooldridge test for autocorrelation in panel data set


    Dear stata list,

    I have a question regarding the Wooldridge test for autocorrelation (command: 'xtserial') (Drukker, 2003)**.

    After conducting the test, Stata gives an error of "no observations r(2000)".

    To install the Wooldridge test I have followed the following steps:

    net sj 3-2 st0039
    net install st0039

    After that:

    . xtset Country_ID Year

    panel variable: Country_ID (unbalanced)
    time variable: Year, 2014 to 2016, but with gaps
    delta: 1 unit

    . xtserial DVEgovdevelopment IVLegal IVTechnical IVOrganisational IVCapacitybuidling IVCooperation CVGNI CVCorruption CVInnovation

    no observations
    r(2000);


    I note that other have said that there is a problem with xtserial and unbalanced time periods.

    Can this be the case, and if yes, is there another way to test for autocorrelation in an unbalanced panel dataset?
    Help would be appreciated!

    Regards,

    Joeri
    Last edited by Joeri Nelemans; 05 Jun 2019, 02:27.

  • #2
    Show us the results of

    Code:
    tab Year 
    if you have just 2014 and 2016 then no panels can be used without changing the setting. If all values are just 2014 and 2016, then use

    Code:
    xtset Country_ID Year, delta(2)

    Comment


    • #3
      Joeri:
      the problem here seems to rest on the pretty small time-series (T) dimension: a small number of gaps is enough to make the community-contributed command -xtserial- gasping
      (see https://pdfs.semanticscholar.org/234...b5ef75747b.pdf, that shows an example of -xtserial- working successfully in a panel dataset with gaps but with a pretty large T dimension).
      Unfortunately, I'm not aware of other options to investigate the serial correlation of the idiosyncratic error in panel datasets.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        tab Year

        Year | Freq. Percent Cum.
        ------------+-----------------------------------
        2014 | 193 50.00 50.00
        2016 | 193 50.00 100.00
        ------------+-----------------------------------
        Total | 386 100.00

        So yes indeed, all values are either 2014 or 2016.

        I tried

        xtset Country_ID Year, delta(2)

        But doing the xtserial test afterwards results in the same error

        Comment


        • #5
          So, no way forward on that route except with more data.

          Comment


          • #6
            For what it's worth, the following demonstrates that xtserial requires at least 3 waves of data to function.
            Code:
            . use http://www.stata-press.com/data/r8/nlswork.dta, clear
            (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
            
            . gen age2 = age^2
            (24 missing values generated)
            
            . gen tenure2 = tenure^2
            (433 missing values generated)
            
            . 
            . tsset idcode year
                   panel variable:  idcode (unbalanced)
                    time variable:  year, 68 to 88, but with gaps
                            delta:  1 unit
            
            . xtserial ln_wage age* ttl_exp tenure* south
            
            Wooldridge test for autocorrelation in panel data
            H0: no first order autocorrelation
                F(  1,    1472) =     88.485
                       Prob > F =      0.0000
            
            . drop if year>70
            (24,241 observations deleted)
            
            . xtserial ln_wage age* ttl_exp tenure* south
            
            Wooldridge test for autocorrelation in panel data
            H0: no first order autocorrelation
                F(  1,     650) =     13.706
                       Prob > F =      0.0002
            
            . drop if year>69
            (1,686 observations deleted)
            
            . xtserial ln_wage age* ttl_exp tenure* south
            no observations
            r(2000);
            
            end of do-file
            
            r(2000);

            Comment


            • #7
              Originally posted by Joeri Nelemans View Post
              Dear stata list,

              I have a question regarding the Wooldridge test for autocorrelation (command: 'xtserial') (Drukker, 2003)**.

              After conducting the test, Stata gives an error of "no observations r(2000)".

              To install the Wooldridge test I have followed the following steps:

              net sj 3-2 st0039
              net install st0039

              After that:

              . xtset Country_ID Year

              panel variable: Country_ID (unbalanced)
              time variable: Year, 2014 to 2016, but with gaps
              delta: 1 unit

              . xtserial DVEgovdevelopment IVLegal IVTechnical IVOrganisational IVCapacitybuidling IVCooperation CVGNI CVCorruption CVInnovation

              no observations
              r(2000);


              I note that other have said that there is a problem with xtserial and unbalanced time periods.

              Can this be the case, and if yes, is there another way to test for autocorrelation in an unbalanced panel dataset?
              Help would be appreciated!

              Regards,

              Joeri
              Dear Joeri Nelemans,
              I have the same problems with my data.
              What should I do now?
              Please advise me.
              Thanks so much.

              Comment


              • #8
                Just to make sure Nick's point gets across: you cannot test for serial correlation when using fixed effects or first differencing when T = 2. More importantly, there is absolutely no reason to test for serial correlation. It has no implications for estimation or inference. When T = 2, there is only one estimator because FE = FD. And what is FD when T = 2? It's an OLS regression on the first differences. There is no time series dimension in this regression. Therefore, serial correlation is irrelevant.

                BTW, and this is a bit awkward since my name is attached to the command, but I would've implemented xtserial differently. First, I originally suggested a cluster-robust t test, rather than an F test. Since F = t^2, this is not a big deal, but I'd still like to know the sign of the t statistic. More importantly -- and this is related to not knowing the sign -- the command does not report the estimated serial correlation coefficient! We always teach our students we should care about magnitudes (and signs), not just statistical significance. The null is that the first order autocorrelation in the FD errors is -.5. How far is the estimate from -.5? Is it above it or below it? Plus, it is easy to estimate the autocorrelation in the original errors, u(i,t).

                I always implement the test I proposed by hand:

                Code:
                xtset id year
                reg D.(y x1 x2 ... xK year2 year3 ... yearT), nocons
                predict ehat, resid
                reg ehat L.ehat, vce(cluster id)
                llincom L1.ehat + .5
                The final command gives the estimate of rho in the original AR(1) model.

                Comment


                • #9
                  Hello,

                  I have the same problem with "xtserial" command, but my dataset contains values over 20 years.
                  "
                  tsset
                  panel variable: pairstates2 (weakly balanced)
                  time variable: year, 1999 to 2015
                  delta: 1 year

                  . xtserial FDI_OUT_dt RESTR_d log_DISTANCE log_TAX_d log_GDP_d, output
                  no observations
                  r(2000);
                  "

                  Do you have any ideas? I didn't find the solution on another answers on this question on statalist.

                  Many thanks in advance!

                  best regards,
                  Daniel



                  Comment


                  • #10
                    Daniel:
                    could you please provide an example/excerpt of your data via -dataex-? Thanks.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Hello,
                      I have the same problem with fourteen years of unbalanced quarterly panel data. The xtserial command along with variables gives the r(2000) no observations error. Here is a snap shot of my data. Kindly help.


                      tab Quarters

                      Quarters | Freq. Percent Cum.
                      ------------+-----------------------------------
                      01jan2006 | 1,180 1.07 1.07
                      31mar2006 | 1,080 0.98 2.05
                      30jun2006 | 1,104 1.00 3.05
                      30sep2006 | 1,123 1.02 4.06
                      01jan2007 | 1,282 1.16 5.22
                      31mar2007 | 1,185 1.07 6.29
                      30jun2007 | 1,203 1.09 7.38
                      30sep2007 | 1,234 1.12 8.50
                      01jan2008 | 1,330 1.20 9.70
                      31mar2008 | 1,282 1.16 10.86
                      30jun2008 | 1,315 1.19 12.06
                      30sep2008 | 1,328 1.20 13.26
                      01jan2009 | 1,457 1.32 14.58
                      31mar2009 | 1,330 1.20 15.78
                      30jun2009 | 1,330 1.20 16.98
                      30sep2009 | 1,352 1.22 18.21
                      01jan2010 | 1,760 1.59 19.80
                      31mar2010 | 1,494 1.35 21.15
                      30jun2010 | 1,571 1.42 22.58
                      30sep2010 | 1,640 1.48 24.06
                      01jan2011 | 1,953 1.77 25.83
                      31mar2011 | 1,786 1.62 27.44
                      30jun2011 | 1,849 1.67 29.12
                      30sep2011 | 1,897 1.72 30.84
                      01jan2012 | 2,060 1.86 32.70
                      31mar2012 | 1,979 1.79 34.49
                      30jun2012 | 2,029 1.84 36.33
                      30sep2012 | 2,059 1.86 38.19
                      01jan2013 | 2,095 1.90 40.09
                      31mar2013 | 2,059 1.86 41.95
                      30jun2013 | 2,057 1.86 43.81
                      30sep2013 | 2,057 1.86 45.68
                      01jan2014 | 2,184 1.98 47.65
                      31mar2014 | 2,096 1.90 49.55
                      30jun2014 | 2,102 1.90 51.45
                      30sep2014 | 2,131 1.93 53.38
                      01jan2015 | 2,330 2.11 55.49
                      31mar2015 | 2,214 2.00 57.49
                      30jun2015 | 2,296 2.08 59.57
                      30sep2015 | 2,296 2.08 61.65
                      01jan2016 | 2,505 2.27 63.92
                      31mar2016 | 2,339 2.12 66.04
                      30jun2016 | 2,368 2.14 68.18
                      30sep2016 | 2,402 2.17 70.35
                      01jan2017 | 2,739 2.48 72.83
                      31mar2017 | 2,549 2.31 75.14
                      30jun2017 | 2,638 2.39 77.53
                      30sep2017 | 2,681 2.43 79.96
                      01jan2018 | 2,768 2.51 82.46
                      31mar2018 | 2,746 2.49 84.95
                      30jun2018 | 2,751 2.49 87.44
                      30sep2018 | 2,760 2.50 89.94
                      01jan2019 | 2,780 2.52 92.45
                      31mar2019 | 2,773 2.51 94.96
                      30jun2019 | 2,781 2.52 97.48
                      30sep2019 | 2,785 2.52 100.00
                      ------------+-----------------------------------
                      Total | 110,474 100.00

                      . xtset StockCode Quarters, delta (2)
                      panel variable: StockCode (unbalanced)
                      time variable: Quarters, 1/1/2006 to 9/30/2019, but with gaps
                      delta: 2 days

                      . xtserial NumberofbankingRelationships AltmanZscore StateorPrivate FirmAge TotalLoans TotalAssets Undistribut
                      > edProfit TotalShareholdersEquity TangibleAssetsTotalAssets BondsLTLTA ROE
                      no observations
                      r(2000);

                      Comment

                      Working...
                      X