Announcement

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

  • Gravity model - PPML fixed-effect estimation

    Dear all,

    I am doing a study on how Brexit can impact the EU export by using the gravity model. My sample is a panel data, in which 28 EU countries exports to all countries (including EU countries) across 41 sectors (as defined by GTAP) from 1988 to 2018. My independent variables are traditional gravity variables such as contiguity, distance, GDP. My dummy variables/interest variables are "EEA" dummy accounting for if an importer is an EEA (European Economic Area) member; "auto" dummy = 1 if the trade in the automotive industry and the interaction term EEA_auto.
    I use PPML estimator and exporter- and importer-time fixed effects for the estimation. My code is as follows:

    egen exp_time = group(exp year)
    quietly tabulate exp_time, generate(exp_time_fe)

    egen imp_time = group(imp year)
    quietly tabulate imp_time, generate(imp_time_fe)

    *(1) Fixed effects including GDP variables (Just to compare)
    ppml tradevalue gravity_variables_withGDP EEA auto EEA_auto exp_time_fe* imp_time_fe*, cluster (dist)

    *(2) Fixed effects without GDP variables (The specification is used for interpretation)
    ppml tradevalue gravity_variables_noGDP EEA auto EEA_auto exp_time_fe* imp_time_fe*, cluster (dist)

    The coefficient of the EEA dummy changes significantly from (1) to (2), which makes the effects of EEA dummy is too large that I could not interpret. I acknowledge that is a problem probably due to multicollinearity and I should not interpret it as my explanatory variable, but it is my interest variable, I would like to keep it but I don't know exactly how to fix this issue.

    Then I also try to include only exporter and importer and year fixed effects instead of exporter- and importer-time fixed effects. My code is:

    egen exp_1 = group(exp)
    tabulate exp_1, generate(exp_fe)

    egen imp_1 = group(imp)
    tabulate imp_1, generate(imp_fe)

    egen year_1 = group(year)
    tabulate year_1, generate(year_fe)

    *(3)
    ppml tradevalue gravity_variables_withGDP EEA auto EEA_auto ///
    exp_fe* imp_fe* year_fe* ///
    , cluster(dist)

    *(4)
    ppml tradevalue gravity_variable_noGDP EEA auto EEA_auto ///
    exp_fe* imp_fe* year_fe*, cluster(dist)

    All parameters look much more consistent between (3) and (4) and the effects of my interest variables are perfectly fine to interpret.

    My question is: Is it appropriate that I control for exporter and importer and year fixed effects instead of exporter- and importer-time fixed effects and use that result to interpret? If not, could you please give me some advice on how to still keep exporter- and importer-time fixed effects and obtain a better result?

    Note: I already use ppml_panel_sg but it did not work since it will absorb my interest variables. Therefore, I sticked to the normal ppml command.

    Thank you very much in advance for your time and consideration!


  • #2
    Viet;
    welcome to this forum.
    The guru on this topic is Joao Santos Silva.
    Search for his replies on this forum.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Dear Carlo,

      Thank you for your response. Actually, I have followed Joao Santos Silva's replies and other discussions for a while, but unfortunately, I could not find the answer to my exact case.
      That's why I need to create this post asking about this issue and hope that someone could clarify it for me.

      Best regards,
      Viet

      Comment


      • #4
        Viet:
        let's hope that Joao will chime in.
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          Dear Viet Anh Tran,

          I suggest that you use the ppmlhdfe command as it makes interpretation of the results much easier. If your variable of interest is absorbed, that means you cannot identify its effect and changing the fixed effects specification just because of that does not sound reasonable. I guess that the EEA dummy changes over time for some countries, so I would be surprised if it is dropped due to collinearity with fixed effects.

          Best wishes,

          Joao

          Comment


          • #6
            Dear Joao Santos Silva,

            Actually, I already tried the ppmlhdfe, and it still absorbs my EEA dummy, that's also why I have to use the ppml command instead. As far as I understand, since the EEA dummy for some countries changes over time due to EU enlargement, making it as a time-varying dummy and correlated with the importer-time FEs, so both the ppmlhdfe or ppml_panel_sg command will absorb that.

            My code using ppmlhdfe is:
            ppmlhdfe tradevalue gravity_variables_withGDP EEA auto EEA_auto, absorb(exp_time_fe* imp_time_fe*)

            The result on Stata looks like this:
            (warning: absorbing 966 dimensions of fixed effects; check that you really want that)
            warning: dependent variable takes very low values after standardizing (3.9066e-10)
            note: 5 variables omitted because of collinearity: ln_gdp_exp ln_gdp_imp ln_gdppc_exp ln_gdppc_imp EEA

            Does this mean that I cannot interpret the effect of EEA alone? Is there any way that I can keep that variable?

            Thank you very much for your reply. I truly appreciate it!

            Best regards,
            Viet

            Comment


            • #7
              Dear Viet Anh Tran,

              I suspect that there is something wrong with the way you are constructing your data. PPML and PPMLHDFE identify exactly the same parameters, so if a variable is dropped by PPMLHDFE, its coefficient in PPML should be meaningless.

              Best wishes,

              Joao

              Comment


              • #8
                Dear Statilisters

                I studying the impact of Brexit on UK imports from selected African countries (21 in total) using the gravity model and covers annual data from 2000 to 2020 – about 441 panel observations. To do the analysis I am using PPMLHDFE estimator. I want to find out if:
                1. I have done it correctly. If not what else do I need to do?
                2. If I add the gdpuk to the model the brexit variable is changing to positive from negative. What could be wrong? How can I resolve it?




                My code is as follows:
                Code:
                ppmlhdfe import lgdp ldistance lpop lpopuk lgdpuk reer reeruk brexit comwealth comlang epas locked, cluster( countrycode)


                My data:
                Code:
                * Example generated by -dataex-. To install: ssc install dataex
                clear
                input int Sn str10 country byte countrycode int(year import) byte(locked comlang colony brexit) float(lgdp lpop ldis) double reer float(lpopuk lgdpuk)
                  1 "Burundi"  1 2000   0 1 0 0 0  20.58456  8.760767  8.812052  139.7556467187757 17.891115  28.13912
                  2 "Burundi"  1 2001   0 1 0 0 0 20.591784  8.783549  8.812052 133.26077630045847 17.894962   28.1281
                  3 "Burundi"  1 2002   0 1 0 0 0  20.53137   8.81046  8.812052 115.92726774767208 17.899227  28.20992
                  4 "Burundi"  1 2003   0 1 0 0 0 20.480755   8.84058  8.812052  96.56693711161582 17.903782 28.352316
                  5 "Burundi"  1 2004   0 1 0 0 0 20.634716  8.872347  8.812052  93.76286109429391 17.909029  28.51554
                  6 "Burundi"  1 2005   1 1 0 0 0 20.834013  8.904494  8.812052 102.96168770302427  17.91672 28.565084
                  7 "Burundi"  1 2006   0 1 0 0 0  20.96494  8.936955  8.812052 106.20221815154451 17.923546  28.63057
                  8 "Burundi"  1 2007   0 1 0 0 0  21.02795  8.969796  8.812052                100 17.931602 28.764416
                  9 "Burundi"  1 2008   0 1 0 0 0  21.20064  9.002824  8.812052 103.50461368647316 17.939798  28.70905
                 10 "Burundi"  1 2009   0 1 0 0 0 21.300695 9.0357485  8.812052 114.36092535941313 17.946838  28.51718
                 11 "Burundi"  1 2010   0 1 0 0 0  21.43235 9.0683155  8.812052  118.4171405499536  17.95482  28.54375
                 12 "Burundi"  1 2011   0 1 0 0 0 21.527874  9.100303  8.812052 118.10109066593462  17.96316  28.61493
                 13 "Burundi"  1 2012   0 1 0 0 0  21.57055  9.131947  8.812052 123.58819760802933 17.969774 28.631344
                 14 "Burundi"  1 2013   0 1 0 0 0 21.620016  9.163249  8.812052 121.71866232346159 17.976044 28.661816
                 15 "Burundi"  1 2014   0 1 0 0 0 21.718657  9.194617  8.812052  127.9975110349722 17.983675 28.758274
                 16 "Burundi"  1 2015   0 1 0 0 0 21.856085  9.226213  8.812052  149.6973163512665 17.991589  28.71505
                 17 "Burundi"  1 2016   0 1 0 0 1 21.728596  9.257987  8.812052 151.01913157715606 17.999819   28.6327
                 18 "Burundi"  1 2017   0 1 0 0 1 21.734205  9.289799  8.812052 141.51483364591093 18.005774  28.62391
                 19 "Burundi"  1 2018   0 1 0 0 1  21.70478  9.321434  8.812052 126.50376137045637 18.011744 28.696005
                 20 "Burundi"  1 2019   0 1 0 0 1 21.690794  9.352795  8.812052 123.46531416252937 18.017166  28.68835
                 21 "Burundi"  1 2020   0 1 0 0 1   21.7677  9.383537  8.812052 127.04971277302874 18.021412  28.64777
                 22 "Comoros"  2 2000   0 0 0 0 0 19.676685  6.295266  9.009148  77.05357700526521 17.891115  28.13912
                 23 "Comoros"  2 2001   4 0 0 0 0  19.75176  6.320768  9.009148  81.81320674007792 17.894962   28.1281
                 24 "Comoros"  2 2002   0 0 0 0 0  19.86987  6.343881  9.009148  87.12365728504673 17.899227  28.20992
                 25 "Comoros"  2 2003   0 0 0 0 0  20.11975  6.368187  9.009148  91.14875478740751 17.903782 28.352316
                 26 "Comoros"  2 2004   0 0 0 0 0 20.267096  6.391917  9.009148  94.59752470691774 17.909029  28.51554
                 27 "Comoros"  2 2005   0 0 0 0 0  20.29838  6.416732  9.009148  94.03203986113223  17.91672 28.565084
                 28 "Comoros"  2 2006   0 0 0 0 0  20.36435  6.439351  9.009148  95.36050347129229 17.923546  28.63057
                 29 "Comoros"  2 2007   0 0 0 0 0   20.4947  6.464588  9.009148                100 17.931602 28.764416
                 30 "Comoros"  2 2008   0 0 0 0 0 20.635155  6.487684  9.009148 104.93859969602892 17.939798  28.70905
                 31 "Comoros"  2 2009   0 0 0 0 0 20.623823  6.511745  9.009148  108.1380896988564 17.946838  28.51718
                 32 "Comoros"  2 2010   0 0 0 0 0  20.62673  6.536692  9.009148 102.98724977939231  17.95482  28.54375
                 33 "Comoros"  2 2011   0 0 0 0 0  20.74609  6.561031  9.009148  103.0300923390697  17.96316  28.61493
                 34 "Comoros"  2 2012   1 0 0 0 0 20.738985  6.584791  9.009148 104.41280307119487 17.969774 28.631344
                 35 "Comoros"  2 2013   0 0 0 0 0  20.83322  6.609349  9.009148 107.60860422416513 17.976044 28.661816
                 36 "Comoros"  2 2014   0 0 0 0 0  20.86267  6.632002  9.009148  108.0446103071842 17.983675 28.758274
                 37 "Comoros"  2 2015   0 0 0 0 0 20.688705   6.65544  9.009148 104.11003626186195 17.991589  28.71505
                 38 "Comoros"  2 2016   0 0 0 0 1  20.73602  6.679599  9.009148 107.13791596428939 17.999819   28.6327
                 39 "Comoros"  2 2017   0 0 0 0 1 20.797853  6.701961  9.009148 104.76162251895327 18.005774  28.62391
                 40 "Comoros"  2 2018   0 0 0 0 1  20.89621  6.723833  9.009148 106.16776015136557 18.011744 28.696005
                 41 "Comoros"  2 2019   0 0 0 0 1  20.89937  6.746412  9.009148  106.9842447909659 18.017166  28.68835
                 42 "Comoros"  2 2020   0 0 0 0 1  20.93466  6.768493  9.009148 110.53440445067962 18.021412  28.64777
                 43 "Congo DR" 3 2000   0 0 0 0 0  23.67233 10.760156 8.5147085  340.4994817176442 17.891115  28.13912
                 44 "Congo DR" 3 2001   0 0 0 0 0  22.72989 10.787854 8.5147085 167.67714520388708 17.894962   28.1281
                 45 "Congo DR" 3 2002   1 0 0 0 0 22.889807 10.817215 8.5147085  120.6951903535796 17.899227  28.20992
                 46 "Congo DR" 3 2003   1 0 0 0 0  22.91353   10.8479 8.5147085  99.32472382714913 17.903782 28.352316
                 47 "Congo DR" 3 2004   4 0 0 0 0 23.055166 10.879348 8.5147085  94.84363804858943 17.909029  28.51554
                 48 "Congo DR" 3 2005   5 0 0 0 0  23.20521  10.91119 8.5147085  93.74612804895423  17.91672 28.565084
                 49 "Congo DR" 3 2006   0 0 0 0 0  23.39409 10.943376 8.5147085 103.55261704402947 17.923546  28.63057
                 50 "Congo DR" 3 2007   0 0 0 0 0  23.54089 10.975995 8.5147085                100 17.931602 28.764416
                 51 "Congo DR" 3 2008   0 0 0 0 0  23.70837 11.008926 8.5147085 100.17237453886001 17.939798  28.70905
                 52 "Congo DR" 3 2009   0 0 0 0 0 23.649025 11.042106 8.5147085 105.40091986185351 17.946838  28.51718
                 53 "Congo DR" 3 2010   3 0 0 0 0  23.79437 11.075412 8.5147085 114.27415476299132  17.95482  28.54375
                 54 "Congo DR" 3 2011   1 0 0 0 0  23.97518 11.108785 8.5147085 119.93969787592764  17.96316  28.61493
                 55 "Congo DR" 3 2012   1 0 0 0 0 24.101067 11.142166 8.5147085   124.553129769367 17.969774 28.631344
                 56 "Congo DR" 3 2013   1 0 0 0 0  24.21002  11.17548 8.5147085 123.27246750335298 17.976044 28.661816
                 57 "Congo DR" 3 2014   0 0 0 0 0 24.304255 11.208667 8.5147085 124.33686434892861 17.983675 28.758274
                 58 "Congo DR" 3 2015   0 0 0 0 0 24.358685 11.241707 8.5147085 143.28208094009048 17.991589  28.71505
                 59 "Congo DR" 3 2016   1 0 0 0 1  24.33782 11.274529 8.5147085 136.09724655253748 17.999819   28.6327
                 60 "Congo DR" 3 2017   3 0 0 0 1  24.36136 11.307118 8.5147085 122.81272203551836 18.005774  28.62391
                 61 "Congo DR" 3 2018   0 0 0 0 1 24.576515  11.33938 8.5147085 136.60826634145695 18.011744 28.696005
                 62 "Congo DR" 3 2019   3 0 0 0 1  24.64327 11.371258 8.5147085 144.60853867425152 18.017166  28.68835
                 63 "Congo DR" 3 2020   1 0 0 0 1 24.609293 11.402676 8.5147085  142.1745382599275 18.021412  28.64777
                 64 "Djibouti" 4 2000   0 0 0 0 0 20.127665  6.576469  8.624225 117.61348883033203 17.891115  28.13912
                 65 "Djibouti" 4 2001   0 0 0 0 0  20.16538  6.597146  8.624225 124.02547437036901 17.894962   28.1281
                 66 "Djibouti" 4 2002   0 0 0 0 0  20.19753  6.616065  8.624225 122.69711518926867 17.899227  28.20992
                 67 "Djibouti" 4 2003   0 0 0 0 0  20.24852  6.633318  8.624225 111.13005174319647 17.903782 28.352316
                 68 "Djibouti" 4 2004   1 0 0 0 0  20.31691  6.648984  8.624225  106.0895594593105 17.909029  28.51554
                 69 "Djibouti" 4 2005   0 0 0 0 0  20.37885  6.663133  8.624225 104.72386287308933  17.91672 28.565084
                 70 "Djibouti" 4 2006   0 0 0 0 0  20.46044  6.678342  8.624225  103.3321386531048 17.923546  28.63057
                 71 "Djibouti" 4 2007   1 0 0 0 0 20.558296  6.690842  8.624225                100 17.931602 28.764416
                 72 "Djibouti" 4 2008   4 0 0 0 0  20.72237  6.704414  8.624225  97.67498854268959 17.939798  28.70905
                 73 "Djibouti" 4 2009   2 0 0 0 0  20.77121  6.719013  8.624225 107.41947064691001 17.946838  28.51718
                 74 "Djibouti" 4 2010   0 0 0 0 0 20.844254  6.733402  8.624225 108.03989148522055  17.95482  28.54375
                 75 "Djibouti" 4 2011   0 0 0 0 0 20.937687  6.749931  8.624225 104.91763532999916  17.96316  28.61493
                 76 "Djibouti" 4 2012   0 0 0 0 0  21.02606  6.766191  8.624225 108.30290063863866 17.969774 28.631344
                 77 "Djibouti" 4 2013   0 0 0 0 0 21.437595  6.783325  8.624225 107.52280935432339 17.976044 28.661816
                 78 "Djibouti" 4 2014   0 0 0 0 0 21.518373  6.801283  8.624225 108.41305457114674 17.983675 28.758274
                 79 "Djibouti" 4 2015   0 0 0 0 0  21.61127  6.817831  8.624225 116.30796315402394 17.991589  28.71505
                 80 "Djibouti" 4 2016   5 0 0 0 1  21.68014  6.834109  8.624225  119.9506990508946 17.999819   28.6327
                 81 "Djibouti" 4 2017  18 0 0 0 1  21.73539  6.850126  8.624225  118.0508730741472 18.005774  28.62391
                 82 "Djibouti" 4 2018  11 0 0 0 1  21.82614  6.865891  8.624225 114.73583941656598 18.011744 28.696005
                 83 "Djibouti" 4 2019  16 0 0 0 1  21.92462  6.881411  8.624225 118.98830760972584 18.017166  28.68835
                 84 "Djibouti" 4 2020   8 0 0 0 1  21.94244  6.895683  8.624225 119.55762057345862 18.021412  28.64777
                 85 "Egypt"    5 2000 437 0 0 0 0  25.32682 11.139424  8.148525 162.49231375876593 17.891115  28.13912
                 86 "Egypt"    5 2001 398 0 0 0 0  25.29472 11.158434  8.148525  147.6858482081173 17.894962   28.1281
                 87 "Egypt"    5 2002 483 0 0 0 0 25.167635 11.177243  8.148525 128.92413619331938 17.899227  28.20992
                 88 "Egypt"    5 2003 452 0 0 0 0  25.10889 11.195828  8.148525  90.92762793704465 17.903782 28.352316
                 89 "Egypt"    5 2004 530 0 0 0 0 25.089956 11.214142  8.148525  85.25882826006497 17.909029  28.51554
                 90 "Egypt"    5 2005 371 0 0 0 0  25.21863 11.232205  8.148525  95.39480373776983  17.91672 28.565084
                 91 "Egypt"    5 2006 628 0 0 0 0  25.40007 11.249923  8.148525  96.58727189669217 17.923546  28.63057
                 92 "Egypt"    5 2007 586 0 0 0 0  25.59416 11.267434  8.148525                100 17.931602 28.764416
                 93 "Egypt"    5 2008 640 0 0 0 0   25.8159  11.28522  8.148525 106.84963042063566 17.939798  28.70905
                 94 "Egypt"    5 2009 681 0 0 0 0  25.96579  11.30387  8.148525  126.7576031043439 17.946838  28.51718
                 95 "Egypt"    5 2010 646 0 0 0 0  26.11226 11.323712  8.148525   136.359186745893  17.95482  28.54375
                 96 "Egypt"    5 2011 794 0 0 0 0 26.187054  11.34485  8.148525  133.6262978332196  17.96316  28.61493
                 97 "Egypt"    5 2012 650 0 0 0 0 26.354897 11.366998  8.148525 144.73312794054914 17.969774 28.631344
                 98 "Egypt"    5 2013 775 0 0 0 0  26.38773 11.389684  8.148525 133.89175620005244 17.976044 28.661816
                 99 "Egypt"    5 2014 892 0 0 0 0  26.44553 11.412276  8.148525 143.29238841457533 17.983675 28.758274
                100 "Egypt"    5 2015 671 0 0 0 0  26.52044 11.434347  8.148525  163.4962700609313 17.991589  28.71505
                end

                And the results are

                Code:
                . ppmlhdfe import lgdp ldis lpop reer reeruk brexit comwealth comlang epas locked, cluster(c
                > ountrycode)
                Iteration 1:   deviance = 2.5198e+04  eps = .         iters = 1    tol = 1.0e-04  min(eta) =
                >   -4.06  P  
                Iteration 2:   deviance = 1.7268e+04  eps = 4.59e-01  iters = 1    tol = 1.0e-04  min(eta) =
                >   -5.82     
                Iteration 3:   deviance = 1.6271e+04  eps = 6.13e-02  iters = 1    tol = 1.0e-04  min(eta) =
                >   -6.73     
                Iteration 4:   deviance = 1.6234e+04  eps = 2.26e-03  iters = 1    tol = 1.0e-04  min(eta) =
                >   -6.95     
                Iteration 5:   deviance = 1.6234e+04  eps = 9.07e-06  iters = 1    tol = 1.0e-04  min(eta) =
                >   -6.96     
                Iteration 6:   deviance = 1.6234e+04  eps = 2.67e-10  iters = 1    tol = 1.0e-05  min(eta) =
                >   -6.96   S O
                --------------------------------------------------------------------------------------------
                > ----------------
                (legend: p: exact partial-out   s: exact solver   h: step-halving   o: epsilon below toleran
                > ce)
                Converged in 6 iterations and 6 HDFE sub-iterations (tol = 1.0e-08)
                 
                PPML regression                                   No. of obs      =        378
                                                                  Residual df     =         17
                Statistics robust to heteroskedasticity           Wald chi2(10)   =    2064.22
                Deviance             =  16233.91619               Prob > chi2     =     0.0000
                Log pseudolikelihood = -8976.996006               Pseudo R2       =     0.8363
                 
                Number of clusters (countrycode)=        18
                                           (Std. Err. adjusted for 18 clusters in countrycode)
                ------------------------------------------------------------------------------
                             |               Robust
                      import |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                        lgdp |   1.384281   .1722157     8.04   0.000     1.046744    1.721818
                        ldis |  -.5067533   .2499219    -2.03   0.043    -.9965911   -.0169154
                        lpop |  -.6043001   .0976471    -6.19   0.000    -.7956849   -.4129152
                        reer |  -.0004605   .0013847    -0.33   0.739    -.0031744    .0022535
                      reeruk |      .0126    .014375     0.88   0.381    -.0155745    .0407745
                      brexit |  -.3322666   .1506878    -2.21   0.027    -.6276093   -.0369239
                   comwealth |  -1.341288   .3242805    -4.14   0.000    -1.976866   -.7057102
                     comlang |   2.319684   .3467017     6.69   0.000     1.640161    2.999207
                        epas |   .4103758   .5499069     0.75   0.456    -.6674219    1.488173
                      locked |   -1.48389   .4783895    -3.10   0.002    -2.421516   -.5462636
                       _cons |  -19.72384   3.620822    -5.45   0.000    -26.82052   -12.62716
                ------------------------------------------------------------------------------

                Comment


                • #9
                  Dear Joseph Lubuto,

                  1. The command you are using is designed to estimate models with multiple "fixed effect" but your model has none. Anyway, if you really do not want to include fixed effects the command still works fine.
                  2. The fact that the sign of one coefficient changes if you include more variables in the model does not indicate that something is wrong. It is up to you to decide what variables you really want to include in the model.

                  Finally, I note that your sample is very small, so your results will not be reliable. That may be fine if this is an exercise for an undergrad course, but you need to address this if the purpose is something more serious.

                  Best wishes,

                  Joao

                  Comment


                  • #10
                    Thank you, Prof JS Silva for taking time to respond to my post. I do want to include the multiple fixed effects. I faced a hitch on how to recode the fixed effects for this model. I had the same feeling over the sample size. What would be a sufficient sample in this case?

                    Comment


                    • #11
                      Dear Joseph Lubuto,

                      To see how to include fixed effects, please check the help file for ppmlhdfe. Also, please use the largest possible sample and note that it will difficult to identify the effect of Brexit because it is such a recent event.

                      Best wishes,

                      Joao

                      Comment


                      • #12
                        Thank you very much for your guidance. I have decided to use quarterly data.

                        Comment

                        Working...
                        X