Announcement

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

  • Why does my R2 decrease so much after including fixed effects for panel data(?)

    Dear all,

    I hope some of you are able to help me (again).

    I am running a panel data regression for 63 countries and 23 years (1996-2018). My independent variable is 'socio-economic development', comprised of three separate (predictor) variables 'GDPlog' 'LifeExpectancy', and 'Urbanization rate'. My dependent variable is a computed proxy for 'Individualism' (data gathered from the World Value Survey - which is aggregated to the country level). In addition I have three control variables: HD (human development), GEN (gender), and PS (population size).

    My question related to the R2 value of my models. It does not seem like I am reporting comparable R-squared values. For example, I figured that the R-squared of the last column cannot be less (a lot less) than the one of the previous column.

    In the first column, I ran my model without including fixed effects: xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN
    In the second column, I ran my model with only Country FE: xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN, fe
    The third column only includes year FE: xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN i.Year
    In the final column, I included both country-and year FE: xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN i.Year, fe
    R2 (within/between) 0.142/0.7215 0.182/ 0.0011 0.183/ 0.741 0.223/0.002
    R2 (overall) 0.6470 0.0001 0.6880 0.0027




    I use the following comment to run the panel data:
    xtset ID Year, yearly

    Panel variable: ID (strongly balanced)
    Time variable: Year, 1996 to 2018
    Delta: 1 year

    Any help would be greatly appreciated.

    Thank you very much.
    Wessel



  • #2
    Wessel:
    what you reported is unreadable.
    Why not using CODE delimiters to show what you typed and what Stata gave you back (as per FAQ)? Thanks.
    In addition? you seem to have run differenr -xtreg, fe- and -xtreg, re- regressions. What is the rationale behind switching from one to another?
    Last edited by Carlo Lazzaro; 05 Jun 2022, 22:49.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for your response, Carlo.

      I have only made use of use of -xtreg, fe- as far as I know?

      Here, I ran my model without including fixed effects:

      Code:
      . xtset ID Year, yearly
      
      Panel variable: ID (strongly balanced)
       Time variable: Year, 1996 to 2018
               Delta: 1 year
      See my four models below:
      Code:
      . xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN
      
      Random-effects GLS regression                   Number of obs     =        687
      Group variable: ID                              Number of groups  =         60
      
      R-squared:                                      Obs per group:
           Within  = 0.1417                                         min =          1
           Between = 0.7215                                         avg =       11.4
           Overall = 0.6470                                         max =         19
      
                                                      Wald chi2(7)      =          .
      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =          .
      
      ------------------------------------------------------------------------------
               IDV | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
           lnGDPpw |  -.0358394   .0320181    -1.12   0.263    -.0985938     .026915
             lnURB |   .0217541   .0105252     2.07   0.039     .0011251     .042383
              lnLE |  -.0430079   .0392093    -1.10   0.273    -.1198567    .0338409
                EI |  -.0319773   .0382979    -0.83   0.404    -.1070398    .0430852
                IQ |  -.0060258   .0030243    -1.99   0.046    -.0119534   -.0000982
                PS |  -1.26e-11   1.39e-11    -0.90   0.367    -3.99e-11    1.47e-11
                HD |   -.152468   .0315897    -4.83   0.000    -.2143826   -.0905533
               GEN |  -.0035605   .0019158    -1.86   0.063    -.0073155    .0001945
             _cons |   1.214963   .1922614     6.32   0.000      .838138    1.591789
      -------------+----------------------------------------------------------------
           sigma_u |   .0245933
           sigma_e |  .01081573
               rho |  .83793541   (fraction of variance due to u_i)
      ---------------------------------------------------------------
      I ran my model with only Country FE:

      Code:
      . xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN, fe
      
      Fixed-effects (within) regression               Number of obs     =        687
      Group variable: ID                              Number of groups  =         60
      
      R-squared:                                      Obs per group:
           Within  = 0.1821                                         min =          1
           Between = 0.0011                                         avg =       11.4
           Overall = 0.0001                                         max =         19
      
                                                      F(8,619)          =      17.23
      corr(u_i, Xb) = -0.3740                         Prob > F          =     0.0000
      
      ------------------------------------------------------------------------------
               IDV | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
           lnGDPpw |  -.0321212   .0318284    -1.01   0.313     -.094626    .0303836
             lnURB |   .0367066    .013335     2.75   0.006     .0105193    .0628939
              lnLE |  -.0574437   .0418234    -1.37   0.170    -.1395767    .0246894
                EI |   .0568675   .0419474     1.36   0.176    -.0255091     .139244
                IQ |   .0112253   .0038239     2.94   0.003      .003716    .0187346
                PS |  -5.67e-11   3.25e-11    -1.74   0.082    -1.21e-10    7.22e-12
                HD |  -.1150688   .0331138    -3.47   0.001    -.1800977   -.0500398
               GEN |   -.003492   .0023754    -1.47   0.142    -.0081568    .0011729
             _cons |   1.160671    .208721     5.56   0.000     .7507839    1.570558
      -------------+----------------------------------------------------------------
           sigma_u |  .05056093
           sigma_e |  .01081573
               rho |  .95624281   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(59, 619) = 53.50                    Prob > F = 0.0000

      Here, I ran my model with only year FE:

      Code:
      . xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN i.Year
      
      Random-effects GLS regression                   Number of obs     =        687
      Group variable: ID                              Number of groups  =         60
      
      R-squared:                                      Obs per group:
           Within  = 0.1825                                         min =          1
           Between = 0.7414                                         avg =       11.4
           Overall = 0.6880                                         max =         19
      
                                                      Wald chi2(26)     =          .
      corr(u_i, X) = 0 (assumed)                      Prob > chi2       =          .
      
      ------------------------------------------------------------------------------
               IDV | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
      -------------+----------------------------------------------------------------
           lnGDPpw |  -.0158229   .0319096    -0.50   0.620    -.0783646    .0467188
             lnURB |    .032289   .0103669     3.11   0.002     .0119702    .0526078
              lnLE |  -.0586834   .0416905    -1.41   0.159    -.1403952    .0230284
                EI |  -.0148395   .0383162    -0.39   0.699    -.0899378    .0602588
                IQ |  -.0011988   .0030727    -0.39   0.696    -.0072212    .0048235
                PS |  -1.85e-11   1.31e-11    -1.41   0.159    -4.42e-11    7.22e-12
                HD |  -.2858657   .0379864    -7.53   0.000    -.3603176   -.2114137
               GEN |  -.0021247   .0018602    -1.14   0.253    -.0057706    .0015212
                   |
              Year |
             1998  |  -.0607658   .0130329    -4.66   0.000    -.0863098   -.0352217
             1999  |  -.0635529   .0129941    -4.89   0.000    -.0890207    -.038085
             2000  |  -.0629987   .0130037    -4.84   0.000    -.0884855   -.0375119
             2001  |   -.061725   .0129781    -4.76   0.000    -.0871616   -.0362884
             2002  |  -.0601948   .0129445    -4.65   0.000    -.0855655   -.0348241
             2003  |  -.0584408   .0129053    -4.53   0.000    -.0837348   -.0331468
             2004  |  -.0566737    .012881    -4.40   0.000      -.08192   -.0314273
             2005  |  -.0585272   .0127496    -4.59   0.000     -.083516   -.0335384
             2006  |  -.0565198   .0127445    -4.43   0.000    -.0814986    -.031541
             2007  |  -.0547624   .0127285    -4.30   0.000    -.0797098    -.029815
             2008  |  -.0532066   .0127112    -4.19   0.000    -.0781201   -.0282932
             2009  |  -.0523133   .0127193    -4.11   0.000    -.0772427   -.0273839
             2010  |  -.0523411   .0127378    -4.11   0.000    -.0773068   -.0273754
             2011  |  -.0504506   .0127357    -3.96   0.000    -.0754122   -.0254891
             2012  |  -.0493008   .0127344    -3.87   0.000    -.0742598   -.0243418
             2013  |  -.0476336   .0127299    -3.74   0.000    -.0725838   -.0226835
             2014  |  -.0462179   .0127286    -3.63   0.000    -.0711655   -.0212703
             2017  |  -.0503154   .0126289    -3.98   0.000    -.0750676   -.0255631
             2018  |  -.0493624   .0126281    -3.91   0.000    -.0741131   -.0246117
                   |
             _cons |   1.285421   .1971329     6.52   0.000     .8990476    1.671795
      -------------+----------------------------------------------------------------
           sigma_u |  .02281234
           sigma_e |  .01070822
               rho |  .81944318   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      Here included both country-and year FE:

      Code:
      . xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN i.Year, fe
      
      Fixed-effects (within) regression               Number of obs     =        687
      Group variable: ID                              Number of groups  =         60
      
      R-squared:                                      Obs per group:
           Within  = 0.2229                                         min =          1
           Between = 0.0022                                         avg =       11.4
           Overall = 0.0027                                         max =         19
      
                                                      F(27,600)         =       6.37
      corr(u_i, Xb) = -0.3502                         Prob > F          =     0.0000
      
      ------------------------------------------------------------------------------
               IDV | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
      -------------+----------------------------------------------------------------
           lnGDPpw |  -.0149985   .0320457    -0.47   0.640    -.0779338    .0479368
             lnURB |   .0417426   .0133699     3.12   0.002     .0154852    .0680001
              lnLE |  -.0235256   .0470972    -0.50   0.618     -.116021    .0689698
                EI |   .0664247   .0426652     1.56   0.120    -.0173666    .1502159
                IQ |   .0129416   .0038266     3.38   0.001     .0054265    .0204568
                PS |  -6.02e-11   3.28e-11    -1.84   0.067    -1.25e-10    4.14e-12
                HD |  -.1772328   .0423389    -4.19   0.000    -.2603832   -.0940823
               GEN |  -.0034419   .0024012    -1.43   0.152    -.0081578    .0012739
                   |
              Year |
             1998  |  -.0452868   .0128549    -3.52   0.000    -.0705329   -.0200407
             1999  |  -.0487066   .0127952    -3.81   0.000    -.0738353   -.0235779
             2000  |  -.0485705   .0127925    -3.80   0.000     -.073694    -.023447
             2001  |  -.0475299   .0127604    -3.72   0.000    -.0725904   -.0224694
             2002  |  -.0463023   .0127169    -3.64   0.000    -.0712774   -.0213272
             2003  |  -.0451734   .0126634    -3.57   0.000    -.0700433   -.0203034
             2004  |  -.0440253   .0126264    -3.49   0.001    -.0688227   -.0192279
             2005  |  -.0470253   .0124831    -3.77   0.000    -.0715412   -.0225095
             2006  |  -.0457833   .0124636    -3.67   0.000    -.0702609   -.0213058
             2007  |  -.0447061   .0124359    -3.59   0.000    -.0691293   -.0202829
             2008  |  -.0438945   .0124104    -3.54   0.000    -.0682676   -.0195214
             2009  |  -.0433583   .0124209    -3.49   0.001    -.0677521   -.0189646
             2010  |  -.0442326   .0124327    -3.56   0.000    -.0686496   -.0198156
             2011  |  -.0433819   .0124256    -3.49   0.001    -.0677848   -.0189789
             2012  |  -.0427049   .0124232    -3.44   0.001    -.0671032   -.0183066
             2013  |  -.0418179   .0124166    -3.37   0.001    -.0662032   -.0174325
             2014  |   -.041259   .0124139    -3.32   0.001     -.065639   -.0168789
             2017  |  -.0468404   .0123093    -3.81   0.000     -.071015   -.0226658
             2018  |  -.0462844   .0123093    -3.76   0.000    -.0704589   -.0221098
                   |
             _cons |   1.051972   .2245873     4.68   0.000     .6108988    1.493044
      -------------+----------------------------------------------------------------
           sigma_u |  .04974205
           sigma_e |  .01070822
               rho |  .95570923   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(59, 600) = 49.14                    Prob > F = 0.0000
      Thank you!!


      Comment


      • #4
        As a follow up, could this have to do with the very small standard deviation of my dependent variable (individualism)? This is only .0469033.

        Thank you in advance.

        Comment


        • #5
          Wessel:
          not quite.
          Whenever you read:
          Code:
          corr(u_i, X) = 0 (assumed)
          yiou went -xtreg,re-.
          As we know the two estimators are not interchangeable: if -fe- is the way to go, -re- is inconsistent.
          Coneversely, the main assumption of -re- specification (ie, the one reported above between CODE delimiters) rarely holds.
          In sum, I would advise you to gain a better focus on what you're after.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Thank you for your answer.

            Please allow me to ask a follow-up question, as I do not really understand your answer.

            I want to run a fixed-effects model, with both time and country-fixed effects.

            As previously mentioned, I use:
            Code:
             
             . xtset ID Year, yearly  Panel variable: ID (strongly balanced)  Time variable: Year, 1996 to 2018          Delta: 1 year
            Never in my regression do I use the code 're'. Therefore, could you please explain what I am doing wrong?


            Comment


            • #7
              Wessel:
              -re- is the default specification in -xtreg-, as we can see from the following toy example (identical results):
              Code:
              . use "https://www.stata-press.com/data/r17/nlswork.dta"
              (National Longitudinal Survey of Young Women, 14-24 years old in 1968)
              
              . xtreg ln_wage c.age##c.age, robust
              
              Random-effects GLS regression                   Number of obs     =     28,510
              Group variable: idcode                          Number of groups  =      4,710
              
              R-squared:                                      Obs per group:
                   Within  = 0.1087                                         min =          1
                   Between = 0.1015                                         avg =        6.1
                   Overall = 0.0870                                         max =         15
              
                                                              Wald chi2(2)      =    1258.33
              corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
              
                                           (Std. err. adjusted for 4,710 clusters in idcode)
              ------------------------------------------------------------------------------
                           |               Robust
                   ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                       age |   .0590339   .0041049    14.38   0.000     .0509884    .0670795
                           |
               c.age#c.age |  -.0006758   .0000688    -9.83   0.000    -.0008107    -.000541
                           |
                     _cons |   .5479714   .0587198     9.33   0.000     .4328826    .6630601
              -------------+----------------------------------------------------------------
                   sigma_u |   .3654049
                   sigma_e |  .30245467
                       rho |  .59342665   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              . xtreg ln_wage c.age##c.age, re robust
              
              Random-effects GLS regression                   Number of obs     =     28,510
              Group variable: idcode                          Number of groups  =      4,710
              
              R-squared:                                      Obs per group:
                   Within  = 0.1087                                         min =          1
                   Between = 0.1015                                         avg =        6.1
                   Overall = 0.0870                                         max =         15
              
                                                              Wald chi2(2)      =    1258.33
              corr(u_i, X) = 0 (assumed)                      Prob > chi2       =     0.0000
              
                                           (Std. err. adjusted for 4,710 clusters in idcode)
              ------------------------------------------------------------------------------
                           |               Robust
                   ln_wage | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                       age |   .0590339   .0041049    14.38   0.000     .0509884    .0670795
                           |
               c.age#c.age |  -.0006758   .0000688    -9.83   0.000    -.0008107    -.000541
                           |
                     _cons |   .5479714   .0587198     9.33   0.000     .4328826    .6630601
              -------------+----------------------------------------------------------------
                   sigma_u |   .3654049
                   sigma_e |  .30245467
                       rho |  .59342665   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              .
              Conversely, you may want something along the following lines:
              Code:
              . xtreg ln_wage c.age##c.age i.year, fe robust
              
              Fixed-effects (within) regression               Number of obs     =     28,510
              Group variable: idcode                          Number of groups  =      4,710
              
              R-squared:                                      Obs per group:
                   Within  = 0.1162                                         min =          1
                   Between = 0.1078                                         avg =        6.1
                   Overall = 0.0932                                         max =         15
              
                                                              F(16,4709)        =      79.11
              corr(u_i, Xb) = 0.0613                          Prob > F          =     0.0000
              
                                           (Std. err. adjusted for 4,710 clusters in idcode)
              ------------------------------------------------------------------------------
                           |               Robust
                   ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                       age |   .0728746    .013687     5.32   0.000     .0460416    .0997075
                           |
               c.age#c.age |  -.0010113   .0001076    -9.40   0.000    -.0012224   -.0008003
                           |
                      year |
                       69  |   .0647054   .0155249     4.17   0.000     .0342693    .0951415
                       70  |   .0284423   .0264639     1.07   0.283    -.0234395     .080324
                       71  |   .0579959   .0384111     1.51   0.131    -.0173078    .1332996
                       72  |   .0510671   .0502675     1.02   0.310    -.0474808     .149615
                       73  |   .0424104   .0624924     0.68   0.497    -.0801038    .1649247
                       75  |   .0151376    .086228     0.18   0.861    -.1539096    .1841848
                       77  |   .0340933   .1106841     0.31   0.758    -.1828994     .251086
                       78  |   .0537334   .1232232     0.44   0.663    -.1878417    .2953084
                       80  |   .0369475   .1473725     0.25   0.802    -.2519716    .3258667
                       82  |   .0391687   .1715621     0.23   0.819    -.2971733    .3755108
                       83  |    .058766   .1836086     0.32   0.749    -.3011928    .4187249
                       85  |   .1042758   .2080199     0.50   0.616    -.3035406    .5120922
                       87  |   .1242272   .2327328     0.53   0.594    -.3320379    .5804922
                       88  |   .1904977   .2486083     0.77   0.444    -.2968909    .6778863
                           |
                     _cons |   .3937532   .2469015     1.59   0.111    -.0902893    .8777957
              -------------+----------------------------------------------------------------
                   sigma_u |  .40275174
                   sigma_e |  .30127563
                       rho |  .64120306   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              
              .
              Whether your model is correctly specified and which specification (ie, -fe- or -re-) fits your data better, still remains to be investigated.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Thank you very much!

                However, I want to run the first model without any fixed effects as to show the impact of including them for my other models.

                Could you tell me how to run (in my case) 'xtreg IDV lnGDPpw lnURB lnLE EI IQ PS HD GEN' without getting a Random-effects GLS regression?

                Again, thank you so much! You are quite the helper!

                Comment


                • #9
                  Wessel:
                  as per my previous reply, if you run your first code, you actually run a Random-effects GLS regression.
                  Again, I would recommend you to focus a bit more on what you want to do and brush up your knowledge about linear panel data regression (I suspect that there's still something you're not that clear with about the way the -fe- and -re- estimators work. No worries, it's a tricky matter).
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment

                  Working...
                  X