Announcement

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

  • Gravity model of international trade

    Hi,
    I working on the gravity model of international trade, my i= 378, t=14, so I have 5000+ observations. My model is suffering by heteroskedasticity and autocorrelation. Therefore I need to use robust standard errors. I have many time invariant dummies therefore I don´t want to use FE because then very important variables will be omitted from the model (as distance, language, borders...)

    I tried POLS, FE, RE as:
    xtset i t
    xtscc y x1 x2 x3 ....
    xtreg y x1 x2 x3...., fe vce(robust)
    xtreg y x1 x2 x3...., re cluster(i) or xtgls y x1 x2 x3, panels(correlated) corr(psar1)

    Because of LM, RE > POLS and because of BP, FE >POLS. Because of heteroskedasticity, I shouldn´t use standard Hausman test, therefore I tried auxilliary regressions as:
    qui xtreg y x1 x2 x3...., re
    scalar lambda_hat = 1 - sqrt(e(sigma_e)^2/(e(g_avg)*e(sigma_u)^2+e(sigma_e)^2)
    gen in_sample = e(sample)
    sort i t
    qui foreach var of varlist y x1 x2 x3.... {
    by i: egen `var’_bar = mean(`var’) if in_sample
    gen `var’_re = `var’ - lambda_hat*`var’_bar if in_sample // GLS-transform
    gen `var’_fe = `var’ - `var’_bar if in_sample // within-transform }
    But STATA says: "invalid syntax" and I don´t know where is the problem
    Threrefore I don´t know, if RE is suitable.

    Is there any option how to solve which of these estimations is the best one? If I will have to use FE, is there any way how to keep omitted variables in my model? I think that the gravity model without variables as distance is not gravity model anymore. Therefore I want to keep time invariant variables in the model.

    Thank you very much.
    My data set looks like .png in the attachment


    Attached Files

  • #2
    Your invalid syntax error is not related to the RE vs FE decision -- the issue is with one of your lines of syntax but you don't give us any details on which line is biting. You do give us some of the pseudo code like the excerpt below:

    Code:
    qui foreach var of varlist y x1 x2 x3.... {
    by i: egen `var’_bar = mean(`var’) if in_sample
    gen `var’_re = `var’ - lambda_hat*`var’_bar if in_sample // GLS-transform
    gen `var’_fe = `var’ - `var’_bar if in_sample // within-transform }
    where there are several potential errors including:
    1. the "qui foreach var of varlist y x1 x2 x3... {." part which we don't see all of,
    2. the last closing brace } on the last line should be on a separate line, and
    3. the "by i:" should probably be "bysort i"

    Try setting trace on or reporting back to the list exactly which line of code produces the invalid syntax line.


    Also, for your RE v. FE discussion, I find this helpful: http://vi.unctad.org/tpa/web/docs/ch3.pdf

    Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

    Comment


    • #3
      Dear Tomas,

      Most researchers do not use either FE or RE when estimating gravity equations. In general what is done is to include dummies for origin and destination.

      Also, did you consider estimating your model in levels using Poisson pseudo maximum likelihood (PPML)?

      Best regards,

      Joao

      Comment


      • #4
        Thank you very much both for your reply.

        There is print screen of auxilliary regression in the attachment. I don´t know where is the problem but I verify that the FE is better than RE through xtoverid command after RE regression.

        Dear Joao: I heard about this method in literature but I quite new in STATA and maybe I haven´t got enough econometric skills for that. This model is for my Bachelor thesis therefore I´m not so experienced in these advanced techniques. I know that FE and RE aren´t perfect and I don´t want to use these methods but POLS seems to be inconsistent in comparison with FE or RE.

        I´m working with bilateral trade between countries (EXij+EXji). Therefore I shouldn´t include dummies for origin and destination.

        I thought that maybe I should work only with cross-sectional data when I add dummies for all years (+13 dummies for 14 years) instead of standard POLS. Do you think that it should work better than POLS, RE, FE?

        Or there is any option how to estimate parameters that are omitted from FE regression in STATA?

        Thank you.

        Best regards,
        Tom
        Attached Files

        Comment


        • #5
          Hi Joao,

          I am using the Gravity Model in my Master;s thesis.
          My research question is the following To identify whether tariff and non-tariff barriers are significant in affecting India’s exports of Environmentally Preferred Products using the gravity model framework.

          Following is my equation

          lnRealexportse,i,t = β0 + β1(lnGDPe,t) + β2(lnGDPi,t) +β3(lnPOPe,t) + β4(lnPOPi,t) +β5(lnRERe,i,t) + β6(lnDistancee,i) + β7Languagei + β8Adjacenti + β9Developingi + β10Landlockedi + β11(lnTariffi) +β12NTMe,i,t + β13RTAe,i,t + μ


          Tariff data is MFN and NTM is qualitative data (dummy)

          There are about 300 products I have identified at HS 6 level.

          I want to know how to construct a dataset and considering I have export data for 300 products over a span of 1996-2014 for India;s exports to over 100 countries.

          How to create IDs and how my data set should look like.

          After this I will have to figure out the best way to estimate model.

          Comment


          • #6
            Tomas #4:

            The quotation marks around local macros look wrong. They should be ` ' i.e. char(96) and char(39)

            The command starting sort should start bysort

            Please don't post code as .png. Post code using CODE delimiters. See http://www.statalist.org/forums/help#stata

            Comment


            • #7
              baanie #5: Please start a new thread. It's OK to repost that question. Too confusing otherwise.

              Comment


              • #8
                As I said, Hausman test is not a problem anymore because I test it through xtoverid command after RE regression. It said that the FE is better than RE.

                It tried PPML and it works but parametrs were very different from FE or POLS. Is there any option how I should test what is the best estimation technique?

                Thank you all.

                Comment


                • #9
                  Dear Tomas,

                  It is not surprising that PPML gives very different results; that is why it is important.

                  A simple way to check the adequacy of the models is to perform a RESET test. In the page we maintain about the estimation of gravity equations we have the code to do the RESET for PPML.

                  All the best,

                  Joao

                  Comment

                  Working...
                  X