Announcement

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

  • (Country) fixed effects for bilateral trade data in gravity model

    Hello everyone,

    I'm currently working on a Gravity Model and I'm quite confused about how to properly set up the fixed effects model.

    I have bilateral trade data in the following form:
    Country_i Country_j Year DepententVar IndepententVar PairID
    A B 2000 1232 2736 AB
    A B 2001 1234 2536 AB
    A B 2002 2716 2352 AB
    B C 2000 3242 3435 BC
    B C 2001 2342 2354 BC
    B C 2002 2344 3345 BC
    Now, I would like to add time fixed effects and afterwards country fixed effects in a separate regression.
    My understanding is, I have to use xtset and then xtreg instead of reg, because I have time values. So I set up:
    Code:
    xtset PairID Year, yearly
    For the time fixed effects I then use
    Code:
    xtreg DependentVar IndependentVar i.Year, fe robust
    For the country fixed effects I use
    Code:
    xtreg DependentVar IndependentVar i.Country_i i.Country_j i.Year, fe robust
    Now, I noticed the results of these two regressions are exactly the same. Which, after I thought about it, makes sense, as I set up xtset with PairID and Year.
    I searched the forum and the internet about how to set up fixed effects in a bilateral model (or gravity model) properly and came across the following code:
    Code:
    tab (Year), gen (Year_)
    egen expyear = group(Country_i Year)
    egen impyear = group(Country_j Year)
    tab(expyear), gen(expyear_)
    tab(impyear), gen(impyear_)
    xtreg DependentVar IndependentVar impyear_* expyear_* Year_*, robust
    This code is from the practical guide to trade policy analysis https://vi.unctad.org/tpa/web/vol1/vol1home.html
    I assume the regression above would be for country fixed effects, so then only time fixed effects would be:
    Code:
    xtreg DependentVar IndependentVar Year_*, robust
    I also came across the idea of setting up the country fixed effects like this:
    Code:
    xtreg DependentVar IndependentVar i.Country_i##i.Country_j i.Year, fe robust
    But I thought i.Var1##i.Var2 is interacting these two with each other, so I'm not sure if this code is right at all.

    I thought using i.Variable automatically treats the variable as a dummy, so I assume using Year_* instead of i.Year is the same, but Year_* is the "manual" way instead of the "automatic" way. Is this assumption right?

    I'm confused which regressions are "right" when using fixed effects for the gravity model and where my errors in my first assumptions are. I hope someone could clarify this.
    Any help is much apprechiated, thank you very much in advance!

  • #2
    Marie:
    one of the Stata contributors who has an outstanding track of publications coupled with academic research interest in gravity model is Joao Santos Silva : let's hope he will chime in.
    In the meanwhile, you may want to search for his posts on this forum concerning gravity model.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      I've recently been working with a gravity model of trade and found this entire thread very useful:
      https://www.statalist.org/forums/for...pml-panel-data


      Its long but has tons of tips throughout.
      For some further reading on fixed effects options, I'd recommend https://www.nber.org/papers/w12516.pdf
      And for execution in Stata, read up on:
      ppml
      ppml_panel_sg
      ppmlhdfe
      (all linked/referred to in that discussion)

      Comment


      • #4
        Dear Marie Hanemann,

        Typically gravity models include time-varying origin and destination fixed effects and you may also include pair fixed effects. Therefore, simple time fixed effects are generally not included. The commands Jorrit suggested, especially ppmlhdfe will be helpful but note that they estimate Poisson regressions rather than OLS.

        One thing that puzzles me is that you say that the results of the first two regressions was exactly the same; that does not sound right to me; am I missing something?

        Best wishes,

        Joao

        Comment


        • #5
          Dear Prof.
          I have a very basic query regarding pair fixed effects. The dependent variable is India's exports to a sample of 55 countries and exports from these 55 countries to India. Is it correct to specify gravity with pair fixed effects?
          I would really appreciate the help.
          Thank you.
          Best regards
          Richa

          Comment


          • #6
            Dear Richa Khurana,

            Do you mean that you do not have data for pairs not including India but have just exports to India and from India and only for 55 countries? If that is the case, may main concern would be that your dataset is rather poor. About the FE, you need to decide what is better in your case, but it is typical to include origin and destination FE.

            Best wishes,

            Joao

            Comment


            • #7
              Dear Prof.,

              Yes, I do not have data for pairs not including India, as the purpose here is to see the impact of FTA on Indian trade flows. Following some studies which say that the specification with time and pair fixed effects would be the best (since my data does not allow introduction of country- time and pair fixed effects), I am not sure if it is correct to include pair fixed effects or even cluster by pair ids. Sir, if needed can I include pair fixed effects?"
              Thank you for your guidance.
              Best regards
              Richa

              Comment


              • #8
                If you need them, you can include them. The question is whether you need them but only you can answer that.

                Joao

                Comment


                • #9
                  Dear Sir,
                  Thank you very much for answering my query. I will check for the specifications again.
                  I really appreciate all the help.
                  Best regrads,
                  Richa

                  Comment


                  • #10
                    Dear Joao Santos Silva,

                    I am also attempting to include the exporter-year, importer-year, and country-pair fixed effects in my gravity model using an OLS regression, however, I am not certain about the commands to use.
                    Would you please help me with this?

                    I would really appreciate the help.

                    Thank you very much for your time.

                    Yours sincerely,
                    Miyu Shu

                    Comment


                    • #11
                      Dear Miyu Shu,

                      If you are estimating a gravity equation you should not be using OLS; try the ppmlhdfe command it makes it easy to include the fixed effects you want.

                      Best wishes,

                      Joao

                      Comment


                      • #12
                        Dear Joao Santos Silva,

                        I am trying to estimate the impact of the Eurasian economic union (EAEU) on bilateral trade flows of its members. The estimation is carried out by implementing the gravity model of international trade. The results are obtained from the panel data covering the aggregate manufacturing sector of 50 countries (5 of them are members of the EAEU) over the period 1996-2017. I am using ppmlhdfe in Stata 13.0 since the panel data is very large. The model ise estimated by country pair fixed effects and country time fixed effects. In line with similar studies I creatied several dummies aimed to capture the impact of the integration.
                        The variable EAEU_both is equal to 1 if both exporter and importer variables represent a member of the EAEU and year >2014, EAEU_importer ==1 if only an importer is from the EAEU & year>2014, EAEU_exporter ==1 if only an exporter is from the EAEU & year>2014. When I include all 3 dummies (in order to capture trade creation and trade diversion effects), EAEU_importer and EAEU_exporter are omitted. If I include only one of them they generate exactly the same results. Since 3 memeber states formed the custom union 4 year before foration of the EAEU I also tried to estimate the same regression with the 2 dummies EAEU_both and CU_both, where CU_both is equal to 1 if an exporter and importer were member states of the custom union. The sign of CU_both is signifcant but negative. That seems to be strange.

                        Could you explain why this problem with the dummies occur?


                        Comment


                        • #13
                          Dear Sveta Kovaleva,

                          I am not sure if I fully understand the model you are estimation, but it looks to me as if the coefficients on your dummies (and on the CU?) are not identified due to the fixed effects that you are using. Now, ppmlhdfe should be able to deal with that, so either I am nor understanding what you are doing, or you found a case where the command is not able to deal with the collinearity. I suggest that you start by making sure you understand if these dummies are perfectly collinear with the fixed effects.

                          Best wishes,

                          Joao

                          Comment


                          • #14
                            Dear Joao Santos Silva,

                            I"ll try to explain once more.
                            I am interested in where the EAEU is trade diverting or trade creating. In line with previous studies I introduced two dummies:
                            EAEU_both = 1 if the importer and exporter are both members of the EAEU at time t and 0 otherwise;
                            EAEU_importer = 1 if the importer belongs to the EAEU but the exporter does not.

                            Then I estimate the standard gravity model with ppmlhdfe.
                            The dummy EAEU_importer is omitted if I account for both country-pair fixed effects and time-varying exporter and importer fixed effects. When I account only for country-pair fixed effects then both dummies stay in the regression.

                            Furthermore, I tried another specifications:

                            xi: ppmlhdfe import ln_GDP_exporter ln_GDP_importer ln_popul_exporter ln_popul_importer ln_distance i.contiguity i.common_lang2 i.same_country i.year i.CCT_both i.CCT_importer i.FTA if exporter!=importer, cluster(pair_id importer_year exporter_year) a (pair_id)

                            where CCT_both = 1 if the importer and exporter are both members of the Custom union at time t and 0 otherwise;
                            CCT_importer = 1 if the importer belongs to the Custom union but the exporter does not.

                            The custom union was formed several years earlier than the EAEU and included only 3 member-states (instead of 5).
                            In this case even if account for both types of fixed effects all dummies are not omitted. However, they have negative sign that seems to be unreliable.

                            Thank you!

                            Comment


                            • #15
                              Sorry, Sveta Kovaleva, I do not know enough about the problem to be able to help you.

                              Best wishes,

                              Joao

                              Comment

                              Working...
                              X