Announcement

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

  • Hausman with Robust SE using Xtoverid

    Hello,

    I'm trying to Hausman test to know whether should I go with FE or RE. I have a strongly balanced paneldata from 1985-2020 with 210 countries. Using the same test with regular SE, the test stated that I need to go with FE, but I just realised that since I'm using Robust I need to re-do the test differently. I've been reading different answers here but my knowledge of stata is quite decent. I'm refering to this thread here. Problems with panel regression model (specifically xtoverid, predicor collinearity) - Statalist where Carlo Lazzaro mentioned that using xtoverid after xtreg with a xi: prefix worked and gave an example when I did that it says: xtoverid not compatible with xtreg model fe

    Code:
    . xi: xtreg PT RND_L1 LVG EX GI RER EDU i.year, fe
    i.year            _Iyear_1985-2020    (naturally coded; _Iyear_1985 omitted)
    note: _Iyear_1986 omitted because of collinearity.
    note: _Iyear_1987 omitted because of collinearity.
    note: _Iyear_1988 omitted because of collinearity.
    note: _Iyear_1989 omitted because of collinearity.
    note: _Iyear_1990 omitted because of collinearity.
    note: _Iyear_1991 omitted because of collinearity.
    note: _Iyear_1992 omitted because of collinearity.
    note: _Iyear_1993 omitted because of collinearity.
    note: _Iyear_1994 omitted because of collinearity.
    note: _Iyear_1995 omitted because of collinearity.
    note: _Iyear_1997 omitted because of collinearity.
    note: _Iyear_1999 omitted because of collinearity.
    note: _Iyear_2001 omitted because of collinearity.
    note: _Iyear_2020 omitted because of collinearity.
    
    Fixed-effects (within) regression               Number of obs     =        245
    Group variable: countryid                       Number of groups  =         19
    
    R-squared:                                      Obs per group:
         Within  = 0.3877                                         min =          1
         Between = 0.0325                                         avg =       12.9
         Overall = 0.0440                                         max =         22
    
                                                    F(27, 199)        =       4.67
    corr(u_i, Xb) = -0.3831                         Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
              PT | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
          RND_L1 |    2164.44   994.8114     2.18   0.031     202.7151    4126.165
             LVG |  -9.488715    53.6484    -0.18   0.860     -115.281     96.3036
              EX |  -2.33e-09   3.70e-10    -6.30   0.000    -3.06e-09   -1.60e-09
              GI |   2554.214   863.4114     2.96   0.003     851.6042    4256.824
             RER |   24.95778   235.7769     0.11   0.916     -439.984    489.8996
             EDU |   10.49908   12.47697     0.84   0.401    -14.10497    35.10313
     _Iyear_1986 |          0  (omitted)
     _Iyear_1987 |          0  (omitted)
     _Iyear_1988 |          0  (omitted)
     _Iyear_1989 |          0  (omitted)
     _Iyear_1990 |          0  (omitted)
     _Iyear_1991 |          0  (omitted)
     _Iyear_1992 |          0  (omitted)
     _Iyear_1993 |          0  (omitted)
     _Iyear_1994 |          0  (omitted)
     _Iyear_1995 |          0  (omitted)
     _Iyear_1996 |  -5405.357   1907.327    -2.83   0.005    -9166.523    -1644.19
     _Iyear_1997 |          0  (omitted)
     _Iyear_1998 |  -3318.004   1294.424    -2.56   0.011    -5870.552   -765.4558
     _Iyear_1999 |          0  (omitted)
     _Iyear_2000 |  -169.1396   1257.564    -0.13   0.893        -2649    2310.721
     _Iyear_2001 |          0  (omitted)
     _Iyear_2002 |  -23.07235   1211.534    -0.02   0.985    -2412.165     2366.02
     _Iyear_2003 |   609.2388   1164.741     0.52   0.602     -1687.58    2906.058
     _Iyear_2004 |   1467.008   1164.301     1.26   0.209     -828.943    3762.958
     _Iyear_2005 |   1622.623   1102.466     1.47   0.143    -551.3931    3796.638
     _Iyear_2006 |   712.6193   1070.734     0.67   0.506    -1398.822     2824.06
     _Iyear_2007 |   -240.958   1080.868    -0.22   0.824    -2372.382    1890.466
     _Iyear_2008 |  -715.8864   1062.045    -0.67   0.501    -2810.193     1378.42
     _Iyear_2009 |  -823.3625    1030.49    -0.80   0.425    -2855.445     1208.72
     _Iyear_2010 |   -314.233   988.0814    -0.32   0.751    -2262.686    1634.221
     _Iyear_2011 |   11.08194    971.878     0.01   0.991    -1905.419    1927.583
     _Iyear_2012 |    148.608   972.7466     0.15   0.879    -1769.606    2066.822
     _Iyear_2013 |   257.0631   941.4812     0.27   0.785    -1599.497    2113.623
     _Iyear_2014 |   74.81469   952.7257     0.08   0.937    -1803.919    1953.548
     _Iyear_2015 |   297.1804   947.8171     0.31   0.754    -1571.874    2166.235
     _Iyear_2016 |   235.1417   989.7107     0.24   0.812    -1716.525    2186.808
     _Iyear_2017 |   408.6665   942.6729     0.43   0.665    -1450.243    2267.576
     _Iyear_2018 |   501.8883   962.3841     0.52   0.603    -1395.891    2399.668
     _Iyear_2019 |   272.2076   1014.126     0.27   0.789    -1727.604    2272.019
     _Iyear_2020 |          0  (omitted)
           _cons |   7737.687   1651.332     4.69   0.000     4481.332    10994.04
    -------------+----------------------------------------------------------------
         sigma_u |  18137.871
         sigma_e |  1969.1221
             rho |  .98835113   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    F test that all u_i=0: F(18, 199) = 500.53                   Prob > F = 0.0000
    
    . xtoverid
    xtoverid not compatible with xtreg model fe
    r(198);

  • #2
    Anass:
    you should go -re- before -xtoverid-:
    Code:
     
     xi: xtreg PT RND_L1 LVG EX GI RER EDU i.year, re robust
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Carlo Lazzaro Appreciate the swift response.

      Correct me if I'm wrong but I do also need to run the regression with FE in order to compared both.

      I got this error here

      Code:
      . xi: xtreg PT RND_L1 LVG EX GI RER EDU i.year, re robust
      i.year            _Iyear_1985-2020    (naturally coded; _Iyear_1985 omitted)
      note: _Iyear_1986 omitted because of collinearity.
      note: _Iyear_1987 omitted because of collinearity.
      note: _Iyear_1988 omitted because of collinearity.
      note: _Iyear_1989 omitted because of collinearity.
      note: _Iyear_1990 omitted because of collinearity.
      note: _Iyear_1991 omitted because of collinearity.
      note: _Iyear_1992 omitted because of collinearity.
      note: _Iyear_1993 omitted because of collinearity.
      note: _Iyear_1994 omitted because of collinearity.
      note: _Iyear_1995 omitted because of collinearity.
      note: _Iyear_1997 omitted because of collinearity.
      note: _Iyear_1999 omitted because of collinearity.
      note: _Iyear_2001 omitted because of collinearity.
      note: _Iyear_2020 omitted because of collinearity.
      
      Random-effects GLS regression                   Number of obs     =        245
      Group variable: countryid                       Number of groups  =         19
      
      R-squared:                                      Obs per group:
           Within  = 0.0031                                         min =          1
           Between = 0.6000                                         avg =       12.9
           Overall = 0.6209                                         max =         22
      
                                                      Wald chi2(18)     =          .
      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =          .
      
                                   (Std. err. adjusted for 19 clusters in countryid)
      ------------------------------------------------------------------------------
                   |               Robust
                PT | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
            RND_L1 |   17109.42   11745.61     1.46   0.145    -5911.565     40130.4
               LVG |  -166.4556   309.7817    -0.54   0.591    -773.6165    440.7054
                EX |   4.92e-09   1.80e-09     2.73   0.006     1.39e-09    8.45e-09
                GI |  -2699.229   3522.035    -0.77   0.443     -9602.29    4203.832
               RER |  -2543.196   1692.742    -1.50   0.133     -5860.91    774.5181
               EDU |   36.77035   121.4416     0.30   0.762    -201.2508    274.7915
       _Iyear_1986 |          0  (omitted)
       _Iyear_1987 |          0  (omitted)
       _Iyear_1988 |          0  (omitted)
       _Iyear_1989 |          0  (omitted)
       _Iyear_1990 |          0  (omitted)
       _Iyear_1991 |          0  (omitted)
       _Iyear_1992 |          0  (omitted)
       _Iyear_1993 |          0  (omitted)
       _Iyear_1994 |          0  (omitted)
       _Iyear_1995 |          0  (omitted)
       _Iyear_1996 |   9073.366   8989.942     1.01   0.313    -8546.598    26693.33
       _Iyear_1997 |          0  (omitted)
       _Iyear_1998 |   6668.298   4459.438     1.50   0.135     -2072.04    15408.64
       _Iyear_1999 |          0  (omitted)
       _Iyear_2000 |   7714.836   5039.585     1.53   0.126    -2162.569    17592.24
       _Iyear_2001 |          0  (omitted)
       _Iyear_2002 |   6966.497   4432.918     1.57   0.116    -1721.862    15654.86
       _Iyear_2003 |   7659.207   5163.733     1.48   0.138    -2461.524    17779.94
       _Iyear_2004 |   6174.848   5459.067     1.13   0.258    -4524.727    16874.42
       _Iyear_2005 |   7209.546   5422.989     1.33   0.184    -3419.317    17838.41
       _Iyear_2006 |   5629.825   4824.798     1.17   0.243    -3826.606    15086.26
       _Iyear_2007 |   4636.724   4179.718     1.11   0.267    -3555.374    12828.82
       _Iyear_2008 |   3959.775   3504.611     1.13   0.259    -2909.135    10828.69
       _Iyear_2009 |   5985.834   3726.874     1.61   0.108    -1318.704    13290.37
       _Iyear_2010 |   3407.865     3473.2     0.98   0.326    -3399.482    10215.21
       _Iyear_2011 |   4101.819   3466.302     1.18   0.237    -2692.007    10895.65
       _Iyear_2012 |   2859.729   3079.886     0.93   0.353    -3176.737    8896.196
       _Iyear_2013 |   3922.392   3289.005     1.19   0.233    -2523.939    10368.72
       _Iyear_2014 |   2366.571    2768.99     0.85   0.393    -3060.549    7793.691
       _Iyear_2015 |   3885.789   3189.301     1.22   0.223    -2365.125     10136.7
       _Iyear_2016 |   2024.243   2879.009     0.70   0.482    -3618.511    7666.997
       _Iyear_2017 |   3815.154   3176.798     1.20   0.230    -2411.256    10041.56
       _Iyear_2018 |   449.2323   1390.125     0.32   0.747    -2275.362    3173.827
       _Iyear_2019 |  -922.6359   1018.422    -0.91   0.365    -2918.707    1073.435
       _Iyear_2020 |          0  (omitted)
             _cons |  -11713.33   5072.445    -2.31   0.021    -21655.14   -1771.523
      -------------+----------------------------------------------------------------
           sigma_u |          0
           sigma_e |  1969.1221
               rho |          0   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      
      . xtoverid
      o. operator not allowed
      r(101);

      Comment


      • #4
        Anass:
        the null of the community-contributed module -xtoverid- is: -re- is the way to go.
        If the null is rejected, you switch to -fe-, provided that -xtoverid- does not throw a message pointing you towards pooled OLS.
        The error you got is due to the fact that -xtoverid- does not support -fvvarlist- notation. In brief, you should get rid of the omitted variable(s) by hand.
        Eventually, I would say that your panel-wise effect is not apparent (sigma_u=0).
        What does -xttest0- after -xtreg,re- tells you?
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Carlo Lazzaro Thank you very much!
          Thank you for clarifying the test.

          I'd be frank here, I didn't understand what you mean by fvvarlist notation and how should I get rid of the omitted varibale by hand. As far as I understood the omitted variable are expressed in years.

          Here's the result of xttest0

          Code:
          . xttest0
          
          Breusch and Pagan Lagrangian multiplier test for random effects
          
                  PT[countryid,t] = Xb + u[countryid] + e[countryid,t]
          
                  Estimated results:
                                   |       Var     SD = sqrt(Var)
                          ---------+-----------------------------
                                PT |   3.86e+08       19646.04
                                 e |    3877442       1969.122
                                 u |          0              0
          
                  Test: Var(u) = 0
                                       chibar2(01) =     0.00
                                    Prob > chibar2 =   1.0000

          Comment


          • #6
            Anass:
            you have an issue upward -xtoverid- troubles: the -xttest0- is teling you that you should go pooled OLS.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Again, thank you for your time.

              Do I have to simply switch from my main regression command

              Code:
              xtreg PT RND_L1 LVG EX GI RER EDU i.year, vce (cluster countryid)
              To something like this?

              Code:
               reg PT RND_L1 LVG EX GI RER EDU, vce (cluster countryid)
              But then how you'd account for fixed effect and country effect in my case (I'm studying patent count and R&D investment relationship which is usually done using cross-country analysis and not in panel data, to my knowledge only two papers that have conducted on a panel)

              Comment


              • #8
                Anass:
                I would go:
                Code:
                 
                  reg PT RND_L1 LVG EX GI RER EDU i.timevar, vce (cluster countryid)
                You cannot account for -panelid- because your previous analysis showed no evidence of panel-wise effect.
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Carlo Lazzaro Thank you for taking once again the time to follow-up.

                  Can you please explain what do you mean by "showed no evidence of panel-wise effect"? Is this based on xtttest or xi: xtreg results?

                  This is probably a dumb question but, using this new command.

                  Code:
                  reg PT RND_L1 LVG EX GI RER EDU i.year, vce (cluster countryid)
                  I don't need to put before

                  xtset countryid year

                  I believe this is only valid when you want to declare a panel data. Am I wrong?

                  Comment


                  • #10
                    Anass:
                    1) the result of the BP test does not reject the null: that means no evidence of panel-wise effect.
                    2) you're right. If you go -regress- yoiu do not need to -xtset- your dataset beforehand.
                    Kind regards,
                    Carlo
                    (StataNow 18.5)

                    Comment


                    • #11
                      Carlo Lazzaro I get it now. Thank you for elaborating further.

                      Comment


                      • #12
                        Anass: You need to reevaluate what you've done. You say you have 210 countries and a strongly balanced panel over 36 years. That would be a total of 7,560 observations. Your estimation isn't using anything close to that. In fact, it's using only 19 countries and the panel looks very unbalanced. You must have a lot of missing data or you have misunderstood the structure of your data.

                        You need to resolve that issue.

                        As a general comment, you shouldn't use the Hausman test to tell you what to do. Fixed effects is more robust than random effects, and RE is rarely appropriate for aggregated data, such as countries and states. In any case, you need to resolve your data problem before anything can be done.

                        Notice how many year dummies were dropped in the estimation. That means you have no countries with data for those years. I suspect you weren't expecting that.

                        Comment

                        Working...
                        X