Announcement

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

  • Problems with Panel Data Analysis

    Hello everyone,

    I'm dealing with panel data analysis and still confused about few things
    I have a type of panel data that i considered as short panel because it consist of large n and small t, which is 74 corporation for period of 2016-2018 in Indonesia. I'm working with causality type of research to test a topic called intellectual capital. So here is my questions:
    1. In case of short panel data, is it allowed to do fixed effect model particulary LSDV model as i have many cross-section number? some said that it will decrease degree of freedom and will suffer from biased estimation especially when i only have 3 years of observation. What considered as sufficient and too small degree of freedom in case of LSDV?
    2. Is it necessary to do F-test/Chow test to compare between pooled ols and fixed effect model for this type of panel data? because as far as i know, f test is basically testing the dummy variable for unobserved individual effect or time effect that belong to LSDV.
    3. I considered there are one way effect model and two way effect model. How to decided which one is more appropriate for my model? and in case of one way effect model, how to decide between individual effect and time effect model, what should be my consideration?
    4. for another estimation model as random effect and pooled ols, Does it generate biased parameter estimation if i choose to use my current data? if not, what should i do?
    5. Could you suggest a reference or formal way to test outliers for my data in stata? and does it affect my parameter of estimation in panel data analysis?

    For now that's everything i really try to figure out,
    please considered to reference any book to furthermore reading.
    Thank you.

  • #2
    Samuel:
    welcome to this forum.
    Most of your (many) questions find an answer in: https://www.stata.com/bookstore/micr...metrics-stata/
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you Carlo for your recommendation,
      i'm really sorry if you considered my questions is too much, i just tried to make it clear please take my apologize.
      I've read chapter 8-9 of that book and still couldn't find out some answer. Maybe you could give some advices or corrections for things i've been working on.

      I'm still confused about some steps in analyze the panel data. As far as i know, the first step to have a good estimator for panel data regression after preparing my data (assume that i have a appropriate theory for my variables) is to choose a best model between pooled OLS, fixed effect and random effect by doing some test like the F test, Breusch-Pagan LM test, and Hausman Test. Is it correct? because i've read jeffrey wooldridge book's "Econometrics Introductory" (2018) eventhough he talk about some F test i couldn't find that he suggesting to do F-test to compare fixed effect to pooled OLS. should i keep doing it?

      Here are my steps for doing the F-test, please do some corrections if you find me doing or assuming the wrong informations or steps.
      1. First i try to regress my model by doing this command reg Y X1 X2 i.id i.Year
      2. Second i do the command testparm i.id i.year
      I have 74 observation for 3 years periods (2016-2018)
      should i include year dummy in my model? what should be my considerations?

      here i include my tests in stata
      Code:
      reg Y X1 X2 i.id i. year
      
            Source |       SS           df       MS      Number of obs   =       222
      -------------+----------------------------------   F(77, 144)      =     11.38
             Model |  6756.90848        77  87.7520581   Prob > F        =    0.0000
          Residual |  1109.98134       144  7.70820376   R-squared       =    0.8589
      -------------+----------------------------------   Adj R-squared   =    0.7835
             Total |  7866.88982       221  35.5967865   Root MSE        =    2.7764
      
      ------------------------------------------------------------------------------
                 Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                X1 |   .8808422     .10688     8.24   0.000     .6695858    1.092099
                X2 |   16.65939    6.37514     2.61   0.010     4.058442    29.26033
                   |
             id |
             APLN  |   .2947118   2.302428     0.13   0.898    -4.256211    4.845634
             ASDM  |   1.050584   2.376494     0.44   0.659    -3.646734    5.747902
             ASII  |     2.8694   2.556869     1.12   0.264    -2.184443    7.923243
                  |
             year |
             2017  |  -.5542752   .4602082    -1.20   0.230    -1.463911    .3553607
             2018  |  -2.224763   .4655801    -4.78   0.000    -3.145017   -1.304509
                   |
             _cons |  -1.037165   1.647902    -0.63   0.530    -4.294368    2.220038
      ------------------------------------------------------------------------------
      
      . testparm i.id i.year
      
       ( 1)  2.id = 0
       ( 2)  3.id = 0
       ( 3)  4.id = 0
       ( 4)  5.id = 0
      
       (74)  2017.year = 0
       (75)  2018.year = 0
      
             F( 75,   144) =    2.57
                  Prob > F =    0.0000
      Last edited by Samuel Renhoar; 21 May 2020, 03:03.

      Comment


      • #4
        Samuel:
        basically, you have performed a fixed effect regression via -regress-.
        That said, I think you would be better off starting from -xtreg,fe-.
        I would include -i.time-.
        As per you description and Stata output (that makes things clearer. Thank you for that), your code should be:
        Code:
         xtset id year
        xtreg Y X1 X2  i. year, fe
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you Carlo,

          The reason why i used regress instead of xtreg is because i read and followed the suggestions by Das Panchanan in his book "Econometrics in Theory and Practice" (2019).
          He said that regress command with dummy variables is another way to do fixed effect model or considered as LSDV and -xtreg, fe-. is considered as within model.
          Because i assumed that F-test (testparm) is a proper test to analyze the effect of dummy variables in fe model over pooled OLS or a comparisons between restriced model against unrestricted model, so i used that command. is it a correct conclusions that i made?

          But, thank you carlo, i just know that i could do testparm command over xtreg, fe command.

          so after your suggestion here is my result.
          Code:
          . xtset id year
                 panel variable:  id (strongly balanced)
                  time variable:  year, 2016 to 2018
                          delta:  1 unit
          
          . xtreg Y X1 X2 i.year, fe
          
          Fixed-effects (within) regression               Number of obs     =        222
          Group variable: id                            Number of groups  =         74
          
          R-sq:                                           Obs per group:
               within  = 0.5916                                         min =          3
               between = 0.6470                                         avg =        3.0
               overall = 0.6243                                         max =          3
          
                                                          F(4,144)          =      52.15
          corr(u_i, Xb)  = 0.1511                         Prob > F          =     0.0000
          
          ------------------------------------------------------------------------------
                     Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                    X1 |   .8808422     .10688     8.24   0.000     .6695858    1.092099
                    X2 |   16.65939    6.37514     2.61   0.010     4.058442    29.26033
                       |
                 year |
                 2017  |  -.5542752   .4602082    -1.20   0.230    -1.463911    .3553607
                 2018  |  -2.224763   .4655801    -4.78   0.000    -3.145017   -1.304509
                       |
                 _cons |  -.1550369   .7580359    -0.20   0.838    -1.653352    1.343278
          -------------+----------------------------------------------------------------
               sigma_u |  2.9370361
               sigma_e |  2.7763652
                   rho |  .52809954   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          F test that all u_i=0: F(73, 144) = 2.33                     Prob > F = 0.0000
          
          . testparm i.id i.year
          
           ( 1)  2017.Tahun = 0
           ( 2)  2018.Tahun = 0
          
                 F(  2,   144) =   12.33
                      Prob > F =    0.0000
          but i'm still wondering. is it the same result with my previous result and have the same inference? because based on my previous result my F is (75, 144) and now i only have (2, 144) and have a different F value despite my prob. is still the same. (and by the way, should i just use -testparm i.id i.year- or just -testparm i.year- even both result the same number.

          and just to make it clear, can i inference this result as F-test (to compare between restricted model and unrestricted model)?

          last but not least. Based on my data, should i use vce(robust) after fe command or not? because in some posts in this forum i saw some people suggested it to get a correct standard error,
          thank you.

          Comment


          • #6
            Samuel:
            1) as you can see, you got the same coefficients and standard errors from -regress- and -xtreg,fe- (set aside -_cons- which is not Worth considering under -xtreg,fe-). The latter (which is not the same F-test that appears in the top-right corner of -regress- and -xtreg,fe- outcome) tells you also that you have panel-wise effect (F test that all u_i: Prob > F = 0.0000).
            2) I would also run -xtreg,re- and than compare the two specifications via -hausman-.
            3) using cluster-robust standard errors is conditional on having detected heteroskeadstcity and/or autocorrelation.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              oh, I just realized and saw that at the bottom of my table there is a line after using xtreg, fe command.

              Code:
              F test that all u_i=0: F(73, 144) = 2.33                     Prob > F = 0.0000
              is it the F test for cross-section or individual effect? and base on prob result (0.0000), i should conclude that my dummy variable or individual effect is not zero to reject the null hypotesis of F-test/chow test?
              is that a correct inferences?

              and this result is a result for time-effect only?

              Code:
              . testparm i.Tahun
              
               ( 1)  2017.Tahun = 0
               ( 2)  2018.Tahun = 0
              
                     F(  2,   144) =   12.33
                          Prob > F =    0.0000
              so that is why my testparm showing the different format result (this one and my previous one)
              is it because the first one (my previous test) is a wrong way to do testparm, so it represented only by one number
              F( 75, 144) = 2.57 Prob > F = 0.0000 for both i.id and i.year testparm? (hope you could understand what i'm trying to said)

              is that a correct conclusion?
              Last edited by Samuel Renhoar; 21 May 2020, 09:02.

              Comment


              • #8
                Samuel:
                the F-test you mention shows evidence of panel-wise effect (not time).
                Your -testparm- should check whether -i.year- is jointly statistical significant.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  Carlo:

                  for your statemet number 1:
                  what does it (set aside -_cons- which is not Worth considering under -xtreg,fe-) mean? is it mean that i don't have to use my constant for fe model?

                  for your statement number 2:
                  as my result shows that i have a significant effect (for both individiual and time effect), is it mean that i should include time dummies in my model for re model before i do the hausman test?

                  Code:
                  . xtreg Y X1 X2 i.year, fe
                  
                  Fixed-effects (within) regression               Number of obs     =        222
                  Group variable: id                      Number of groups  =         74
                  
                  R-sq:                                           Obs per group:
                       within  = 0.5916                                         min =          3
                       between = 0.6470                                         avg =        3.0
                       overall = 0.6243                                         max =          3
                  
                                                                  F(4,144)          =      52.15
                  corr(u_i, Xb)  = 0.1511                         Prob > F          =     0.0000
                  
                  ------------------------------------------------------------------------------
                             Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                            X1 |   .8808422     .10688     8.24   0.000     .6695858    1.092099
                            X2 |   16.65939    6.37514     2.61   0.010     4.058442    29.26033
                               |
                         year |
                         2017  |  -.5542752   .4602082    -1.20   0.230    -1.463911    .3553607
                         2018  |  -2.224763   .4655801    -4.78   0.000    -3.145017   -1.304509
                               |
                         _cons |  -.1550369   .7580359    -0.20   0.838    -1.653352    1.343278
                  -------------+----------------------------------------------------------------
                       sigma_u |  2.9370361
                       sigma_e |  2.7763652
                           rho |  .52809954   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  F test that all u_i=0: F(73, 144) = 2.33                     Prob > F = 0.0000
                  
                  . est sto fe
                  
                  . xtreg Y X1 X2 i.year, re
                  
                  Random-effects GLS regression                   Number of obs     =        222
                  Group variable: Kode                            Number of groups  =         74
                  
                  R-sq:                                           Obs per group:
                       within  = 0.5808                                         min =          3
                       between = 0.7509                                         avg =        3.0
                       overall = 0.6921                                         max =          3
                  
                                                                  Wald chi2(4)      =     416.22
                  corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                  
                  ------------------------------------------------------------------------------
                             Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                  -------------+----------------------------------------------------------------
                            X1 |   .7108377   .0688315    10.33   0.000     .5759304    .8457449
                            X2 |   28.54182   2.223696    12.84   0.000     24.18345    32.90018
                               |
                         year |
                         2017  |  -.6259327    .461274    -1.36   0.175    -1.530013    .2781477
                         2018  |  -2.147511   .4629261    -4.64   0.000    -3.054829   -1.240193
                               |
                         _cons |  -.8966768   .5545116    -1.62   0.106      -1.9835    .1901459
                  -------------+----------------------------------------------------------------
                       sigma_u |  1.8382725
                       sigma_e |  2.7763652
                           rho |  .30478115   (fraction of variance due to u_i)
                  ------------------------------------------------------------------------------
                  
                  . est sto re
                  
                  . hausman fe re
                  
                                   ---- Coefficients ----
                               |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
                               |       fe           re         Difference          S.E.
                  -------------+----------------------------------------------------------------
                            X1 |    .8808422     .7108377        .1700045        .0817653
                            X2 |    16.65939     28.54182       -11.88243        5.974746
                         year |
                         2017  |   -.5542752    -.6259327        .0716574               .
                         2018  |   -2.224763    -2.147511       -.0772518        .0496419
                  ------------------------------------------------------------------------------
                                             b = consistent under Ho and Ha; obtained from xtreg
                              B = inconsistent under Ha, efficient under Ho; obtained from xtreg
                  
                      Test:  Ho:  difference in coefficients not systematic
                  
                                    chi2(4) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                            =        4.73
                                  Prob>chi2 =      0.3166
                                  (V_b-V_B is not positive definite)
                  is it a correct way to do the hausman test? i also do hausman test without including the year dummies the result also suggested that i should use random effect model. But, for this model (consist of time dummies) i've got this line "(V_b-V_B is not positive definite)" what does it mean and what should i do about it?

                  for your statement number 3:
                  could you help me or give a reference to do a proper test for heterocedasticity and/or autocorrelation for my case? i'm really new in stata, but i did once in spss for heterocedasticity and it proved that i have an issue with heterocedasticity.

                  thank you.
                  Last edited by Samuel Renhoar; 22 May 2020, 05:01.

                  Comment


                  • #10
                    Samuel:
                    1) see https://www.stata.com/support/faqs/s...ffects-model/;
                    2) yes, you should include -i.year- among the set of predictors in both -fe- and -re- specifications and then compare them via -hausman-;
                    3) wht you experienced is a frequent nuisance of -hausman- outcome. You can give it a try with the community-contributed programme -xtoverid- (just type -search -xtoverid- to spot and install it).
                    -xtoverid- needs only -re- specification to be assesses and, being a bit old-fashioned, does not support -fvvarlist- notation (the usual fix is to prefix your -xtreg,re- code with -xi:-) but, unlike -hausman- allows non-default standard errors:
                    Code:
                    xi: xtreg Y X1 X2 i.year, re
                    xtoverid
                    4) heteroskedastcicity can be visually checked:
                    Code:
                    xtreg Y X1 X2 i.year, re
                    predict fitted, xb
                    predict residual, e
                    twoway (scatter residual  fitted)
                    If you detect/suspect heteroskedasticity, just invoke -robust- or cluster()- which, in addition to doing the very same job in -xtreg-, can deal both with heteroskedasticity and/or autocorrelation; the latter can be diagnosed with the community-contributed programme -xtserial- by Jeff Wooldridge:
                    Code:
                    xi: xtserial Y X1 X2 i.year
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Carlo:

                      1. After i read your suggestion, i couldn't conclude anything but the constant produce by xtreg, fe is the average value of fixed effect(v) for all i.
                      So in order to have a good model for fixed effect, should i include constant in my model or not? how to set aside const from the fixed effect model? and if i want to keep in my model, how to inference that constant?
                      2. When i'm trying to do xtoverid i've got these errors
                      Code:
                      search xtoverid
                       
                      . xtreg Y X1 X2 i.year, re
                       
                      Random-effects GLS regression                   Number of obs     =        222
                      Group variable: id                            Number of groups  =         74
                       
                      R-sq:                                           Obs per group:
                           within  = 0.5808                                         min =          3
                           between = 0.7509                                         avg =        3.0
                           overall = 0.6921                                         max =          3
                       
                                                                      Wald chi2(4)      =     416.22
                      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                       
                      ------------------------------------------------------------------------------
                                 Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                                X1 |   .7108377   .0688315    10.33   0.000     .5759304    .8457449
                                X2 |   28.54182   2.223696    12.84   0.000     24.18345    32.90018
                                   |
                             year |
                             2017  |  -.6259327    .461274    -1.36   0.175    -1.530013    .2781477
                             2018  |  -2.147511   .4629261    -4.64   0.000    -3.054829   -1.240193
                                   |
                             _cons |  -.8966768   .5545116    -1.62   0.106      -1.9835    .1901459
                      -------------+----------------------------------------------------------------
                           sigma_u |  1.8382725
                           sigma_e |  2.7763652
                               rho |  .30478115   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                       
                      . xtoverid
                      Error - must have ivreg2/ivreg29/ivreg28 version 2.1.15 or greater installed
                      r(601);
                      so i try to find ivreg2 and install those files, but i've got these errors

                      Code:
                      . search ivreg2
                       
                      . xtreg Y X1 X2 i.year, re
                       
                      Random-effects GLS regression                   Number of obs     =        222
                      Group variable: id                            Number of groups  =         74
                       
                      R-sq:                                           Obs per group:
                           within  = 0.5808                                         min =          3
                           between = 0.7509                                         avg =        3.0
                           overall = 0.6921                                         max =          3
                       
                                                                      Wald chi2(4)      =     416.22
                      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                       
                      ------------------------------------------------------------------------------
                                 Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                                X1 |   .7108377   .0688315    10.33   0.000     .5759304    .8457449
                                X2 |   28.54182   2.223696    12.84   0.000     24.18345    32.90018
                                   |
                             year |
                             2017  |  -.6259327    .461274    -1.36   0.175    -1.530013    .2781477
                             2018  |  -2.147511   .4629261    -4.64   0.000    -3.054829   -1.240193
                                   |
                             _cons |  -.8966768   .5545116    -1.62   0.106      -1.9835    .1901459
                      -------------+----------------------------------------------------------------
                           sigma_u |  1.8382725
                           sigma_e |  2.7763652
                               rho |  .30478115   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                       
                      . xtoverid
                      2016b:  operator invalid
                      r(198);
                      when you said that there's a nuisance over my hausman test, does it mean that my hausman test is not reliable? and for xtoverid, can i treat and assumed it as hausman test?

                      3. I've got an error when i tried to do hetero test

                      Code:
                      . xtreg  Y X1 X2 i.year, re
                      
                      Random-effects GLS regression                   Number of obs     =        222
                      Group variable: id                            Number of groups  =         74
                      
                      R-sq:                                           Obs per group:
                           within  = 0.5808                                         min =          3
                           between = 0.7509                                         avg =        3.0
                           overall = 0.6921                                         max =          3
                      
                                                                      Wald chi2(4)      =     416.22
                      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                      
                      ------------------------------------------------------------------------------
                                 Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                                X1 |   .7108377   .0688315    10.33   0.000     .5759304    .8457449
                                X2 |   28.54182   2.223696    12.84   0.000     24.18345    32.90018
                                   |
                             year |
                             2017  |  -.6259327    .461274    -1.36   0.175    -1.530013    .2781477
                             2018  |  -2.147511   .4629261    -4.64   0.000    -3.054829   -1.240193
                                   |
                             _cons |  -.8966768   .5545116    -1.62   0.106      -1.9835    .1901459
                      -------------+----------------------------------------------------------------
                           sigma_u |  1.8382725
                           sigma_e |  2.7763652
                               rho |  .30478115   (fraction of variance due to u_i)
                      ------------------------------------------------------------------------------
                      
                      . predict, xb
                      (option xb assumed; fitted values)
                      varlist required
                      r(100);
                      for xtserial which one should i choose?

                      st0592 from http://www.stata-journal.com/software/sj20-1

                      st0039 from http://www.stata-journal.com/software/sj3-2

                      xtserial from http://www.stata.com/users/ddrukker

                      abar from http://fmwww.bc.edu/RePEc/bocode/a

                      xtserialpm from http://fmwww.bc.edu/RePEc/bocode/x
                      Last edited by Samuel Renhoar; 24 May 2020, 01:31.

                      Comment


                      • #12
                        Carlo:
                        i'm sorry Carlo, seems like i put a wrong syntax for hetero test, and this the result i produce after input the right one:
                        Click image for larger version

