Announcement

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

  • Country-pair specific id for gravity model

    Hello all,

    I'm trying to estimate a gravity model with trade data that is disaggregated at industry level and trying to include country-pair fixed effects in my regression. I'm aware when you want to generate country pair id, you egen pairid = group(importer exporter). But what I have been wondering is when you generate pair id like above, that means a pair of USA(importer) and Canada(exporter) would be different from a pair of Canada(importer) and USA(exporter).

    So my question is, is it right to run regression with country-pair fe with pair ids just like above? From my understanding, we include country-pair fe to observe heterogeneity between each country pair. So then, wouldn't it be more appropriate for me to have the same pair id for the pair of USA and Canda regardless of which one of these two country is importer or exporter? (Canada USA(imp)-Canada(exp) and Canada(imp)-USA(exp) both pair should have the same pair id since they both pairs are comprised of the same countries) Secondly, if so, then what is the command I can use to generate the same pair id for the USA and Canada regardless of them being importer or exporter?

    Thank you

  • #2
    Dear Irene Lee,

    As you say, the standard practice is to use fixed effects by directed pair, constructed with the group command you describe above. The reason for this is that there is no reason to expect that the determinants of trade from A to B are the are as those of trade from B to A. Now, for clustering you may want to use undirected pairs because shocks that affect trade from A to B are likely to affect trade from B to A. For this reason, people often cluster standard errors by distance.

    Having said this, I do not know a command to create undirected pairs and when I need those I create them manually. If anyone knows how to do that, I would be grateful for the information.

    Best wishes,

    Joao

    Comment


    • #3
      Joao Santos Silva Thank you so much for your explanation. I now have clearer view on why we use directed pairs for country-pair fe. You mentioned that for clustering we cluster se by distance. So does that mean if I, say, run reghdfe, the command would look something like
      Code:
      reghdfe Y X1 X2 ... , a(country-pair ind-year) vce(cl distance)
      ?

      And I have one more question about running regressions with disaggregated trade data. So I first tried to run my regression using xtreg. However I realized I cannot do that since I have repeated time values within my panel. I have 17 industries and 24 years under each country-pair and my variable of interest is moving at country-pair dimension while my independent variable is moving at industry dimension. So that doesn't allow me to
      Code:
      xtset pairid year
      Also, I'm trying to include industry-time fixed effects in my regression but too many dummy variables (17*24=408), so there is no other way but to use reghdfe.

      So when you reghdfe, you don't necessarily set up panel id and time and also in the regression result you don't have between r-squared result but only within r-squared. Any reason for this? Is there anything to do with panel id set up?

      Comment


      • #4
        Dear Irene Lee

        Indeed, you should just do xtset id, without specifying the time variable. What I would note is that you should not estimate the model by OLS but by Poisson pseudo maximum likelihood; for that you need the command ppmlhdfe.

        Best wishes,

        Joao

        Comment


        • #5
          Dear Joao Santos Silva I am running a gravity model with country-pair and importer/exporter year fixed effects using the reghdfe command and was wondering if I need to xtset origin my data set even if running reghdfe.

          Thank you,

          Jack

          Comment


          • #6
            Dear Jack Andrew Ryan,

            I do not think you need to xtset the data,but it does not hurt. Try both ways and see what happens.

            Best wishes,

            Joao

            Comment

            Working...
            X