Announcement

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

  • Estimation of gravity model of trade using PPML, fixed effects

    Dear all,

    I want to estimate the gravity model using the ppml. To control for the MRT I have set exporter and importer time varying fixed effects using this command:
    Code:
    tab gdp_exp, gen(exporteryear_)
    tab gdp_imp, gen(importeryear_)
    For the PPML command I have:

    Code:
    ppml import loggdpimp loggdpexp logpimp logpexp logdist Dsanc Dlan Dbor exporteryear_* importeryear_*
    Unfortunately I get no results using this command on stata. It takes forever and Stata seems to run the regression, the only thing I get is this note:

    note: checking the existence of the estimates
    My question is, are the exporter and importer dummies correct? Do I have an alternative to control for MRTs using another command?

  • #2
    Homa,

    Try the command ppml_panle_sg; it is much faster for this kind of application.

    Best wishes,

    Joao

    Comment


    • #3
      Dear Joao Santos Silva ,

      thank you for your response. I ran the command:
      Code:
      ppml_panel_sg import loggdpimp loggdpexp logpimp logpexp logdist Dsanc Dlan Dbor, ex(exporter) im(importer)y(year) nopair
      and got this error:
      insufficient observations
      r(2001);
      Here is the sum of my data:

      Code:
      . sum
      
          Variable |        Obs        Mean    Std. Dev.       Min        Max
      -------------+---------------------------------------------------------
              year |      9,512        2002     8.36704       1988       2016
          country1 |          0
           iso_imp |          0
           iso_exp |          0
            import |      9,512    1.80e+08    1.12e+09        1.1   3.03e+10
      -------------+---------------------------------------------------------
           gdp_imp |      9,512    2.59e+11    8.11e+11   1080.561   1.86e+13
           gdp_exp |      9,512    2.60e+11    8.11e+11        107   1.86e+13
             p_imp |      9,512    5.23e+07    9.60e+07      68755   1.38e+09
             p_exp |      9,512    5.23e+07    9.60e+07      68755   1.38e+09
              dist |      9,512    5961.116    3963.541    540.446   17141.34
      -------------+---------------------------------------------------------
               lan |        116           1           0          1          1
               bor |        406           1           0          1          1
               san |      1,795    .2674095    .4427311          0          1
         loggdpimp |      9,512    24.90255    2.124178   6.985236    30.5555
         loggdpexp |      9,512    24.91128    2.172856   4.672829    30.5555
      -------------+---------------------------------------------------------
           logpimp |      9,512    16.96712     1.61164    11.1383   21.04438
           logpexp |      9,512    16.96712     1.61164    11.1383   21.04438
           logdist |      9,512    8.448982     .744238   6.292395   9.749249
             Dsanc |      9,512    .0504626     .218909          0          1
              Dlan |      9,512    .0121951    .1097619          0          1
      -------------+---------------------------------------------------------
              Dbor |      9,512    .0426829    .2021519          0          1
           country |      9,512       164.5    94.68998          1        328
          importer |      9,512    76.53963    34.40382          1        165
          exporter |      9,512    76.53963    34.40382          1        165
      I don't understand where the error comes from. What do you think sir?

      Comment


      • #4
        Dear Homa,

        I suggest you contact the authors of the command.

        Best wishes,

        Joao

        Comment


        • #5
          Ok, I'll do it. Thank you Joao Santos Silva . Best, Homa

          Comment


          • #6
            Dear Tom Zylkin,

            I do not have much experience using ppml_panle_sg. Would you please take a look at my data and the problem I'm facing? It would be awesome! Thank you in advance.

            Comment


            • #7
              Dear Joao Santos Silva,

              I applied some tricks and could run the ppml command with importer and exporter dummies! Here is the command:

              Code:
              ppml import loggdpimp loggdpexp logpimp logpexp logdist Dsanc Dlan Dbor Dimp* Dexp* year_*
              And here is the result: ( only the coefficients of interest for simplicity's sake)
              Code:
              Number of parameters: 361
              Number of observations: 9512
              Number of observations dropped: 0
              Pseudo log-likelihood: -2.633e+11
              R-squared: .928788
              ------------------------------------------------------------------------------
                           |               Robust
                    import |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                 loggdpimp |   1.132046   .0883858    12.81   0.000     .9588129    1.305279
                 loggdpexp |   1.231915   .0704439    17.49   0.000     1.093848    1.369983
                   logpimp |    .578808   .1488387     3.89   0.000     .2870896    .8705264
                   logpexp |   .3734077   .2619459     1.43   0.154    -.1399968    .8868122
                   logdist |  -1.089109   .2862648    -3.80   0.000    -1.650178   -.5280402
                     Dsanc |  -.4244898   .0745165    -5.70   0.000    -.5705394   -.2784402
                      Dlan |   1.591854   .3413182     4.66   0.000     .9228828    2.260825
                      Dbor |   -.904043   .3603001    -2.51   0.012    -1.610218   -.1978678
              .
              .
              .
              .
               year_29 |   .0327447    .131005     0.25   0.803    -.2240205    .2895098
                     _cons |  -49.51446   5.858231    -8.45   0.000    -60.99638   -38.03254
              ------------------------------------------------------------------------------
              Number of regressors dropped to ensure that the estimates exist: 7
              Dropped variables:  Dimp9 Dimp59 Dimp148 Dexp1 Dexp70 Dexp83 year_25
              Option strict is off
              The coefficients have a higher level than coefficients resulting from the OLS regression. Since in your paper "the log of gravity" the PPML estimation got smaller coefficients than the OLS, should I be concerned about my results? Thank you for your help.

              Comment


              • #8
                Originally posted by homa haddad View Post
                Dear Tom Zylkin,

                I do not have much experience using ppml_panle_sg. Would you please take a look at my data and the problem I'm facing? It would be awesome! Thank you in advance.
                Dear Homa,
                I'd be happy to take a look a closer look at your data to see what is causing the problem with ppml_panel_sg. It looks like you were able to achieve what you were going for with ppml, but please feel free to email me if you ever need to use ppml_panel_sg for your research.
                Regards,
                Tom

                Comment


                • #9
                  Dear homa haddad,

                  I believe you are including in your model importer and exporter characteristics that should not be included when you have importer and exporter dummies. Using ppml_panel_sg would help with that. So, maybe you should follow up on Tom Zylkin's kind offer.

                  Best wishes,

                  Joao

                  Comment


                  • #10
                    DearJoao Santos Silva ,

                    I followed your suggestion and discussed the issue I have with Tom Zylkin. I got really helpful advices from him and used the poi2hdfe command, as my dataset was not square. Here is the result:

                    Code:
                    poi2hdfe import1 loggdpimp loggdpexp logpimp logpexp logdist Dsanc Dlan Dbor year_*, id1(exp) id2(imp)
                    
                    Dropping exp groups for which import1 is always zeros
                    
                    Total Number of observations used in the regression -> 9367
                    
                    Starting Estimation of coefficients
                    
                    1 dif is -> 263.87923
                    2 dif is -> .88462613
                    3 dif is -> .78570317
                    4 dif is -> .47922415
                    5 dif is -> .22449422
                    6 dif is -> .09474546
                    7 dif is -> .05612353
                    8 dif is -> .03423796
                    9 dif is -> .01788093
                    10 dif is -> .00736692
                    11 dif is -> .00281278
                    12 dif is -> .0007891
                    13 dif is -> .00012874
                    14 dif is -> .00003796
                    15 dif is -> .00001659
                    16 dif is -> 4.337e-06
                    17 dif is -> 3.080e-07
                    18 dif is -> 1.542e-09
                    
                    Coefficients converged after 18 reghdfe calls
                    
                    
                     ******* Poisson Regression with Two High-Dimensional Fixed Effects **********
                    
                                                                    Number of obs     =      9,367
                    ------------------------------------------------------------------------------
                                 |               Robust
                         import1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                       loggdpimp |   1.132046   .0885372    12.79   0.000     .9585161    1.305576
                       loggdpexp |   1.231915   .0705646    17.46   0.000     1.093611    1.370219
                         logpimp |    .578808   .1490937     3.88   0.000     .2865898    .8710263
                         logpexp |   .3734077   .2623947     1.42   0.155    -.1408765    .8876919
                         logdist |          0  (omitted)
                           Dsanc |  -.4244898   .0746442    -5.69   0.000    -.5707897     -.27819
                            Dlan |          0  (omitted)
                            Dbor |          0  (omitted)
                          year_1 |    1.59724    .265999     6.00   0.000     1.075891    2.118588
                          year_2 |   1.701557   .2586135     6.58   0.000     1.194684     2.20843
                          year_3 |   2.152632   .2441069     8.82   0.000     1.674192    2.631073
                          year_4 |   1.421192   .2058134     6.91   0.000     1.017805    1.824579
                          year_5 |   3.419411   .2805368    12.19   0.000     2.869569    3.969253
                          year_6 |   2.893661    .262118    11.04   0.000     2.379919    3.407403
                          year_7 |   2.405252   .2452033     9.81   0.000     1.924662    2.885841
                          year_8 |   1.846082   .2246121     8.22   0.000      1.40585    2.286313
                          year_9 |   1.710722   .2149643     7.96   0.000     1.289399    2.132044
                         year_10 |   1.730028   .2098566     8.24   0.000     1.318717     2.14134
                         year_11 |    1.70484   .2138328     7.97   0.000     1.285735    2.123944
                         year_12 |   1.434204   .2211158     6.49   0.000     1.000825    1.867583
                         year_13 |   1.809136   .2048561     8.83   0.000     1.407626    2.210647
                         year_14 |    1.73383   .1990534     8.71   0.000     1.343692    2.123967
                         year_15 |   1.728628   .1991251     8.68   0.000      1.33835    2.118906
                         year_16 |   1.608781   .1768353     9.10   0.000      1.26219    1.955371
                         year_17 |   1.428643   .1627806     8.78   0.000     1.109599    1.747687
                         year_18 |   1.261635    .149493     8.44   0.000     .9686343    1.554636
                         year_19 |   1.122973   .1241564     9.04   0.000     .8796311    1.366315
                         year_20 |   .8207016   .1059854     7.74   0.000     .6129739    1.028429
                         year_21 |   .7202783   .1085713     6.63   0.000     .5074824    .9330742
                         year_22 |   .6247063   .0959396     6.51   0.000     .4366681    .8127445
                         year_23 |   .4285563   .0886198     4.84   0.000     .2548647    .6022478
                         year_24 |   .1697519    .081832     2.07   0.038     .0093643    .3301396
                         year_25 |  -.0448062   .0988734    -0.45   0.650    -.2385945     .148982
                         year_26 |          0  (omitted)
                         year_27 |   .1756412   .0947305     1.85   0.064    -.0100273    .3613097
                         year_28 |    .062862   .1126554     0.56   0.577    -.1579385    .2836625
                         year_29 |  -.0120616   .1212996    -0.10   0.921    -.2498043    .2256812
                    I have two questions. Do you know how I can obtain the R-squared of the regression? I couldn't find any informations regarding to this.
                    And my second question is: how could I predict the potential trade?

                    I have only this part, and missing the rest:

                    Code:
                     predict poi2hdfe , xb
                    gen potential_trade = exp(poi2hdfe)
                    I would be extremely grateful for your response.

                    Regards, Homa

                    Comment


                    • #11
                      Dear homa haddad,

                      I suggest you contact the author of poi2hdfe about these issues.

                      Best wishes,

                      Joao

                      Comment

                      Working...
                      X