Name:	twoway residual fitted.png
Views:	1
Size:	67.3 KB
ID:	1554914

                        how to detect any heterocedasticty problem over this graph? and what do you think about should i write heterocedasticty test in my paper eventhough i'm using panel data analysis?

                        Comment


                        • #13
                          Samuel:
                          1) your graph shows evidence of heteroskedasticity (in your paper you can say that you visually inspected the idiosincratic residual distribution vs fitted and detected heteroskedasticity): hence, cluster your standard errors on panelid (this way your standard errors will take also autocorrelation into account, if any);
                          2) -predict, xb- should have been:
                          Code:
                          predict fitted, xb
                          3) what if:
                          Code:
                          xi: xtreg Y X1 X2 i.year, re
                          xtoverid
                          4) -xtserial-: (SJ3-2: st0039);
                          5) nuisance in -hausman- test: I meant
                          Code:
                          (V_b-V_B is not positive definite)
                          Kind regards,
                          Carlo
                          (Stata 19.0)

                          Comment


                          • #14
                            [Sorry; wrong thread.]
                            Last edited by Nick Cox; 24 May 2020, 03:54.

                            Comment


                            • #15
                              Carlo:
                              1. Is it a correct way? but why the F test line at the bottom of previuos xtreg, fe (without vce (cluster id))is disappear?
                              Code:
                              . xtreg Y X1 X2 i.year, fe vce(cluster id)
                              
                              Fixed-effects (within) regression               Number of obs     =        222
                              Group variable: id                            Number of groups  =         74
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.5916                                         min =          3
                                   between = 0.6470                                         avg =        3.0
                                   overall = 0.6243                                         max =          3
                              
                                                                              F(4,73)           =     100.72
                              corr(u_i, Xb)  = 0.1511                         Prob > F          =     0.0000
                              
                                                                (Std. Err. adjusted for 74 clusters in Kode)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                         Y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                        X1 |   .8808422   .1626354     5.42   0.000     .5567103    1.204974
                                        X2 |   16.65939   13.84521     1.20   0.233    -10.93408    44.25285
                                           |
                                     year |
                                     2017  |  -.5542752   .3520155    -1.57   0.120    -1.255841    .1472906
                                     2018  |  -2.224763    .567658    -3.92   0.000    -3.356104   -1.093422
                                           |
                                     _cons |  -.1550369   1.315367    -0.12   0.906    -2.776559    2.466485
                              -------------+----------------------------------------------------------------
                                   sigma_u |  2.9370361
                                   sigma_e |  2.7763652
                                       rho |  .52809954   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              this is for my re model. Should i use (cluster id) as well?

                              Code:
                              . xtreg Y X1 X2 i.year, re vce(cluster id)
                              
                              Random-effects GLS regression                   Number of obs     =        222
                              Group variable: id                            Number of groups  =         74
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.5808                                         min =          3
                                   between = 0.7509                                         avg =        3.0
                                   overall = 0.6921                                         max =          3
                              
                                                                              Wald chi2(4)      =     224.45
                              corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                              
                                                                (Std. Err. adjusted for 74 clusters in id)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                         Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                        X1 |   .7108377   .1066756     6.66   0.000     .5017573    .9199181
                                        X2 |   28.54182   3.993661     7.15   0.000     20.71438    36.36925
                                           |
                                     year |
                                     2017  |  -.6259327   .3506201    -1.79   0.074    -1.313136    .0612702
                                     2018  |  -2.147511   .5524324    -3.89   0.000    -3.230259   -1.064763
                                           |
                                     _cons |  -.8966768   .5696678    -1.57   0.115    -2.013205    .2198515
                              -------------+----------------------------------------------------------------
                                   sigma_u |  1.8382725
                                   sigma_e |  2.7763652
                                       rho |  .30478115   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              2. i'm sorry Carlo i didn't know that xi is a part of the syntax. Here is my result for xtoverid. (I also use cluster id for this estimation, is it right?)

                              Code:
                               xi: xtreg Y X1 X2 i.year re vce(cluster id)
                              i.year           _Iyear_2016-2018   (naturally coded; _Iyear_2016 omitted)
                              
                              Random-effects GLS regression                   Number of obs     =        222
                              Group variable: Kode                            Number of groups  =         74
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.5808                                         min =          3
                                   between = 0.7509                                         avg =        3.0
                                   overall = 0.6921                                         max =          3
                              
                                                                              Wald chi2(4)      =     224.45
                              corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
                              
                                                                (Std. Err. adjusted for 74 clusters in Kode)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                         Y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                        X1 |   .7108377   .1066756     6.66   0.000     .5017573    .9199181
                                        X2 |   28.54182   3.993661     7.15   0.000     20.71438    36.36925
                              _Iyear_2017 |  -.6259327   .3506201    -1.79   0.074    -1.313136    .0612702
                              _Iyear_2018 |  -2.147511   .5524324    -3.89   0.000    -3.230259   -1.064763
                                     _cons |  -.8966768   .5696678    -1.57   0.115    -2.013205    .2198515
                              -------------+----------------------------------------------------------------
                                   sigma_u |  1.8382725
                                   sigma_e |  2.7763652
                                       rho |  .30478115   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              
                              . xtoverid
                              
                              Test of overidentifying restrictions: fixed vs random effects
                              Cross-section time-series model: xtreg re  robust cluster(Kode)
                              Sargan-Hansen statistic  19.112  Chi-sq(4)    P-value = 0.0007
                              
                              Does it equal to hausman test and could be considered the same?
                              3. Here is mt xtserial test.

                              Code:
                              i.year           _Iyear_2016-2018   (naturally coded; _Iyear_2016 omitted)
                              
                              Wooldridge test for autocorrelation in panel data
                              H0: no first-order autocorrelation
                                  F(  1,      73) =      1.665
                                         Prob > F =      0.2010
                              4. Yes, (V_b-V_B is not positive definite) does it make my hausman doesn't reliable and i have to use xtoverid instead of hausman test?

                              Comment

                              Working...
                              X