Announcement

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

  • ppml gravity

    Dear all, I am currently using ppml for gravity estimates. The aim is to estimate the impact of COMESA RTA on egypt (21 destinations and 24years)
    The dependent variable is trade value, the key variable is regional trade intensity index (TII) between Egypt and COMESA member states, and the control variables are GDP, ln Distance, comlng, comcol, cointg and exixtance of RTA and so on.

    In group estimates I control for the 21 importing countries FE and the 24 year FE. (21 destinations and 24years, 504 obs)
    I run the ppml command even before including the TII variable of interest just the traditiona model to check my understanding before going on (ppmlhdfe to account for time series fixed effect if i correctly understand), also i use the product of gdp for the two countries (destination and origination) instead separate gdp for each alone. however results were:

    - some of them inconsistent with the theory (contig was negative sign)
    - very large number of coefficients
    - all tests statistics seems incorrect.

    I tried using once ppml and once ppmlhdfe, also once using fixed effect's dummies for importers and once using fixed effects for both importers' dummies and years dummies. i generated only dummies for importers and years not exproters as Egypt is the only exporter the interest country. trade data used is tradeflow_baci from baci (defined as a combination of both trade from from originating and destination countries from comtrade)

    it is my fist time running gravity and use stata ( i have read the gravity stata tutorial and the log gravity paper attached earlier)

    Here is the Stata coding & Group result:

    egen years = group (year)
    tabulate years, generate (year_dum_)
    drop importer imp_dum_1
    egen importer = group ( iso3_d)
    tabulate importer, generate (imp_dum_)
    gen gdp_both = gdp_o*gdp_d
    ppml tradeflow_baci ln_dist gdp_both contig comlang_off comcol col45 fta_wto imp_dum_* , cluster (dist)
    ppml tradeflow_baci ln_dist gdp_both contig comlang_off comcol col45 fta_wto imp_dum_* year_dum_* , cluster (dist)
    ppmlhdfe tradeflow_baci ln_dist gdp_both contig comlang_off comcol col45 fta_wto imp_dum_* , cluster (dist)
    ppmlhdfe tradeflow_baci ln_dist gdp_both contig comlang_off comcol col45 fta_wto imp_dum_* year_dum_* , cluster (dist)



    results

    ppmlhdfe tradeflow_baci ln_dist gdp_both contig comlang_off comcol col45 fta_wto imp_dum_* year_dum_* , cluster (dist)
    note: 6 variables omitted because of collinearity: comcol col45 imp_dum_14 imp_dum_18 imp_dum_21 year_dum_24
    (simplex method dropped 44 separated observations)
    note: 2 variables omitted because of collinearity: imp_dum_5 year_dum_23
    Iteration 1: deviance = 1.4594e+07 eps = . iters = 1 tol = 1.0e-04 min(eta) = -3.33 P
    Iteration 2: deviance = 8.0351e+06 eps = 8.16e-01 iters = 1 tol = 1.0e-04 min(eta) = -5.31
    Iteration 3: deviance = 6.7562e+06 eps = 1.89e-01 iters = 1 tol = 1.0e-04 min(eta) = -7.31
    Iteration 4: deviance = 6.5399e+06 eps = 3.31e-02 iters = 1 tol = 1.0e-04 min(eta) = -9.05
    Iteration 5: deviance = 6.5029e+06 eps = 5.69e-03 iters = 1 tol = 1.0e-04 min(eta) = -10.38
    Iteration 6: deviance = 6.4981e+06 eps = 7.43e-04 iters = 1 tol = 1.0e-04 min(eta) = -11.10
    Iteration 7: deviance = 6.4978e+06 eps = 3.65e-05 iters = 1 tol = 1.0e-04 min(eta) = -11.29
    Iteration 8: deviance = 6.4978e+06 eps = 1.93e-07 iters = 1 tol = 1.0e-05 min(eta) = -11.30
    Iteration 9: deviance = 6.4978e+06 eps = 7.49e-12 iters = 1 tol = 1.0e-06 min(eta) = -11.30 S O
    ------------------------------------------------------------------------------------------------------------
    (legend: p: exact partial-out s: exact solver h: step-halving o: epsilon below tolerance)
    Converged in 9 iterations and 9 HDFE sub-iterations (tol = 1.0e-08)
    warning: missing F statistic; dropped variables due to collinearity or too few clusters

    PPML regression No. of obs = 460
    Residual df = 20
    Statistics robust to heteroskedasticity Wald chi2(44) = .
    Deviance = 6497837.661 Prob > chi2 = .
    Log pseudolikelihood = -3251090.571 Pseudo R2 = 0.9359

    Number of clusters (dist) = 21
    (Std. Err. adjusted for 21 clusters in dist)
    ------------------------------------------------------------------------------
    | Robust
    tradeflow_~i | Coef. Std. Err. z P>|z| [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    ln_dist | 11.39495 2.316592 4.92 0.000 6.854511 15.93538
    gdp_both | -5.92e-18 1.30e-17 -0.45 0.650 -3.15e-17 1.96e-17
    contig | 3.871812 .8481098 4.57 0.000 2.209548 5.534077
    comlang_off | 13.8791 2.297996 6.04 0.000 9.375107 18.38309
    comcol | 0 (omitted)
    col45 | 0 (omitted)
    fta_wto | .0419435 .350196 0.12 0.905 -.6444281 .7283151
    imp_dum_1 | 4.24781 .8169043 5.20 0.000 2.646707 5.848913
    imp_dum_2 | 3.172436 .5699914 5.57 0.000 2.055274 4.289599
    imp_dum_3 | -15.55345 2.085441 -7.46 0.000 -19.64083 -11.46606
    imp_dum_4 | -4.002251 .5444245 -7.35 0.000 -5.069304 -2.935199
    imp_dum_5 | 0 (omitted)
    imp_dum_6 | 13.74753 2.478609 5.55 0.000 8.889548 18.60552
    imp_dum_7 | 11.26567 1.837679 6.13 0.000 7.663891 14.86746
    imp_dum_8 | 7.8649 1.015164 7.75 0.000 5.875214 9.854585
    imp_dum_9 | -.9851897 .4389226 -2.24 0.025 -1.845462 -.1249172
    imp_dum_10 | .5288706 .1707211 3.10 0.002 .1942633 .8634778
    imp_dum_11 | -.7043201 .3777703 -1.86 0.062 -1.444736 .036096
    imp_dum_12 | .6716981 .1650034 4.07 0.000 .3482973 .9950988
    imp_dum_13 | 5.415667 .9256168 5.85 0.000 3.601492 7.229843
    imp_dum_14 | 0 (omitted)
    imp_dum_15 | -7.65986 1.193812 -6.42 0.000 -9.999689 -5.320032
    imp_dum_16 | -2.433565 .3906172 -6.23 0.000 -3.199161 -1.66797
    imp_dum_17 | .2324094 .3041389 0.76 0.445 -.363692 .8285108
    imp_dum_18 | 0 (omitted)
    imp_dum_19 | 7.034955 1.11339 6.32 0.000 4.852752 9.217159
    imp_dum_20 | 1.374118 .1261484 10.89 0.000 1.126871 1.621364
    imp_dum_21 | 0 (omitted)
    year_dum_1 | -5.928018 .7428856 -7.98 0.000 -7.384047 -4.471989
    year_dum_2 | -4.22082 .4336887 -9.73 0.000 -5.070834 -3.370805
    year_dum_3 | -3.146946 .3117169 -10.10 0.000 -3.7579 -2.535993
    year_dum_4 | -2.767452 .3284705 -8.43 0.000 -3.411243 -2.123662
    year_dum_5 | -2.730146 .2648513 -10.31 0.000 -3.249245 -2.211047
    year_dum_6 | -2.16234 .2149933 -10.06 0.000 -2.58372 -1.740961
    year_dum_7 | -1.98349 .2716086 -7.30 0.000 -2.515834 -1.451147
    year_dum_8 | -1.518698 .2574354 -5.90 0.000 -2.023262 -1.014134
    year_dum_9 | -1.521982 .2192202 -6.94 0.000 -1.951646 -1.092318
    year_dum_10 | -.6910147 .3172665 -2.18 0.029 -1.312846 -.0691838
    year_dum_11 | -.2972755 .2320943 -1.28 0.200 -.7521721 .157621
    year_dum_12 | -.1959205 .2757415 -0.71 0.477 -.7363638 .3445229
    year_dum_13 | .0348227 .2898825 0.12 0.904 -.5333365 .6029819
    year_dum_14 | -.1734793 .1493608 -1.16 0.245 -.466221 .1192624
    year_dum_15 | .1952659 .3456458 0.56 0.572 -.4821874 .8727191
    year_dum_16 | .1519303 .2952438 0.51 0.607 -.4267369 .7305976
    year_dum_17 | -.0171544 .2447286 -0.07 0.944 -.4968136 .4625048
    year_dum_18 | -.1144079 .1458738 -0.78 0.433 -.4003152 .1714994
    year_dum_19 | -.0654412 .1602286 -0.41 0.683 -.3794834 .248601
    year_dum_20 | -.0573402 .0842962 -0.68 0.496 -.2225578 .1078773
    year_dum_21 | .0873872 .1268624 0.69 0.491 -.1612585 .3360329
    year_dum_22 | .2555083 .1591663 1.61 0.108 -.0564519 .5674685
    year_dum_23 | 0 (omitted)
    year_dum_24 | 0 (omitted)
    _cons | -88.22315 19.91845 -4.43 0.000 -127.2626 -49.18371
    ------------------------------------------------------------------------------

    .




  • #2
    Dear zeinab Mamdouh,

    Please see my reply here.

    Best wishes,

    Joao

    Comment


    • #3
      Thank you for your quick reply, I check your reply ion the post as captured here

      (You are not using the command correctly; please check the syntax of the command in the help file. You probably want to do something like

      Code:
      ppmlhdfe exports pta, a(exp_time imp_time pair_id) cluster(pair_id) 1. However my regression here includes 1 exporting country of interest (Egypt) aganist 21 importing countries (COMESA member states) so I included only fixed effect dummies for importers not exporter (am i correct?) . having said so should i use egen command use group importer and year together (egen imp_time = group (iso_d year)) or each one separately (egen imp = group (iso_d) and egen time = group (year))

      2. should cluster by (pair_id) as the post you pointed to or clustering by distance is fine.
      3. should i continue use ppmlhdfe since i am using only one importer , 21 exporter , 24 years time dimension .or just ppml is fine since it is one exporter

      4. is my sample size is two small that is why results is not correct (504 observation) or am I fine with it.
      5. what is the { ,a (..........)} before the cluster option in the regression you propose stands for . I have been searching for it in stata in veil.

      thanks a lot for your kind guidance


      Comment


      • #4
        1. That is correct and you should the variable using iso_d and year together.
        2. Should be indifferent.
        3. Stick with ppmlhdge; ppml is slower but will give exactly the same results.
        4. It is small.
        5. That is the set of fixed effects to "absorb"; check the help file.

        Comment

        Working...
        X