Announcement

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

  • Fixed effect with trade flow Gravity Model PPML

    I am running model to see the impact of RTA in africa specifically AFCFTA and COMESA as well as logistics performance index score on the trade trade flow between egypt (as exporter) vs the african countries (as importer) using gravity PPML model.
    this is my model over period (2007-2021). the results are compliant with the economic theory without using fixed effect. as follows:

    ppmlhdfe tradeflow_baci ln_dist ln_gdpcap_o ln_gdpcap_d contig comlang_off RTA LPI score , cluster (dist)

    warning: dependent variable takes very low values after standardizing (3.1139e-07)
    Iteration 1: deviance = 5.0031e+07 eps = . iters = 1 tol = 1.0e-04 min(eta) = -2.89 P
    Iteration 2: deviance = 4.4879e+07 eps = 1.15e-01 iters = 1 tol = 1.0e-04 min(eta) = -3.27
    Iteration 3: deviance = 4.4784e+07 eps = 2.13e-03 iters = 1 tol = 1.0e-04 min(eta) = -3.37
    Iteration 4: deviance = 4.4784e+07 eps = 1.43e-06 iters = 1 tol = 1.0e-04 min(eta) = -3.37
    Iteration 5: deviance = 4.4784e+07 eps = 9.39e-13 iters = 1 tol = 1.0e-05 min(eta) = -3.37 S O
    ------------------------------------------------------------------------------------------------------------
    (legend: p: exact partial-out s: exact solver h: step-halving o: epsilon below tolerance)
    Converged in 5 iterations and 5 HDFE sub-iterations (tol = 1.0e-08)

    PPML regression No. of obs = 704
    Residual df = 53
    Statistics robust to heteroskedasticity Wald chi2(7) = 329.82
    Deviance = 44783540.23 Prob > chi2 = 0.0000
    Log pseudolikelihood = -22395861.37 Pseudo R2 = 0.7132

    Number of clusters (dist) = 54
    (Std. err. adjusted for 54 clusters in dist)
    -------------------------------------------------------------------------------
    | Robust
    tradeflow_b~i | Coefficient std. err. z P>|z| [95% conf. interval]
    --------------+----------------------------------------------------------------
    ln_dist | -1.11157 .6438715 -1.73 0.084 -2.373535 .1503952
    ln_gdpcap_o | .4029311 .1822195 2.21 0.027 .0457873 .7600748
    ln_gdpcap_d | .3325304 .088916 3.74 0.000 .1582583 .5068026
    contig | .5806069 .4121333 1.41 0.159 -.2271595 1.388373
    comlang_off | .4441243 .5074212 0.88 0.381 -.5504031 1.438652
    RTA | .9452284 .2998859 3.15 0.002 .3574629 1.532994
    LPI score | .0458755 .0114115 4.02 0.000 .0235094 .0682415
    _cons | 16.91456 5.332249 3.17 0.002 6.463544 27.36558
    -------------------------------------------------------------------------------

    however when using fixed effect as follows
    egen exporter = group(iso3_o)
    egen importer = group(iso3_d)
    tabulate exporters, generate(EXP_TIME_FE)
    tabulate importers, generate(IMP_TIME_FE)


    results are not compliant with the theory and also many warnings:
    ppmlhdfe tradeflow_baci ln_dist ln_gdpcap_o ln_gdpcap_d contig comlang_off fta_wto LPIpercentile IMP_TIME_FE* , cluster (dist)
    warning: dependent variable takes very low values after standardizing (3.1139e-07)
    note: 39 variables omitted because of collinearity: IMP_TIME_FE121 IMP_TIME_FE151 IMP_TIME_FE166 IMP_TIME_FE196 IMP_TIME_FE286 IMP_TIME_FE30
    > 1 IMP_TIME_FE302 IMP_TIME_FE303 IMP_TIME_FE306 IMP_TIME_FE307 IMP_TIME_FE308 IMP_TIME_FE309 IMP_TIME_FE310 IMP_TIME_FE311 IMP_TIME_FE312 I
    > MP_TIME_FE313 IMP_TIME_FE314 IMP_TIME_FE331 IMP_TIME_FE361 IMP_TIME_FE362 IMP_TIME_FE365 IMP_TIME_FE368 IMP_TIME_FE371 IMP_TIME_FE372 IMP_
    > TIME_FE555 IMP_TIME_FE571 IMP_TIME_FE586 IMP_TIME_FE603 IMP_TIME_FE604 IMP_TIME_FE608 IMP_TIME_FE609 IMP_TIME_FE616 IMP_TIME_FE660 IMP_TIM
    > E_FE705 IMP_TIME_FE720 IMP_TIME_FE732 IMP_TIME_FE733 IMP_TIME_FE734 IMP_TIME_FE735
    Iteration 1: deviance = 7.8255e+06 eps = . iters = 1 tol = 1.0e-04 min(eta) = -2.37 P
    Iteration 2: deviance = 1.4226e+06 eps = 4.50e+00 iters = 1 tol = 1.0e-04 min(eta) = -3.37
    Iteration 3: deviance = 3.2747e+05 eps = 3.34e+00 iters = 1 tol = 1.0e-04 min(eta) = -4.37
    Iteration 4: deviance = 7.6732e+04 eps = 3.27e+00 iters = 1 tol = 1.0e-04 min(eta) = -5.37
    Iteration 5: deviance = 1.7213e+04 eps = 3.09e+00 iters = 1 tol = 1.0e-04 min(eta) = -6.37
    Iteration 6: deviance = 3.8433e+03 eps = 6.94e-01 iters = 1 tol = 1.0e-04 min(eta) = -7.37
    Iteration 7: deviance = 9.2689e+02 eps = 1.51e-01 iters = 1 tol = 1.0e-04 min(eta) = -8.37
    Iteration 8: deviance = 2.3514e+02 eps = 3.59e-02 iters = 1 tol = 1.0e-04 min(eta) = -9.37
    Iteration 9: deviance = 5.9640e+01 eps = 9.11e-03 iters = 1 tol = 1.0e-04 min(eta) = -10.36
    Iteration 10: deviance = 1.4763e+01 eps = 2.33e-03 iters = 1 tol = 1.0e-04 min(eta) = -11.35
    Iteration 11: deviance = 3.3722e+00 eps = 5.91e-04 iters = 1 tol = 1.0e-04 min(eta) = -12.33
    Iteration 12: deviance = 6.7566e-01 eps = 1.40e-04 iters = 1 tol = 1.0e-04 min(eta) = -13.26
    Iteration 13: deviance = 9.3903e-02 eps = 3.02e-05 iters = 1 tol = 1.0e-04 min(eta) = -14.08
    Iteration 14: deviance = 6.7081e-03 eps = 3.48e-07 iters = 1 tol = 1.0e-05 min(eta) = -14.67
    Iteration 15: deviance = 1.1391e-04 eps = 5.91e-09 iters = 1 tol = 1.0e-06 min(eta) = -14.94 S O
    ------------------------------------------------------------------------------------------------------------
    (legend: p: exact partial-out s: exact solver h: step-halving o: epsilon below tolerance)
    Converged in 15 iterations and 15 HDFE sub-iterations (tol = 1.0e-08)
    warning: missing F statistic; dropped variables due to collinearity or too few clusters
    Warning: Variance matrix is nonsymmetric or highly singular.

    PPML regression No. of obs = 704
    Residual df = 0
    Statistics robust to heteroskedasticity Wald chi2(703) = .
    Deviance = .0001139068 Prob > chi2 = .
    Log pseudolikelihood = -4091.25808 Pseudo R2 = 0.9999

    Number of clusters (dist) = 54
    (Std. err. adjusted for 54 clusters in dist)
    --------------------------------------------------------------------------------
    | Robust
    tradeflow_baci | Coefficient std. err. z P>|z| [95% conf. interval]
    ---------------+----------------------------------------------------------------
    ln_dist | -338.9417 . . . . .
    ln_gdpcap_o | 3.801462 . . . . .
    ln_gdpcap_d | 3.782563 . . . . .
    contig | -91.06106 . . . . .
    comlang_off | -294.6057 . . . . .
    fta_wto | -117.9866 . . . . .
    LPIpercentile | -1.584949 . . . . .
    IMP_TIME_FE1 | -142.6369 . . . . .
    IMP_TIME_FE2 | -148.6913 . . . . .
    IMP_TIME_FE3 | -147.7366 . . . . .
    IMP_TIME_FE4 | -154.2487 . . . . .
    IMP_TIME_FE5 | -154.5188 . . . . .
    IMP_TIME_FE6 | -154.1491 . . . . .
    IMP_TIME_FE7 | -147.921 . . . . .
    IMP_TIME_FE8 | -139.6954 . . . . .
    IMP_TIME_FE9 | -148.0377 . . . . .
    IMP_TIME_FE10 | -156.4992 .
    _cons | 3085.444 . . . . .
    --------------------------------------------------------------------------------

    NB: I remove the rest o the fixed effect result due to limitation in posting for the number of characters allowed. howerver all the fixed (more than 700) do apprears in the results


    I also use the command absorb ( improters) to try to solve the problems, yields either all coefficients except GDP cap become zero or no results at all as floows:

    ppmlhdfe tradeflow_baci ln_dist ln_gdpcap_o ln_gdpcap_d contig comlang_off comcol col45 fta_wto, absorb ( importer) cluster (dist)
    warning: dependent variable takes very low values after standardizing (3.1863e-07)
    note: 5 variables omitted because of collinearity: contig comlang_off comcol col45 fta_wto
    note: ln_dist is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1.0e-06)
    Iteration 1: deviance = 1.8259e+07 eps = . iters = 1 tol = 1.0e-04 min(eta) = -2.78 P
    Iteration 2: deviance = 1.1329e+07 eps = 6.12e-01 iters = 1 tol = 1.0e-04 min(eta) = -3.85
    Iteration 3: deviance = 1.0400e+07 eps = 8.93e-02 iters = 1 tol = 1.0e-04 min(eta) = -4.83
    Iteration 4: deviance = 1.0227e+07 eps = 1.69e-02 iters = 1 tol = 1.0e-04 min(eta) = -5.74
    Iteration 5: deviance = 1.0193e+07 eps = 3.34e-03 iters = 1 tol = 1.0e-04 min(eta) = -6.52
    Iteration 6: deviance = 1.0187e+07 eps = 6.12e-04 iters = 1 tol = 1.0e-04 min(eta) = -7.34
    Iteration 7: deviance = 1.0186e+07 eps = 8.02e-05 iters = 1 tol = 1.0e-04 min(eta) = -7.95
    Iteration 8: deviance = 1.0186e+07 eps = 6.17e-06 iters = 1 tol = 1.0e-05 min(eta) = -8.22
    Iteration 9: deviance = 1.0186e+07 eps = 1.15e-07 iters = 1 tol = 1.0e-06 min(eta) = -8.26 S
    Iteration 10: deviance = 1.0186e+07 eps = 5.78e-11 iters = 1 tol = 1.0e-07 min(eta) = -8.26 S O
    ------------------------------------------------------------------------------------------------------------
    (legend: p: exact partial-out s: exact solver h: step-halving o: epsilon below tolerance)
    Converged in 10 iterations and 10 HDFE sub-iterations (tol = 1.0e-08)

    HDFE PPML regression No. of obs = 747
    Absorbing 1 HDFE group Residual df = 56
    Statistics robust to heteroskedasticity Wald chi2(2) = 17.00
    Deviance = 10186142.46 Prob > chi2 = 0.0002
    Log pseudolikelihood = -5097373.499 Pseudo R2 = 0.9374

    Number of clusters (dist) = 57
    (Std. err. adjusted for 57 clusters in dist)
    ------------------------------------------------------------------------------
    | Robust
    tradeflow_~i | Coefficient std. err. z P>|z| [95% conf. interval]
    -------------+----------------------------------------------------------------
    ln_dist | 0 (omitted)
    ln_gdpcap_o | .5488741 .134331 4.09 0.000 .2855902 .812158
    ln_gdpcap_d | .3496276 .140808 2.48 0.013 .073649 .6256063
    contig | 0 (omitted)
    comlang_off | 0 (omitted)
    comcol | 0 (omitted)
    col45 | 0 (omitted)
    fta_wto | 0 (omitted)
    _cons | 11.59021 .2481093 46.71 0.000 11.10392 12.07649
    ------------------------------------------------------------------------------

    Absorbed degrees of freedom:
    -----------------------------------------------------+
    Absorbed FE | Categories - Redundant = Num. Coefs |
    -------------+---------------------------------------|
    importer | 52 0 52 |
    -----------------------------------------------------+



    or ppmlhdfe tradeflow_baci ln_dist ln_gdpcap_o ln_gdpcap_d contig comlang_off fta_wto LPIpercentile , absorb( importers) cluster (dist)
    (dropped 704 observations that are either singletons or separated by a fixed effect)
    insufficient observations
    r(2001);


    The observations are 55 african countries * time series (15 years)
    I control only for improters as there is only one exporter (egypt) vs african coutries that I am interets on the impact on its trade flow

    Questtions:

    1) is the fixed effect is a must and if yes how to solve this?
    2) is using GDP per cap is good or use GDP and pop separatly,
    3) what test should be done after running the model to test it and its significance?
    4) ehat is the min value of R2 that is accepted?


  • #2
    Dear zeinab Mamdouh,

    1) it appears to me that if you include the standard country-time fixed effects, all your variables will be wiped out. So, you may have to think again about what you want to do. In any case, you should always absorb the fixed effects.
    2) I have no strong preference on this.
    3) Maybe try the RESET test?
    4) Ignore the value of the pseudo R2 reported by ppmlhdfe; see here.

    Best wishes,

    Joao

    Comment


    • #3
      please explain more what do you mean by think about what you want to do? do yuo see some thing worng in specification. I an checking the impact of these dependant variables on trade flow to asses the most factor affect trade flow and if member states in comesa has an inpact on trade flow and the LPI score of partner country affect?
      I already used absorb in Fixed effct abd reuslted the following /: or ppmlhdfe tradeflow_baci ln_dist ln_gdpcap_o ln_gdpcap_d contig comlang_off fta_wto LPIpercentile , absorb( importers) cluster (dist)
      (dropped 704 observations that are either singletons or separated by a fixed effect)
      insufficient observations
      r(2001);

      Comment


      • #4
        Dear zeinab Mamdouh

        Is this for an undergrad project, a master's dissertation, PhD thesis, part of your job, or maybe something else?

        Best wishes,

        Joao

        Comment

        Working...
        X