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

  • Gravity equation estimated through Bonus Vetus OLS

    Dear Stata users,

    Following Agostino and Trivieri (2014), I would like to adopt the Bonus Vetus OLS for a gravity equation (Baier and Bergstrand, 2009).
    My problem is that I do not know how to code in Stata to apply a first-order Taylor expansion to the multilateral resistance terms of the Anderson and van Wincoop (2003) model, as follows:

    MRX_ij = Σ[(GDP_k / GDP_w) * X_ik] + Σ[(GDP_m / GDP_w) * X_mj] - ΣΣ[(GDP_k / GDP_w) * (GDP_m / GDP_w) * X_km]

    Where i is an exporter and j an importer; X_ij are observed proxies of bilateral trade costs (e.g.: distance, common language, common currency); indexes k and m represent countries partners of i and j, respectively; X_ij=X_ji, in the sense that, for example, the distance between i and j is the same distance between j and i; GDP_w represents World GDP.

    Additionally, the data goes annually from 2006 to 2016, which makes me believe that the above equation requires an index t, because, despite X_ik being time-invariant, GDP will be time-variant.

    My sample consider exporting data from 1 exporter to 40 importers, however I have data about X_ij for all country pairs ij.
    Here is my first question: can I apply such methodology having trade data for only one exporter? Or I only need data for GDP and X variables? For example, Agostino and Trivieri (2014) has 3 exporters and 211 importing countries.

    Then the second question is: if it is possible to follow this methodology, can someone help me with the Stata code?

    Referred literature:
    Agostino, M., Trivieri, F., 2014. Geographical indication and wine exports. An empirical investigation considering the major European producers. Food Policy, 46, 22-36.
    Anderson, J.E., van Wincoop, E., 2003. Gravity with gravitas: a solution to the border puzzle. Am. Econ. Rev. 93 (1), 170–192.
    Baier, S.L., Bergstrand, J.H., 2009. Bonus vetus OLS: a simple method for approximating international trade-cost effects using the gravity equation. J. Int. Econ. 77, 77–85.

  • #2
    Hi Anthony,
    I think Keith Head and Thierry Mayer have some code for this on their gravity webpage.


    • #3
      Thank you for your advice Tom.

      In fact they have some code available to estimate Bonus Vetus OLS for a Monte Carlo but they use an ado file called BVU.ado (or BVW.ado for the GDP-weighted version) also available in the website. It is not a Stata command as, for example, regress or ppml, where we have options, an help file, etc.

      Following their DO file, I can make the following regression to estimate the coefficient for ldis and fta_wto, using lXrealnorm as a dependent variable:
       BVU Y_i Y_n iso_o iso_d ldis fta_wto lXreal lYi lYn lXrealnorm Xr cnum_i cnum_n
      However, I am not able to include more variables. For example, if I use the following code to add the regressor comcur:
       BVU Y_i Y_n iso_o iso_d ldis fta_wto comcur lXreal lYi lYn lXrealnorm Xr cnum_i cnum_n
      It will assume that the dependent variable is the 10th variable (lYn) again instead of lXrealnorm, and will consider only ldis and fta_wto as regressors.

      I was not able to find a Stata program to do a Bonus Vetus OLS estimation as, for example, in the R package “gravity”.

      Best regards,


      • #4
        Hi Anthony,
        You're right that Head and Mayer's code is only set up to do the particular Monte Carlo they do. I did not realize that. It looks like it will need to be modified so that it can handle more than just two regressors (likely by adding a for loop).

        If you're interested in coding it yourself you will need to change lines 4-17 to something like

        syntax varlist [if] [in], iso_o(varname) iso_d(varname)
        tokenize `varlist'    
        local lXinnorm `1'
        macro shift
        local RHSvars `*'
        unab RHSvars: `*'
        Then if you input the following in Stata

        BVU lXrealnorm ldis fta_wto comcur, iso_o(iso_o) iso_d(iso_d)
        The command will always take the first variable name to be "lXinnorm" and will also record "iso_o" and "iso_d" consistently with how they currently have it set up

        But after that you would have to re-write their code so that it loops across the different variable names in RHSvars and de-means them consistently with what they have done. You will have to study their code and modify it appropriately though. Hope this is at least a little bit helpful.



        • #5
          Thank you Tom for your help.
          I am not very good at coding, so I think that modifying their code may lead me to some mistakes.
          I prefer trying R package “gravity”.
          Best regards,