Announcement

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

  • r2000 error when using xtreg

    Hi guys,

    I'm completely new here. I already encode the string variables. And there is no 'not zeroes' data. But it still said 'no observation;
    What should I do next?

    Thank you very much


  • #2
    You need to provide more information. Show us your xtset command and the xtreg command (the exact commands and output). Better yet, provide a sample of your dataset, e.g., by copying and pasting the result of

    Code:
    dataex

    Comment


    • #3
      Click image for larger version

Name:	284476931_1371620603347743_4127007555902624578_n.jpg
Views:	1
Size:	74.3 KB
ID:	1667569

      Click image for larger version

Name:	ccc.png
Views:	1
Size:	56.7 KB
ID:	1667570



      This is my data set.
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str6 Country int Year double(VNDCHF USDCHF JPYCHF AUDCHF Inflation Interestrate Publicdebtborrowing BalanceofPayment) long country1
      "France" 2001 1.50855  .6026 1.3171 1.9585 1.634 4.88  58.3         21694720000 1
      "France" 2002 1.53467   .724 1.1879 1.7829 1.943 4.44  60.3         17180850000 1
      "France" 2003 1.56975  .8064 1.0744 1.3304 2.099 4.64  64.4         15397160000 1
      "France" 2004 1.58056  .8787 1.0244 1.2789 2.142 4.87  65.9         11278950000 1
      "France" 2005 1.58253  .7613   1.18 1.3637 1.746 2.85  67.4          2281820000 1
      "France" 2006 1.60316  .8207 1.1911 1.2675 1.676 3.73  64.6          5874250000 1
      "France" 2007 1.59648  .8822 1.1137  1.142 1.487  4.6  64.5         -2707790000 1
      "France" 2008 1.74902  .9373  .9055 1.4199 2.817 5.62  68.8        -2.02827e+10 1
      "France" 2009 1.84911  .9657  .9297 1.1163  .091 7.36    83        -1.47944e+10 1
      "France" 2010 1.94479 1.0712  .8123  .9789 1.531 5.52  85.3 -16614900000.000002 1
      "France" 2011 2.08356 1.0666  .7698  .9767 2.111 5.05  87.8        -2.45996e+10 1
      "France" 2012 2.08068 1.0923  .8681  .9633 1.956 5.03  90.6        -2.59021e+10 1
      "France" 2013 2.11164 1.1201 1.0533 1.1242  .864    5  93.4         -1.4333e+10 1
      "France" 2014 2.14061 1.0059 1.1971 1.2253  .508 5.46  94.9         -2.7271e+10 1
      "France" 2015 2.24921  .9982 1.2034 1.3733  .037 4.91  95.6         -8976630000 1
      "France" 2016 2.27747  .9825 1.1692 1.3866  .183 5.11    98        -1.20173e+10 1
      "France" 2017 2.27215 1.0264  1.127 1.2816 1.033    5  98.1        -1.98533e+10 1
      "France" 2018 2.32009  1.019 1.0959 1.4213  1.85    5  97.8        -2.31824e+10 1
      "France" 2019 2.31753 1.0333 1.0864 1.4255 1.109 4.75  97.4         -7931960000 1
      "France" 2020 2.30916 1.1298 1.0327 1.3005  .479 3.75 114.6        -4.98358e+10 1
      "France" 2021 2.28851 1.0963  1.151 1.3786 1.642    4 112.9         -1.7197e+10 1
      end
      label values country1 country1
      label def country1 1 "France", modify

      Earlier I used code Country, gen(CountryName)
      and then used xtset.
      Last edited by Lexi Tran; 02 Jun 2022, 22:37.

      Comment


      • #4
        Lexi:
        what happened here is clear.
        You have one -panelid- only; hence, the -re- estimator has nothing to compare -France- to.
        Conversely, -regress- works (as expected):
        Code:
        . xtset country1 Year
        
        Panel variable: country1 (strongly balanced)
         Time variable: Year, 2001 to 2021
                 Delta: 1 unit
        
        . xtreg BalanceofPayment VNDCHF
        no observations
        r(2000);
        
        . regress BalanceofPayment
        
              Source |       SS           df       MS      Number of obs   =        21
        -------------+----------------------------------   F(0, 20)        =      0.00
               Model |           0         0           .   Prob > F        =         .
            Residual |  6.1715e+21        20  3.0858e+20   R-squared       =    0.0000
        -------------+----------------------------------   Adj R-squared   =    0.0000
               Total |  6.1715e+21        20  3.0858e+20   Root MSE        =    1.8e+10
        
        ------------------------------------------------------------------------------
        BalanceofP~t | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
               _cons |  -1.01e+10   3.83e+09    -2.63   0.016    -1.81e+10   -2.09e+09
        ------------------------------------------------------------------------------
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Ah okay, I got it. Thank you so much.
          Best wishes

          Comment

          Working...
          X