Announcement

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

  • Fixed Effects (xtreg) model improvement

    Hi everybody,
    once again I'm new to Stata, so please excuse any dumb mistakes.
    I am trying to estimate the relationship between ICT development and economic growth using a fixed effects model.

    Here is my
    Code:
    xtreg lnGDP lnMCell_subscriptions lnInternet_user lnbroadband lnICTImports lnTrade lnInflation ,fe
    with lnGDP being the dependent variable, lnMCell_subscriptions, lnInternet_user, lnbroadband, lnICTImports as the independent variables for ICT Developement and two control variables lnTrade & lnInflation.

    However my results doesn't look good:

    Code:
    Fixed-effects (within) regression               Number of obs     =        115
    Group variable: id                              Number of groups  =         20
    
    R-squared:                                      Obs per group:
         Within  = 0.1277                                         min =          2
         Between = 0.1450                                         avg =        5.8
         Overall = 0.1454                                         max =          8
    
                                                    F(6,89)           =       2.17
    corr(u_i, Xb) = -0.3281                         Prob > F          =     0.0530
    
    ---------------------------------------------------------------------------------------
                    lnGDP | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    ----------------------+----------------------------------------------------------------
    lnMCell_subscriptions |   .4909346    .658108     0.75   0.458    -.8167121    1.798581
          lnInternet_user |  -.5070882   .2168989    -2.34   0.022    -.9380616   -.0761148
              lnbroadband |  -.1638245   .1500376    -1.09   0.278     -.461946     .134297
             lnICTImports |   .0533181   .3025962     0.18   0.861    -.5479341    .6545703
                  lnTrade |   .4251854   .4600945     0.92   0.358    -.4890127    1.339383
              lnInflation |  -.1983117   .1498794    -1.32   0.189    -.4961188    .0994955
                    _cons |  -.7820719   3.513554    -0.22   0.824     -7.76343    6.199286
    ----------------------+----------------------------------------------------------------
                  sigma_u |  .53290124
                  sigma_e |  .68923919
                      rho |  .37413817   (fraction of variance due to u_i)
    ---------------------------------------------------------------------------------------
    F test that all u_i=0: F(19, 89) = 2.28                      Prob > F = 0.0051
    I'm using a dataset for sub-saharan africa with a lot of missing values due to data limitation:
    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float id str52 country int year double ICTImports float(lnGDP lnICTImports lnbroadband lnMCell_subscriptions lnInternet_user lnTrade lnInflation)
     1 "Botswana"                 2012 1.8236738166   1.494284    .600853  .08639537  5.017928  2.772589 3.8969245  2.0198114
     1 "Botswana"                 2013 1.1931488404   2.428636   .1765959  .04570304  5.058894 3.4011974 4.1194053    1.77234
     1 "Botswana"                 2014 2.2650993497  1.4229306   .8176186   .4661694  5.095529  3.603995 4.1036396  1.4821165
     1 "Botswana"                 2015 2.3019276171          .   .8337469  .55238104  5.099105  3.619316 3.9684634  1.1190786
     1 "Botswana"                 2016  2.653791706  1.9511673   .9759895  1.0058435  5.025675  3.672826 4.0002418  1.0349473
     1 "Botswana"                 2017 2.9899487297  1.3871564  1.0952562   .3858584  4.990161  3.723614   3.76038  1.1964287
     1 "Botswana"                 2018 3.1805129174   1.381381  1.1570425   .5746572  5.010673  4.060443  3.796293  1.1749606
     1 "Botswana"                 2019 2.9294101945  1.0961885  1.0748011   .7607223  5.091547 4.1108737   3.62122  1.0198809
     1 "Botswana"                 2020 2.9925582409          .  1.0961286   1.117556  5.090056         . 3.4365406   .6367669
     2 "Cameroon"                 2012 2.7061955523   1.531688   .9955438  -2.741956   4.11103  2.014903  3.172904  1.0088823
     2 "Cameroon"                 2013 3.6503651195  1.6085434  1.2948272  -2.569821  4.262028 2.3025851 3.1629026   .7222626
     2 "Cameroon"                 2014 4.2068374645   1.743937  1.4367112  -2.600928 4.3191133  2.785929  3.161669   .6065707
     2 "Cameroon"                 2015 3.3959667492  1.7346516  1.2225884  -2.433132  4.356045  2.906901 3.0440056   .9880467
     2 "Cameroon"                 2016 7.5988122959  1.5120002   2.027992   .4217233 4.3596406  3.025291  2.941803 -.14880137
     2 "Cameroon"                 2017 3.3946409696   1.264459   1.222198   .4424059  4.406283 3.1442804 2.9096894  -.4421184
     2 "Cameroon"                 2018            .  1.3751106          .   .4508675 4.2930617  3.391147 2.9304605 .071668774
     2 "Cameroon"                 2019            .  1.2456118          .   .4378687  4.415265 3.5115454 2.9882085   .8972311
     2 "Cameroon"                 2020            .  -.7094499          .   .9892069 4.5549297         .  2.710385   .8910176
     3 "Central African Republic" 2012 7.0428721802  1.6201328   1.952016 -4.2949586 3.2490795 1.0986123  2.446697   1.700794
     3 "Central African Republic" 2013 5.2567947912          .  1.6595215          . 3.4204335 1.2237754  2.706246   1.944308
     3 "Central African Republic" 2014 6.6162294929  -2.512436  1.8895257          .  3.253723  1.280934  2.813958   2.701273
     3 "Central African Republic" 2015  6.599526147  1.4672108  1.8869978  -3.185643 3.3197324  1.335001 2.8371854  .33859155
     3 "Central African Republic" 2016 8.2449531323  1.5582113  2.1096013  -4.121527 3.3145726 1.3862944 2.6961045  1.5984645
     3 "Central African Republic" 2017 4.0706327604   1.510121  1.4037985 -4.3074265  3.241578         .  2.848379  1.4304843
     3 "Central African Republic" 2018 3.8710855871  1.3322192   1.353535 -4.3405466 3.3110716         .  2.938295  .47757295
     3 "Central African Republic" 2019            .  1.0986123          .  -4.554865  3.515098         .  2.798083   .9878199
     3 "Central African Republic" 2020            . -.18752305          .          .         .         .  2.798083   .8345095
     4 "Chad"                     2012            .  2.1840916          . -1.8827854   3.53904  .7419373  3.649828   2.017117
     4 "Chad"                     2013            .  1.7404664          . -2.1972497  3.541002  .9162908 3.5135014 -1.5020574
     4 "Chad"                     2014            .  1.9315193          .  -2.601718 3.6489625 1.0647107  3.531095   .5199676
     4 "Chad"                     2015            .  1.0180079          .  -2.521466  3.656727  1.252763  3.401256  1.4763925
     4 "Chad"                     2016            .          .          . -3.3466516 3.6469896  1.609438   3.26938          .
     4 "Chad"                     2017            .          .          .  -6.117388  3.747383  1.871802  3.522617          .
     4 "Chad"                     2018            .   .8645922          .  -6.138602 3.8094084 2.0794415 3.5888016  1.4526957
     4 "Chad"                     2019            .  1.1777875          .  -7.760095  3.872551 2.2823825 3.6039274          .
     4 "Chad"                     2020            .          .          .          .  3.968158 2.3418057  3.274715  1.4960775
     5 "Congo, Dem. Rep."         2012            .   1.958248          .          . 3.3711185  .5187706  3.427612  2.2743738
     5 "Congo, Dem. Rep."         2013            .  2.1379411          .  -7.368814  3.677902  .7884573  3.595828 -.21291715
     5 "Congo, Dem. Rep."         2014            .  2.2481594          .  -7.296649 3.9179494 1.0986123  3.606372   .2175591
     5 "Congo, Dem. Rep."         2015 2.0230038636  1.9338617   .7045835  -6.636531 3.9022834  1.335001 3.3172114  -.2954468
     5 "Congo, Dem. Rep."         2016 2.0073767823   .8752183   .6968288   -6.66936  3.601867 1.8261567 3.4900584  1.0598198
     5 "Congo, Dem. Rep."         2017 2.2341466332  1.3155895   .8038594  -6.701945 3.7718225  2.154074  3.423942          .
     5 "Congo, Dem. Rep."         2018 1.7871857452   1.761493  .58064216  -5.203817 3.7700496  2.459589  3.529594          .
     5 "Congo, Dem. Rep."         2019 2.1055535556  1.4780822   .7445784 -4.2895446  3.755915  2.525729  3.275594          .
     5 "Congo, Dem. Rep."         2020 1.9928461914  .55125105   .6895639          . 3.8188884         .  3.353567          .
     6 "Cote d'Ivoire"            2012 2.4811822388  2.0308304   .9087352  -1.540565  4.430811  1.609438  3.554848   .2658284
     6 "Cote d'Ivoire"            2013  2.068846373  2.3758554   .7269911   -1.36724  4.474962  2.484907  3.372812   .9482429
     6 "Cote d'Ivoire"            2014  2.533764325  2.2377264   .9297061  -.5795822 4.5808973  2.958769 3.3377945  -.8014407
     6 "Cote d'Ivoire"            2015 2.2077291914    1.97326   .7919645  -.7500504 4.6949406 3.6490986 3.3089216  .22434247
     6 "Cote d'Ivoire"            2016 4.1648213971   1.971189  1.4266734  -.5577795 4.7469425  3.718628  3.202546  -.3240993
     6 "Cote d'Ivoire"            2017 3.1246293276  1.9960108  1.1393156  -.5370826  4.866858  3.780545 3.2156756   -.377051
     6 "Cote d'Ivoire"            2018 3.1877852799  1.9301124  1.1593264  -.3542083  4.904222  3.625581  3.119748 -1.0232942
     6 "Cote d'Ivoire"            2019 3.4728047137  1.8296506  1.2449626 -.17109957  4.979081 3.5915134  3.168688          .
     6 "Cote d'Ivoire"            2020            .   .6720933          . -.01407117  5.023887         .  3.070448   .8858342
     7 "Djibouti"                 2012            .          .          .  .54065156  3.197612 2.2407098         .  1.3167324
     7 "Djibouti"                 2013            .          .          .   .6953603 3.3191855  2.541602  5.053301   .9954835
     7 "Djibouti"                 2014            .  1.9546636          .   .8050458  3.463879  2.833213  5.064961   .2940604
     7 "Djibouti"                 2015            .  2.0407119          .   .9722526  3.537854  3.131137  4.952005          .
     7 "Djibouti"                 2016            .  1.8950154          .   .9603879  3.615198  3.427515   4.61135  1.0073782
     7 "Djibouti"                 2017            .   1.686973          .   .9490713  3.676657  4.019646  4.996051  -.5654365
     7 "Djibouti"                 2018            .  2.1291435          .   .9783515  3.718339  4.060443  5.005144   -1.91074
     7 "Djibouti"                 2019            .  2.0503342          .   .9194494  3.749753 4.0775375  5.027598    1.19974
     7 "Djibouti"                 2020            .  -.6931472          .   .9304811 3.7826126         .  5.033331  .57515603
     8 "Equatorial Guinea"        2012            .  2.1178052          . -1.9412575   3.88346  2.634991  4.275346  1.2965393
     8 "Equatorial Guinea"        2013            .          .          . -1.1183267 3.8597255  2.797281 4.2143965  1.0814244
     8 "Equatorial Guinea"        2014            .   -.879317          . -1.0618519  3.829208  2.937043 4.1890984  1.4609376
     8 "Equatorial Guinea"        2015            .          .          . -1.1236262 3.8207874         . 4.0370417  .51678634
     8 "Equatorial Guinea"        2016            .          .          .   -1.27901 3.8580225         .  3.939888   .3449641
     8 "Equatorial Guinea"        2017            .          .          . -1.8950107  3.803509         . 4.0752144 -.29356706
     8 "Equatorial Guinea"        2018            .          .          . -2.0894034  3.810364         .  4.087899   .3000189
     8 "Equatorial Guinea"        2019            .          .          .          .         .         . 3.9666424   .2140613
     8 "Equatorial Guinea"        2020            .          .          .          .         .         . 3.7687306  1.5622845
     9 "Eswatini"                 2012 2.1651358686  1.6857748   .7724831  -1.146618 4.3119555  3.034077 3.6025865   2.190496
     9 "Eswatini"                 2013 2.1153320754  1.3509816   .7492118  -.9507777 4.4087243  3.206803  3.702165   1.726564
     9 "Eswatini"                 2014 2.1295373621  -.0798763   .7559047  -.7641163 4.4275327  3.218876 3.7808754  1.7371887
     9 "Eswatini"                 2015 2.9562071993   .8008712  1.0839071  -.6098054 4.4453783  3.244272 3.7636824   1.599639
     9 "Eswatini"                 2016 2.7171431481  .06072833    .999581  -.4646294  4.492203         .   3.78553  2.0601664
     9 "Eswatini"                 2017 3.0707427525   .7063487  1.1219195  -.3407532  4.538254         .  3.773062   1.827991
     9 "Eswatini"                 2018 2.9226212555   .8635693  1.0724809          .         .         .   3.69987   1.571749
     9 "Eswatini"                 2019 2.6136491155   .9605125   .9607474          .         .         . 3.8209896   .9547482
     9 "Eswatini"                 2020            .          .          .          .         .         . 3.8071935          .
    10 "Ghana"                    2012 4.5508051629  2.2292387  1.5153042  -1.339098 4.5905223  2.360854   3.69782  2.4146936
    10 "Ghana"                    2013 3.7740956463  1.9895886  1.3281608 -1.3526525 4.6571217   2.70805 3.2363536   2.456695
    10 "Ghana"                    2014 2.8575870232  1.0495062  1.0499775 -1.3557805 4.7142053  2.944439  3.340453    2.74017
    10 "Ghana"                    2015  2.242675331   .7517742   .8076695 -1.3371235  4.833953  3.135494  3.521398  2.8419964
    10 "Ghana"                    2016 2.4959510618  1.2159406   .9146699 -1.1906018  4.901482 3.3322046  3.440201   2.859605
    10 "Ghana"                    2017 2.5063449827   2.095425   .9188255 -1.6343483  4.837881  3.634533 3.5227325  2.5154295
    10 "Ghana"                    2018 2.3914333251   1.824562   .8718929 -1.5807313  4.923749    3.7612  3.510198  2.0552468
    10 "Ghana"                    2019 2.4731967993  1.8729976   .9055116 -1.6482805   4.90022  3.970292  3.622996  1.9662224
    10 "Ghana"                    2020            .  -.8808187          . -1.3774685  4.869186         . 3.4726014    2.29125
    11 "Guinea"                   2012            .  1.7775403          .  -5.025011   3.95945 1.1314021  3.500662  2.7229455
    11 "Guinea"                   2013 2.8245703507  1.3726223  1.0383563  -4.913832  4.223463 1.5040774 3.2760355  2.4755206
    11 "Guinea"                   2014 3.2010921136  1.3073977  1.1634921  -4.819473 4.3550673  1.856298  3.284233  1.9561464
    11 "Guinea"                   2015  .9617476551  1.3417994 -.03900317 -4.7390094 4.5449533  2.104134  3.067907  2.3814592
    11 "Guinea"                   2016 1.6313453214  2.3814538    .489405  -4.670143  4.550148 2.2823825  3.380025   2.100728
    11 "Guinea"                   2017            .   2.332144          . -4.6735435 4.5742416  2.433615  3.799085  2.1876822
    11 "Guinea"                   2018            .  1.8497913          .  -4.628337  4.572311  3.083286 3.6940434   2.285032
    11 "Guinea"                   2019            .  1.7309784          .  -4.626638 4.6131063  3.135494  3.399893  2.2482111
    11 "Guinea"                   2020            .  1.9442745          .          .         .         . 3.9729435  2.3610294
    12 "Kenya"                    2012            .  1.5192243          . -2.0991426  4.238501 2.3513753  2.988957  2.2383418
    end
    format %ty year

    I already tried to look for the most balanced datasets and reduced the sample size. Is there a way I can deal with it or specifiy my model better, to improve my regression results?

    Thanks in advanced!

  • #2
    Why are your results bad/not good?

    Comment


    • #3
      Frank:
      qualifying results as bad or good when the estimator requirements are satisfied sounds difficult to get from a technical point of view, as results are what they are.
      That said, you do not share with interested listers the following pieces of information:
      1) did you compare -fe- vs. -re- via -hausman-?
      2) did you test whether the functional form of the regressand is correctly specified?
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Thanks Carlo. I made the fe/re comparison via Hausman and the fe is appropriate.
        I am sorry for my unspecific exaggeration that the results were not good. Not good was referring to the relatively small R^2, which of course does not mean the model is wrong or the results are bad.
        Regarding your 2nd point, how can I test if I specified the functional form correctly? Do you mean theoretically?

        Comment


        • #5
          Frank:
          no, I meant empirically (with the theoretical background described in -linktest- entry, Stata .pdf manual- Unfortunately, -linktest- does not apply to -xtreg-; hence you have to code it by hand), as per the following toy-example:
          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 i.year, fe vce(cluster idcode)
          
          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)
          ------------------------------------------------------------------------------
          
          . predict fitted, xb
          (24 missing values generated)
          
          . g sq_fitted=fitted^2
          (24 missing values generated)
          
          . xtreg ln_wage fitted sq_fitted , fe vce(cluster idcode)
          
          Fixed-effects (within) regression               Number of obs     =     28,510
          Group variable: idcode                          Number of groups  =      4,710
          
          R-squared:                                      Obs per group:
               Within  = 0.1164                                         min =          1
               Between = 0.1094                                         avg =        6.1
               Overall = 0.0941                                         max =         15
          
                                                          F(2,4709)         =     586.29
          corr(u_i, Xb) = 0.0619                          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]
          -------------+----------------------------------------------------------------
                fitted |   2.012332   .5365254     3.75   0.000     .9604909    3.064172
             sq_fitted |  -.3040363   .1616996    -1.88   0.060    -.6210431    .0129706
                 _cons |  -.8379964    .443929    -1.89   0.059    -1.708305    .0323122
          -------------+----------------------------------------------------------------
               sigma_u |  .40239556
               sigma_e |  .30114591
                   rho |  .64099409   (fraction of variance due to u_i)
          ------------------------------------------------------------------------------
          As -sq_fitted- does not reach statistical significance, the model passes the specification test.
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment

          Working...
          X