Announcement

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

  • PPML estimation for gravity model

    Dear all,

    I am running a PPML model for a trade gravity model( details: 51 countries over 8 years; relatively small dataset) and want to include partner country fixed effects. My dataset is for one origin country and a set of countries, rather than bilateral trade flows between sets of countries. My current regression is as follows:

    xtpoisson imports lgdp lgdpt ldist customsunion contiguous, robust i(country) fe

    where gdp is partner country's GDP and gdpt is the origin country's GDP(specifically Turkey). Customsunion and contiguous are dummy variables.

    Would I be correct in saying that the xtpoisson command already includes country pair fixed effects? If not, do I need to create dummy variables for each country pair? I have tried to look online but could not find any sources dealing directly with this question.
    And that my standard errors are clustered at the country level and robust in the above command?

    Thank you in advance

  • #2
    Dear Yasemin,

    Indeed, you are including the fixed effects you want and using the right standard errors.

    Best wishes,

    Joao

    Comment


    • #3
      Dear Professor Silva,

      Thank you very much for your response. Additionally, I want to run the Ramsey RESET test for this model by following the code on he Log of Gravity page (http://personal.lse.ac.uk/tenreyro/reset.do) however the fitted squared values are dropped when added to the xtpoisson regression due to collinearity. Is there a way around this problem? I tried to follow the discussion in the forum (https://www.statalist.org/forums/for...-fixed-effects). I used the predicted values generated by the codes for the auto dataset example and then squared them, included them in the original xtpoisson regression and then tested their coefficient- is this an appropriate way of running the Ramsey Reset test? Perhaps I misunderstood the codes because when I did the above the test yhat2=0 command dropped the constraint and gave no p value. Am I missing something here?

      Thank you in advance,

      Yasemin

      Comment


      • #4
        Dear Yasemin,

        It looks as if you are doing something wrong. Please post the code you are using.

        Best wishes,

        Joao

        Comment


        • #5
          Dear Professor Silva,

          This is what happens if I run the reset test using the codes provided on the thread, with the last 3 lines of code coming from the log of gravity page:

          Code:
          xtpoisson imports lgdp lgdpt ldist customsunion contiguous, robust i(country1) fe
          predict double fitted, xb
          gen double yhat=exp(fitted)
          egen meany=mean(imports) , by(country1)
          egen meanyhat=mean(yhat), by(country1)
          gen double exp_alpha=meany/meanyhat if meanyhat>0 
          replace yhat=yhat*exp_alpha if meanyhat>0
          (459 real changes made)
          gen yhat2=yhat^2
          xtpoisson imports lgdp lgdpt ldist customsunion contiguous yhat2, robust
          test yhat2=0
          and there are no results; the p value and Chi2 value is blank

          If I follow the codes just from the log of gravity page,without modifying the fitted values, it drops the fitted squared values when added to the original equation which means I cannot test the fitted squared values anymore.
          Thank you in advance

          Comment


          • #6
            Dear Yasemin,

            You are not doing it correctly because for the RESET you need the estimate of the linear index, not the prediction of trade. Try something like

            Code:
            xtpoisson imports lgdp lgdpt ldist customsunion contiguous, robust i(country1) fe
            predict double fitted, xb
            gen double yhat=exp(fitted)
            egen meany=mean(imports) , by(country1)
            egen meanyhat=mean(yhat), by(country1)
            gen double exp_alpha=meany/meanyhat if meanyhat>0
            replace yhat=yhat*exp_alpha if meanyhat>0
            gen xbhat2=(log(yhat))^2
            xtpoisson imports lgdp lgdpt ldist customsunion contiguous xbhat2, robust
            test xbhat2=0
            Best wishes,

            Joao

            Comment


            • #7
              Dear Professor Silva,

              Thank you very much for the codes!

              Comment

              Working...
              X