ge_gravity2

The command

ge_gravity2 solves and simulates a gravity model with a positive supply elasticity, as decribed in the article by Campos, Reggio, and Timini (2024). This new command can be used to simulate any model within the universal gravity framework defined by Allen et al (2020). The ge_gravity2 command extends a pre-existing command with the name ge_gravity (Baier et al 2019; Zylkin, 2019).

Documentation

The documentation for the command is available in this PDF file. This file also describes a prototypical trade model belonging to the universal gravity class, and derives in a self-contained manner all the results needed to run counterfactual simulations, including a step-by-step explanation of the algorithm used to solve for price changes in equilibrium.

Suggested citations

If you use this command in your work, consider citing

Campos, Rodolfo G., Iliana Reggio, and Jacopo Timini (2024). "GE_GRAVITY2: Stata module to solve a gravity model within the universal gravity class,"
Statistical Software Components, Boston College Department of Economics, https://ideas.repec.org/c/boc/bocode/s459317.html.

and

Campos, Rodolfo G., Iliana Reggio, and Jacopo Timini (2024). "ge_gravity2: a command for solving universal gravity models," arXiv:2404.09180.

Installation

The latest version of the command can be installed directly from within Stata:

ssc install ge_gravity2, replace

Once installed, take a look at the command’s help file by typing:

help ge_gravity2

Stata example

In this example we want to simulate the general equilibrium effect of the North American Free Trade Agreement (NAFTA), a trade agreement signed by Canada, Mexico, and the United States, that entered into force in 1994. We believe that the partial equilibrium effect of the trade agreement is 0.5, meaning that countries that are part of this trade agreement are expected to increase their trade flows with other members by exp(0.5) - 1 = 65%, if nothing else changes (i.e., in partial equilibrium). We want to obtain the general equilibrium effect of this agreement according to a universal gravity model, assuming a trade elasticity of 5.03 and a supply elasticity of 1.24. We can do this with the following code:

clear all
** Load example data
use https://github.com/rolf-campos/ge_gravity2/raw/main/examples/ge_gravity2_example_data.dta
describe

** Generate an indicator of NAFTA
gen nafta = 0
replace nafta = 1 if iso_o == "CAN" & (iso_d == "MEX" | iso_d == "USA")
replace nafta = 1 if iso_o == "MEX" & (iso_d == "CAN" | iso_d == "USA")
replace nafta = 1 if iso_o == "USA" & (iso_d == "CAN" | iso_d == "MEX")

** Generate the partial equilibrium effect of NAFTA
local beta = 0.500
gen partial_effect = `beta' * nafta

** Obtain general equilibrium effects of NAFTA and report a table with results.
** We use a trade elasticity of 5.03 and a supply elasticity of 1.24.
ge_gravity2 iso_o iso_d flow partial_effect if year==1990, theta(5.03) psi(1.24) results

To see all output that was generated by the command run

ereturn list

References

Allen, T., C. Arkolakis and Y. Takahashi, 2020, Universal Gravity, Journal of Political Economy, 128(2), 2020, 393-433 (ungated link)

Baier, S. L., Y. V. Yotov, and T. Zylkin (2019), On the widely differing effects of free trade agreements: Lessons from twenty years of trade integration, Journal of International Economics, 116, 206–226.

Campos, R. G., I. Reggio, and J. Timini (2024), ge_gravity2: a command for solving universal gravity models, arXiv:2404.09180.

Zylkin, T. (2019), GE_GRAVITY: Stata module to solve a simple general equilibrium one sector Armington-CES trade model, Statistical Software Components, Boston College Department of Economics, https://ideas.repec.org/c/boc/bocode/s458678.html.

Rodolfo G. Campos
Rodolfo G. Campos
Economist

My research interests include macroeconomics, social insurance, and international economics.