Announcement

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

  • No observations error while running xtserial for testing autocorrelation in Panel data

    Hi,
    When I run xtserial for my panel data variables, I get "no observations "error. Please help with this.

    sum sharearable sharebarren populationdensitypersqkm gddplog

    Variable | Obs Mean Std. Dev. Min Max
    -------------+--------------------------------------------------------
    sharearable | 135 66.10502 19.11493 13.67472 93.17542
    sharebarren | 135 4.134044 2.381684 .9325368 12.38272
    population~m | 135 428.375 746.7514 132.9283 5185.566
    gddplog | 135 11.19595 .9886351 9.263763 13.22245

    . describe sharearable sharebarren populationdensitypersqkm gddplog

    storage display value
    variable name type format label variable label
    ----------------------------------------------------------------------------------------------------------------------------------------------
    sharearable float %8.0g
    sharebarren float %8.0g
    populationden~m float %8.0g
    gddplog float %8.0g

    . regress sharearable sharebarren populationdensitypersqkm gddplog

    Source | SS df MS Number of obs = 135
    -------------+------------------------------ F( 3, 131) = 5.48
    Model | 5457.39758 3 1819.13253 Prob > F = 0.0014
    Residual | 43503.5991 131 332.088543 R-squared = 0.1115
    -------------+------------------------------ Adj R-squared = 0.0911
    Total | 48960.9967 134 365.380572 Root MSE = 18.223

    ------------------------------------------------------------------------------------------
    sharearable | Coef. Std. Err. t P>|t| [95% Conf. Interval]
    -------------------------+----------------------------------------------------------------
    sharebarren | -1.379511 .6678059 -2.07 0.041 -2.700591 -.058432
    populationdensitypersqkm | -.0055049 .0022004 -2.50 0.014 -.0098579 -.001152
    gddplog | -2.941299 1.656252 -1.78 0.078 -6.217761 .3351627
    _cons | 107.0968 18.3377 5.84 0.000 70.82045 143.3732
    ------------------------------------------------------------------------------------------

    . xtserial sharearable sharebarren populationdensitypersqkm gddplog
    no observations
    r(2000);

    .
    Thnak you

  • #2
    At a guess, you have a problem with at least one missing value in every observation and/or your xtset declaration doesn't help. For example, a common problem is having monthly or quarterly data indexed by daily dates. If you declare the daily date variable to xtset, your dataset looks to Stata as full of holes.

    I am reduced to guessing because #1 tells us nothing about your data. Please review FAQ Advice #12.
    Last edited by Nick Cox; 16 May 2024, 02:48.

    Comment


    • #3
      Radhika_
      as a sidelight, it sounds weird that you go -regress- with panel data and you invoke -xtserial- after that.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Originally posted by Carlo Lazzaro View Post
        Radhika_
        as a sidelight, it sounds weird that you go -regress- with panel data and you invoke -xtserial- after that.
        Thanks, Carlo, for your reply. I have used xtreg -function and checked the xtserial command and even after the same " no observations' error occurs. I have checked for missing values using missings report command and confirmed there was no missing values in the data.

        Comment


        • #5
          Thank you, Professor, for your kind reply.
          I have checked 'missings report' and corrected the missing value problem.
          I am sharing the data below.


          Originally posted by Nick Cox View Post
          At a guess, you have a problem with at least one missing value in every observation and/or your xtset declaration doesn't help. For example, a common problem is having monthly or quarterly data indexed by daily dates. If you declare the daily date variable to xtset, your dataset looks to Stata as full of holes.

          I am reduced to guessing because #1 tells us nothing about your data. Please review FAQ Advice #12.
          dataex sharearable shareofnonagriareainga gddplog populationdensitypersqkm

          ----------------------- copy starting from the next line -----------------------
          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float(sharearable shareofnonagriareainga gddplog populationdensitypersqkm)
           .7903751   4.37246  9.675743 253.28822
           .7902537   4.37246  10.42941 268.51685
           .7902537   4.37246 11.673533 288.40054
           .7887041 4.5272975 11.995252 304.43375
           .7902219 4.5308914 12.218222  311.5431
           .6487408   9.98865 10.044715  326.3701
           .6397731  11.28392 10.862084    346.81
           .6387704 11.384867 11.805442   358.845
           .6247807 12.793293 12.146245  378.7944
           .6207427 13.111195 12.341957  391.2971
           .5164022  41.90685 10.423684  3010.976
           .4339129  49.05616 11.682283 3199.4065
           .3954004  52.87945 12.525663 4421.2104
           .3524585  57.14247 13.034995  4667.001
           .3419576    57.691 13.222448  5185.566
           .7555457   5.14849  9.668843  317.0311
           .7553493   5.16817    10.521  336.7275
           .7550042  5.202758  11.34055  358.5474
           .7542112  5.277003 11.630266 378.48035
           .7657779  5.265691 11.641655  486.0626
           .7238439  8.148592  9.716464 243.18036
           .7238197  8.150968  11.04382 258.07104
           .6725795  13.10025 11.658234 293.16055
           .6725795  13.10025   12.0002  309.4584
           .6822876 12.719876 11.566708   611.835
           .8471588 4.0392804  9.277965  278.5847
           .8471588 4.0392804 10.173636 295.57635
           .8471588 4.0392804 11.230492  314.6257
           .8457523  4.179148 11.553933  332.1169
           .8409421 4.6835804 11.589124  401.8815
           .9317542 2.9865394  9.451288  174.5593
           .9274228  3.422148 10.297942 184.88783
            .927213  3.443246 11.264214  209.1754
           .9269994 3.4647255 11.581096  220.8042
           .9267697  3.468059 11.761147 233.24945
             .39586 4.3106422  9.563612 171.46854
             .39586 4.3106422  10.22063 182.04045
          .39567575 4.3291116 11.584536 180.69518
           .3956477 4.3319263 11.844526 190.74066
           .3956143 4.3246107 12.075737 194.92027
           .4886861  5.921261  9.795221 159.90427
           .4965315  5.921261   10.6707 169.82364
           .5006308  5.997778 12.117615 159.02843
           .4979053  6.056798  12.39664  167.8694
            .504449  6.043417 12.648267 168.54546
           .6897569  6.109085  9.637204 182.00957
           .6897569  6.109085 10.432326 193.95566
           .6897569  6.109085 11.352983 199.08913
           .6842982  6.610634 11.685053  210.1572
           .6842256  7.202005  11.92531 215.96704
           .4410237  12.34875 10.197694  395.8241
           .4357905 12.909973 11.096866  419.9876
           .4303834 13.526533 12.319467  434.2093
           .4332598 14.575883  12.74802  458.3485
           .4767576 16.204039 12.960156  473.4866
            .717266  6.475905  9.574661 300.63147
            .717281   6.47441 10.616283   318.993
           .7170869  6.493686  11.43073  325.3259
           .7172526  6.627783 11.677416  343.4119
           .7496662  6.322857 11.937275  353.4754
           .8495024  5.087707   9.73278  383.2824
           .8489735  5.141135 10.820164  406.5012
           .8460835  5.433097 11.624682  439.4122
           .8422761   5.81773 11.971245  463.8407
           .8393463  6.051777 12.182522 485.77875
           .8774551 2.1981962  9.559291  210.9833
           .8769312 2.2505906  10.35471  223.6633
           .8769312 2.2505906 11.387064 230.04256
           .8741634 2.4410565 11.695545 242.83144
           .8741634  2.440978 11.883242  250.8121
           .8526215  4.172214   9.42158  194.6955
           .8523135  4.188363 10.355154  206.8417
           .8523129  4.193109  11.16074  232.0188
           .8498939  4.433925  11.52991 244.91754
           .8494331 4.5238876 11.718364 257.90884
           .6983559 11.445407  9.542944 255.37206
           .6971138 11.536542 10.428968 270.82477
            .695914 11.653214 11.664842 262.35175
            .695099 11.732463  11.92469  276.9368
           .6939912 12.176087 12.184477  281.8355
           .7996335  6.507318  9.401009 299.64258
           .7999344  6.515564  10.42943  317.9757
           .7968653  6.822511 11.404252  331.4328
           .7961728  6.891775 11.643312  349.8583
           .7960017  6.908087 11.862522 360.21625
           .4958262  5.775476 10.167362 134.38246
            .498039  5.841297 11.107373 143.34471
          .50409347  5.903218 11.944214 136.03824
          .50388896  5.923696 11.772092 143.60107
           .5249102  5.915404 12.047214 145.73743
           .6069635  8.991244  9.470987  310.2063
           .6022487  9.438161  10.34846  330.5728
           .6073291  9.438161 11.521643   341.624
           .6060333  9.560987 11.806635   360.616
           .6050327 10.551185  12.01878  370.9685
           .8196852  7.035294  9.638289  218.3655
           .8196852  7.035294 10.709576  232.0362
           .8194445  7.059367  11.33202 253.16154
           .7817971  8.982444 11.512807  267.2357
           .7804306  9.119178 11.736623  277.8862
          end
          ------------------ copy up to and including the previous line ------------------

          Listed 100 out of 135 observations
          Use the count() option to list more

          .
          Thank you

          Comment


          • #6
            Reverting to #2, please show us a data example and explain what you did by way of xtset.

            Otherwise we can't help you further.

            Comment


            • #7
              Originally posted by Nick Cox View Post
              At a guess, you have a problem with at least one missing value in every observation and/or your xtset declaration doesn't help. For example, a common problem is having monthly or quarterly data indexed by daily dates. If you declare the daily date variable to xtset, your dataset looks to Stata as full of holes.

              I am reduced to guessing because #1 tells us nothing about your data. Please review FAQ Advice #12.
              Hi,

              The below is my xtset command in which I have used year with gaps(as I have used agrl. census data which reports every 5 th year and I have used same year number)
              xtset disid year
              panel variable: disid (strongly balanced)
              time variable: year, 2001 to 2020, but with gaps
              delta: 1 unit

              . xtserial sharearable sharebarren
              no observations
              r(2000);


              When I changed the absolute year number to Year ID , the xtserial command gives result.
              xtset disid yearid
              panel variable: disid (strongly balanced)
              time variable: yearid, 1 to 5
              delta: 1 unit

              . xtserial sharearable sharebarren share_urbanpop shareofnonagriareainga populationdensitypersqkm gddplog

              Wooldridge test for autocorrelation in panel data
              H0: no first order autocorrelation
              F( 1, 26) = 34.847
              Prob > F = 0.0000
              Thank you for your suggestions.
              Radhika

              Comment


              • #8
                That's your answer. I don't get how 2001 to 2020 is every 5 years, but delta(1) which is the default doesn't match your gappy data. Sounds as if you have substantial autocorrelation, which is usually expected.

                Comment

                Working...
                X