Announcement

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

  • xttest2 error

    Hello Everyone, I am very new to this forum. Can someone help me understand what is meant by "id contains all missing values" after I try to run xttest2 command post fixed effect panel data estimation?

    Thanks

  • #2
    Muhammad:
    welcome to this forum.
    Can you please provide an excerpt of your data via -dataex-? Thanks.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      my depvar is the analyst earning forecast and independent variables are sustainability disclosures. After I run xtreg command and want to check the heteroscedasticity using xttest2 command, it ends up given me the above message "id contains all missing values". I have a panel data of 1000 firm and 10 years

      Comment


      • #4
        Muhammad:
        unfortunately, your reply does not help (as it simply repeats your original post).
        In order to reply positively, interested listers need an excerpt of your dataset, that you can easily share via -dataex- (see the FAQ). Thanks.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          ----------------------- copy starting from the next line -----------------------
          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input float anlyst_forecst double(sustainability_disclosure debtratio growth) float std_eps byte(income_dummy accr_dummy)
           -6.803365   45.8678   26.7264   1.509    -.02368774    0   0
           -8.547086   45.8678   27.3043   2.4389   -.000497779  0  0
          -3.6361446   47.1074   25.1583  2.5694    -.04642062   0  0
          -4.0381246   47.9339   21.9127  2.2651    -.06602131   0  0
           -6.207424   49.1736   19.9795   2.881     -.09844453    0  0
           -5.529303   52.0661   13.9837   3.6454    -.12063578   0  0
           -6.413352   52.0661    8.8832    3.3744   -.15106943    0  0
           -6.908496   54.5455    4.2557    3.2807   -.20863007    0  0
           -6.015598   54.5455   14.0631   3.269   -.07362349      0  0
           -6.199669   55.7851   16.038    3.0773   .032693733    0  0
          end
          ------------------ copy up to and including the previous line ------------------

          Sorry for not understanding your reply earlier. above is a snapshot of my data.

          Comment


          • #6
            Muhammad:
            your data excerpt contains neither -panelid-, not -timevar-.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Click image for larger version

