Announcement

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

  • Country—year fixed effects and Country—pair fixed effects in gravity model

    Dear Prof.Tom, Prof.Joao and other Statalsists,
    I am a postgraduate student from China, I am working with a gravity model and want to include ‘country-year fixed effects’ and ‘country-pair fixed effects’ in my model and a panel of 14 countries—91country pairs(14×13÷2)—across 20 years. To control for unobserved heterogeneity, I have already include country-pair fixed effects, but I also want to include fixed effects into my model for the country--year combination, regardless of whether the country is an exporter or an importer.
    The gravity model is as follow:
    Click image for larger version

Name:	1.png
Views:	1
Size:	1.9 KB
ID:	1399197


    Where Xijt is the trade flow from country i to j in year t.
    Click image for larger version

Name:	3.png
Views:	1
Size:	306 Bytes
ID:	1399198

    is the country pair fixed effect which controls for the impact on trade of the distance between countries, and any unobserved characteristics of the country pair that are constant over time. The fixed effect
    Click image for larger version

Name:	5.png
Views:	1
Size:	297 Bytes
ID:	1399200

    (exporter—year) captures the change in country i ’ s overall exports in year t. The fixed effect
    Click image for larger version

Name:	6.png
Views:	1
Size:	326 Bytes
ID:	1399201

    (importer—year) captures the change in country j ’ s overall imports in year t. FTA dummy valuables means Free Trade Agreement. The effect on trade of not only GDP and population but also other variables that are more difficult to measure such as infrastructure, factor endowments, multilateral trade liberalition or openness, and unobserved time—specific shocks are captured by the exporter—year and importer—year fixed effects. (Just like and in the equation)
    My original Stata commands are something like this:
    reghdfe lnexport fta1 fta2 fta3, absorb(i.exporter#i.year i.importer#i.year) vce(cluster exporter#importer)
    But I am afraid that makes sense as it means one fixed effect for every exporter—year and importer—year, not capture the change in country i or j ‘ overall exports/imports in year t. Professors, can you show me the Stata code to achieve my requirement (capture the change in country i or j ‘ overall exports/imports in year t) ?
    I would be extremely grateful for any suggestions.
    Thank you very much!
    Karen
    Attached Files
    Last edited by Karen Gao; 24 Jun 2017, 02:28.

  • #2
    Tom Zylkin Joao Santos Silva You are all word famous economists on Trade and Stata,can you help me to look at this question? Thank you very much!

    Comment


    • #3
      Dear Karen,

      I am happy to do the best I can to help. I am not quite sure I follow what you see as the issue with using exporter-time and importer-time fixed effects. It sounds like you are concerned that they do not capture changes over time in total exports and total imports. But the distinction you are making is a bit confusing to me, since, by construction, these fixed effects would absorb total exports and total imports were you to try to include them (as well as all other exporter- and importer- specific variables). Perhaps I am not following you correctly and you have something else in mind. If so, I'd be happy to talk more.

      Regards,
      Tom

      PS: Thank you very much for the kind words. It is nice to be heard of. But really I am not so famous, nor a professor just yet (still just a humble postdoc I.)

      Comment


      • #4
        . reghdfe lnrex fta1 fta2 fta3,absorb(i.cty1#i.year i.cty2#i.year) vce(cluster cty1#cty2)
        (converged in 4 iterations)
        note: fta2 omitted because of collinearity
        note: fta3 omitted because of collinearity

        HDFE Linear regression Number of obs = 3,640
        Absorbing 2 HDFE groups F( 1, 181) = 5.49
        Statistics robust to heteroskedasticity Prob > F = 0.0202
        R-squared = 0.7988
        Adj R-squared = 0.7637
        Within R-sq. = 0.0036
        Number of clusters (cty1#cty2) = 182 Root MSE = 0.8486

        (Std. Err. adjusted for 182 clusters in cty1#cty2)
        ------------------------------------------------------------------------------
        | Robust
        lnrex | Coef. Std. Err. t P>|t| [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        fta1 | .8213017 .3504746 2.34 0.020 .1297602 1.512843
        fta2 | 0 (omitted)
        fta3 | 0 (omitted)
        ------------------------------------------------------------------------------

        Absorbed degrees of freedom:
        ---------------------------------------------------------------+
        Absorbed FE | Num. Coefs. = Categories - Redundant |
        -------------+-------------------------------------------------|
        cty1#year | 280 280 0 |
        cty2#year | 260 280 20 |
        ---------------------------------------------------------------+


        Dear Doc.Zylkin
        Thank you for your reply. But this my reghdfe results. where 'lnrex' is the natural log of export, 'cty1' and "cty2" means 'exporter' and 'importer' respectively. ‘fta1’,’fta2’ and ’fta3’ are Free Trade Agreement(FTA) dummy variables, namely trade creation effects within the trade-bloc(fta1), trade creation/diversion effects in the term of export/import between intra-bloc countries and extra-bloc countries(fta2) (fta3),using a panel data approach that controls for all country-and-time and time-invariant country-pair unobserved heterogeneity.
        As we can see, 'fta2' and 'fta3' omitted because of collinearity. Tom, do you have any idea what I might be doing wrong?
        Best regards,
        Karen

        PS: ( http://www.sciencedirect.com/science...43951X14000285 ) Tom, look at this web link, It was the paper that I referenced. I just want to know how to achieve equation (4) of table 2 in Stata, namely page 146. I am not sure that my Stata code is right enough. Do you know how to achieve equation (4) in Stata ? It’s better to show me the Stata code. Thank you very much!
        (by the ways, there is a website that you can download the paper for free, but there is some difference on the layout of tables of the second web. On the later website all tables of the paper are at the end of the paper. https://www.econstor.eu/dspace/bitst.../736533540.pdf )


        Comment


        • #5
          Dear Karen,

          I am not familiar with the paper you linked, although I do myself have a similar paper on trade diversion effects of FTAs (so I better make sure I give you a good answer here). The answer obviously depends on how you define fta2 and fta3. The fundamental problem with this kind of analysis is the collinearity between your FTA variables and your exporter-time and importer-time fixed effects (as you can plainly see from your output).

          Basically, if you define fta2 as 1 for all exports from an FTA member country to a non-member, the sum of fta1+fta2 is always equal to 1 for any exporter that belongs to an agreement at time t. This means there will be collinearity with the exporter-time FE. The same is true for fta1+fta3 on the import side.

          I can't speak for what the authors of that paper have done, so I think it would be better to contact them directly and ask what they did. But I will just add that, in our own work on trade diversion (going from memory here), the trick we used to get around the collinearity problem was to include "domestic sales" (i.e., the "X_ii" term) in the regression as an additional component of the reference group with fta1=0 for the X_ii's - i.e., you can't have a free trade agreement with yourself (or you always have "free trade" internally, either or). I don't necessarily recommend going to these lengths though, as obtaining consistently measured internal trade can be a real pain as there are often a lot of data problems to solve. Instead, I would suggest interacting fta2 and fta3 with some sort of bilateral variable that reflects which of your trade partners might reasonably be expected to be more vulnerable to trade diversion (distance for example, though this is just a suggestion).

          Hope this helps!

          Tom
          Last edited by Tom Zylkin; 27 Jun 2017, 04:18.

          Comment


          • #6
            I would suggest interacting fta2 and fta3 with some sort of bilateral variable that reflects which of your trade partners might reasonably be expected to be more vulnerable to trade diversion (distance for example, though this is just a suggestion).
            Dear Doc.Zylkin
            Thank you for your suggestions and I can’t appreciate more! it really helps me,but I still have two questions:
            1, you suggested me to interact fta2 and fta3 with dist. while after controlling exporter—year fixed effect, importer—year fixed effect, and country—pair fixed effect, how can I make sure that the coefficient of fta1 is ‘best linear unbiasedness property(BLUE)’ ?
            2, if I get the regression result of the interaction terms of fta2 and fta3 with dist, how to explain the coefficient of the interaction terms? How to figure out the magnitude of trade creation and trade diversion effects?
            Thank you very much! By the ways, Tom, I find your paper’ PPML_PANEL_SG: Stata module to estimate "structural gravity" models via Poisson PML’ published in ’Statistical Software Components’ (2016) . It’s a remarkable paper! Can I ask your some questions about PPML though the Email you leave in the paper? Thank you!
            Best regards,
            Karen

            Comment


            • #7
              Hi Karen,

              Originally posted by Karen Gao View Post
              Dear Doc.Zylkin
              Thank you for your suggestions and I can’t appreciate more! it really helps me,but I still have two questions:
              1, you suggested me to interact fta2 and fta3 with dist. while after controlling exporter—year fixed effect, importer—year fixed effect, and country—pair fixed effect, how can I make sure that the coefficient of fta1 is ‘best linear unbiasedness property(BLUE)’ ?
              Not sure how to answer this one for you. What sort of bias are you worried about here?

              2, if I get the regression result of the interaction terms of fta2 and fta3 with dist, how to explain the coefficient of the interaction terms? How to figure out the magnitude of trade creation and trade diversion effects?
              You would interpret them as "the degree of trade diversion increases/decreases by xx% with bilateral distance." Note this will only give you a statement about relative magnitudes. You are not going to be able to distinguish between the (absolute) magnitudes of trade creation vs. trade diversion effects with the exporter-time and importer-time FEs.

              Thank you very much! By the ways, Tom, I find your paper’ PPML_PANEL_SG: Stata module to estimate "structural gravity" models via Poisson PML’ published in ’Statistical Software Components’ (2016) . It’s a remarkable paper! Can I ask your some questions about PPML though the Email you leave in the paper? Thank you!
              Best regards,
              Karen
              Thank you very much! And sure thing - feel free to email me.

              Tom
              Last edited by Tom Zylkin; 29 Jun 2017, 01:29.

              Comment


              • #8
                Thank you,Tom. Thank you very much!
                Karen

                Comment

                Working...
                X