Name:	data.png
Views:	1
Size:	23.3 KB
ID:	1540987

              data snapshot with panel ID and timevar

              Comment


              • #8
                Muhammad:
                please use -dataex- and do not post snapshots (as they cannot be imported in Stata: see the FAQ). Thanks.
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Code:
                  * Example generated by -dataex-. To install: ssc install dataex
                  clear
                  input int(id year) float lSAFDMN double ESGDS float lmkt_cap double(debtratio growth) byte accr_dummy
                  1 2008  -6.688936 45.8678  9.437925 26.7264   1.509 0
                  1 2009  -8.547086 45.8678  9.948018 27.3043  2.4389 0
                  1 2010  -3.583029 47.1074 10.098296 25.1583  2.5694 0
                  1 2011 -4.1064234 47.9339 10.038377 21.9127  2.2651 0
                  1 2012  -6.207424 49.1736 10.388698 19.9795   2.881 0
                  1 2013   -5.63413 52.0661 10.775767 13.9837  3.6454 0
                  1 2014  -6.570342 52.0661  10.70937  8.8832  3.3744 0
                  1 2015   -7.20552 54.5455 10.718452  4.2557  3.2807 0
                  1 2016  -6.168559 54.5455 10.787292 14.0631   3.269 0
                  1 2017  -6.366381 55.7851  10.91269  16.038  3.0773 0
                  1 2018  -6.113925 56.6116 10.712942 14.5495  2.4348 0
                  2 2008  -8.078518 45.0413 11.182167 31.0027  4.9569 0
                  2 2009  -6.825927 45.0413 11.485608 26.6831  5.2945 0
                  2 2010  -6.555204 51.2397 11.449863 22.4206  4.5526 0
                  2 2011  -7.716445 44.6281 11.540508 28.6117  5.2252 1
                  2 2012  -8.326544 45.0413 11.645902 21.8559  5.2765 0
                  2 2013  -6.586661 44.6281 11.710827 24.6127  5.7873 0
                  2 2014  -9.028967 43.3884 11.692586 25.7605  6.7443 0
                  2 2015 -10.116213 45.0413 11.784854 28.2841  7.4911 0
                  2 2016  -9.903992 49.1736 11.718232 29.0808  6.7806 0
                  2 2017  -9.365346 57.0248 12.020264 40.2803  9.4913 0
                  2 2018   -5.92065 58.2645 11.946473 41.6375 10.7082 0
                  end
                  Sorry again Carlo. I am very new to this forum.

                  Comment


                  • #10
                    Muhammad:
                    thanks for reposting using -dataex-.
                    Assuming that I got yiur dependent variable right, I cannot reproduce your problem:
                    Code:
                    . xtset id year
                           panel variable:  id (strongly balanced)
                            time variable:  year, 2008 to 2018
                                    delta:  1 unit
                    
                    . xtreg ESGDS lSAFDMN lmkt_cap debtratio growth accr_dummy, fe
                    
                    Fixed-effects (within) regression               Number of obs     =         22
                    Group variable: id                              Number of groups  =          2
                    
                    R-sq:                                           Obs per group:
                         within  = 0.6348                                         min =         11
                         between = 1.0000                                         avg =       11.0
                         overall = 0.0050                                         max =         11
                    
                                                                    F(5,15)           =       5.21
                    corr(u_i, Xb)  = -0.8845                        Prob > F          =     0.0057
                    
                    ------------------------------------------------------------------------------
                           ESGDS |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                         lSAFDMN |   .4674023    .529352     0.88   0.391    -.6608848    1.595689
                        lmkt_cap |   8.470877   4.402457     1.92   0.074     -.912738    17.85449
                       debtratio |   .1430426   .2039205     0.70   0.494    -.2916036    .5776889
                          growth |   .6393801   1.136916     0.56   0.582    -1.783899     3.06266
                      accr_dummy |  -1.855631   3.620023    -0.51   0.616    -9.571527    5.860266
                           _cons |  -46.84248   48.34504    -0.97   0.348    -149.8875    56.20254
                    -------------+----------------------------------------------------------------
                         sigma_u |  11.679862
                         sigma_e |  3.2730373
                             rho |  .92718935   (fraction of variance due to u_i)
                    ------------------------------------------------------------------------------
                    F test that all u_i=0: F(1, 15) = 13.19                      Prob > F = 0.0025
                    
                    . xttest2
                     
                    Correlation matrix of residuals:
                    
                             __e1     __e2
                    __e1   1.0000
                    __e2  -0.0530   1.0000
                    
                    Breusch-Pagan LM test of independence: chi2(1) =     0.031, Pr = 0.8604
                    Based on 11 complete observations
                    
                    .
                    Kind regards,
                    Carlo
                    (StataNow 18.5)

                    Comment


                    • #11
                      Carlo, thanks for responding. My depvar is (analysts' earning forecast mean) lSAFDMN. I tried the same process that you did with (lSAFDMN) as depvar, it worked fine. however, I am still facing the same problem with the larger dataset. I wonder if the missing values in the data has something to do with the error. ( "id contains all missing values").

                      Comment


                      • #12
                        Muhammad:
                        in all likelihood, the missing data are the culprits there.
                        But I cannot get how you could run -xtreg- with no problem if you -panelid- has all missing values.
                        Kind regards,
                        Carlo
                        (StataNow 18.5)

                        Comment


                        • #13
                          Carlo. All the regressions work fine. I can execute xttest3 without any problem. I did some data cleaning by drop panels that have 3 or fewer observations. however now I am getting the following error. "Error: too few common observations across panel. no observations r(2000).

                          Comment


                          • #14
                            Muhammad:
                            the warning message is simply the consequence of your data cleaning.
                            Kind regards,
                            Carlo
                            (StataNow 18.5)

                            Comment


                            • #15
                              Carlo. I did not get your point.

                              Comment

                              Working...
                              X