The theory of the gravity equation

Advanced International Economics

I Made Krisna Gupta

2025-02-25

Intro

  • We learn on the theoretical model of gravity equation: from theory to empirics.

  • some development of problems and how to tackle ’em

  • Preparation on practicing with gravity model.

  • main text is Yotov et al. (2016) chapter I

Why gravity model

  • Gravity model is very intuitive.

  • It has a strong theoretical foundation.

  • Structure is pretty flexible. Can be applied to labor market, investment, environment, etc.

  • Remarkable predictive power (with some caveats).

  • fit for your empirical thesis.

Setting

Now let \(Q_i\) be the supply of a good from country \(i\) which is fixed with factory gate \(i\).

The value of a domestic production in a country \(i\) thus

\[ Y_i=p_iQ_i \]

\(Y_i\) is also the nominal income of the country i.

Setting

Meanwhile, let \(E_i=\phi_iY_i\) be the total expenditure of the country i. \(0 < \phi_i < 1\) would represent a fraction of \(Y_i\) that is spent to be consumed. Therefore, a \((1-\phi_i)Y_i\) is a net export.

Consequently, \(\phi>1\) would suggest a net-import economy (i.e., trade deficit).

We can add a time index \(t\) if needed. Maybe later.

Setting

Suppose consumers in a country j have a representative CES-utility function

\[ \left\{ \sum_i \alpha_i^{\frac{1-\sigma}{\sigma}} c_{ij}^{\frac{\sigma-1}{\sigma}} \right\}^{\frac{\sigma}{\sigma-1}} \]

Where \(\sigma>1\) is the elasticity of substitution among varieties of goods from country i. \(\alpha_i>0\) is a CES preference parameter for good from country \(i\).

Setting

Consumer maximize its utility with a budget constraint

\[ \sum_i p_{ij}c_{ij}=E_j \]

Where \(E_j\) is a total expenditure of a country \(j\).

Meanwhile, \(p_{ij}=p_it_{ij}\) reflects a price in country i times its trade cost \(t_{ij}\geq 1\).

Think of the trade cost as an “iceberg” cost: to deliver 1 unit of its variety to country j, country i must ship \(t_{ij} \geq 1\) units, i.e. \(1/t_{ij}\) of the initial shipment melts “en route”.

Demand funtion

Optimization on \(c_{ij}\) would result in

\[ X_{ij}=\left( \frac{\alpha_i p_i t_{ij}}{P_j} \right)^{1-\sigma} E_{j} \]

where \(X_{ij}\) is the export from origin \(i\) to destination \(j\). \(P_j\) can be interpreted as a CES consumer price index:

\[ P_j=\left( \sum_j (\alpha_ip_it_{ij})^{1-\sigma} \right)^{\frac{1}{1-\sigma}} \]

Interpretation

expenditure in country \(j\) on goods from source \(i\), \(X_{ij}\), is:

  1. Proportional to \(E_j\). i.e., countries with large expenditure buys more from many countries.

  2. inversely related to the (delivered) prices of varieties from origin \(i\) to destination \(j\). Its not just \(p_i\) but also \(t_{ij}\).

  3. Directly related to price index \(P_j\), which is a substitution effect.

  4. A high \(\sigma\) will magnify the substition effect.

Market clearance

We then clears the market with:

\[ Y_i=\sum_j \left( \frac{\alpha_i p_it_{ij}}{P_j} \right)^{1-\sigma} E_j \] WHich means all trade conducted by a country \(i\) (including with itself) must be equal to its total production. (i.e., \(Y_i \equiv \sum_j X_{ij} \forall i\))

If we define \(Y=\sum_i Y_i\) which is the global market, divide both equations with it, then:

Structural gravity

\[ (\alpha_i p_i)^{1-\sigma}=\frac{\frac{Y_i}{Y}}{\sum_j \left(\frac{t_{ij}}{P_j} \right)^{1-\sigma} \frac{E_j}{Y}} \]

We substitute a \(\Pi_j^{1-\sigma}\equiv \sum_j (t_{ij}/P_j)^{1-\sigma}E_j/Y\), then we get

\[ (\alpha_i p_i)^{1-\sigma}=\frac{Y_i/Y}{\Pi_i^{1-\sigma}} \]

We now plug this into our \(X_{ij}\) to get:

Structural gravity

\[\begin{align*} X_{ij}&=\frac{Y_iE_j}{Y}\left(\frac{t_{ij}}{\Pi_i P_j}\right)^{1-\sigma} \\ \Pi_{i}^{1-\sigma}&=\sum_j \left(\frac{t_{ij}}{P_j}\right)^{1-\sigma}\frac{E_j}{Y} \\ P_{ij}&=\sum_i \left( \frac{t_{ij}}{\Pi_i} \right)^{1-\sigma} \frac{Y_i}{Y} \end{align*}\]

We can decompose \(X_{ij}\) into two term: the size term (\(Y_iE_j/Y\)) and the trade cost term (\((t_{ij}/(\Pi_iP_j))^{1-\sigma}\))

Size effect

  • The size term can be interpreted as a hypothetical trade flow if there is no trade cost (ie frictionless trade).

  • That is, customers face same factory-gate price no matter where they are.

  • The size effect provides us with the intuition that:

    • large producers will export more to all destinations

    • big/rich markets will import more from all sources

    • trade flows between simiarly-sized countries will be larger.

Trade cost

  1. Bilateral trade cost between partners i and j, tij , is typically approximated in the literature by various geographic and trade policy variables, such as bilateral distance, tariffs and the presence of regional trade agreements (RTAs) between partners i and j.

  2. The structural term Pj , coined by Anderson and van Wincoop (2003) as inward multilateral resistance represents importer j’s ease of market access.

  3. The structural term Πi , defined as outward multilateral resistances by Anderson and van Wincoop (2003), measures exporter i’s ease of market access.

Gravity equation

We log-linearized \(X_ij\) to get the following:

\[\begin{align*} \ln X_{ij,t}&=\ln E_{j,t}+\ln Y_{i,t}-\ln Y_t \\ &+(1-\sigma) \ln t_{ij,t}-(1-\sigma)\ln P_{j,t} \\ &-(1-\sigma) \ln \Pi_{i,t}+\varepsilon_{ij,t} \end{align*}\]

This equation is so popular. Despite that, most students often conduct a consequential mistakes that can be easily remedied with Stata (or R) command. We learn it today so your thesis is safe.

Gravity: 2 disciplines

\[ F_{ij}=G \frac{M_iM_j}{D^2_{ij}} \]

where F=force, G=constant, M=mass, D=distance

\[ X_{ij}=\tilde{G} \frac{Y_iE_j}{T_{ij}^\theta} \]

where \(\tilde{G}\equiv 1/Y\) inverse of the world production, \(Y_i\) is the exporter’s production capacity, \(E_J\) is the importer’s expenditure.

\(T_{ij}\) is the total trade cost \((t_{ij}/(\Pi_iP_j))^{\sigma-1}\)

Multilateral resistance (MR)

  • obviously the main challenge comes from dissecting the multilateral resistance \(P_{j,t}\) and \(\Pi_{i,t}\) which are inherently observable.

  • Anderson and Wincoop (2003) conducted a nonlinear OLS by estimating a predicted trade without MR, then construct MR to account for difference with the real world trade.

  • These days, Olivero and Yotov (2016) shows that we can use exporter-time and importer-time fixed effect to account for the MR.

  • Note that these FE will absorb many all unobservables that varies by country-time, including GDP, distance, XR and policies.

Zero trade flows

  • The nice thing about linearizing the gravity equation is that we can use OLS.

  • Unfortunately, this will lead us to forefully drop zero trade.

    • obviously zero trade is not random.
  • Typical easy solution is to assign an arbitrary number to the zero trade flow (typically log 1), but this leads to a inconsistent estimate.

  • The best solution for now is the PPML approach.

Heteroscedasticity

  • Trade data is heteroscedastic: variance of larger countries are structurally differ than that of the smaller countries.

  • An OLS would bias the estimated trade policy and MR. It also inconsistent with the theory.

  • You can remedy this by weighting the trade data, but the better way is to do PPML.

    • PPML is more convinient and also fixes zero-trade problem.

Bilateral trade cost

  • This is crucial to properly model a partial and general equilibrium effect of trade.

  • The standard practice to proxy the bilateral trade cost \(t_{ij}\) is to use the following:

\[\begin{align*} (1-\sigma) \ln t_{ij}&=\beta_1 \ln D_{ij}+\beta_2 \ln CNTG_{ij} +\beta_3 \ln LANG_{ij} \\ &+\beta_4 \ln CLNY_{ij} + \beta_5 RTA_{ij,t} + \beta_6 \tilde{\tau}_{ij,t} \end{align*}\]

  • D=distance, while Contiguity, same language, and ex colonies are dummy variables.

Trade policies

  • RTA is a dummy noting whether both countries are a member of a trade agreement.

  • \(\tilde{\tau}\) is a bilateral tariff \(\ln (1+tariff_{ij,t})\)

  • Since tariff is a price shifter, which can be expressed as a terms of the trade elasticity of substitution. (i.e., \(\beta_6=-\sigma\))

This is the part where we can also add more trade policy that represents trade costs. However, the next problem is prolly the most important for trade policy enthusiasts.

The endogeneity of policies

  • Trade policies (like any policies really) are typically non-random/endogeneous.

  • Potential reverse causality problem:

    • a country would propose a trade agreements with its closest neighbor and its largest trading partner first.

    • Industry with large trade deficit would lobby for protectionist policies.

Policy endogeneity

  • It is hard to propose an instrumental variable since we can hardly find good instruments for trade policies.

  • An approach like first difference (or GMM in general) can also be used, but we still have the problem of zero trade.

  • The most practical way is to have a country-pair fixed effects to count for unobserved variables that affect trade policies.

Non-discriminatory trade policies

  • This is a policy that does not discriminate trade partners (e.g., unilateral MFN tariffs or subsidies).

  • Meaning, it will be absorbed by exporter-time or importer-time fixed effects.

  • If your variable of interest is a non-discriminatory trade policies by other countries, then an approach like building “remoteness index” to absorb MR instead of country-time FE can be the solution.

  • See Anderson and Yotov (2016) & Head and Mayer (2014)

Adjustment to shock

  • Sometimes trade patterns take time to adjust to a policy change.

  • Therefore, it’s not ideal to use annual data since we would assume the change in trade policy happens in the same year (or even month)

  • Trefler (2004) uses 3-year inter vals, Anderson and Yotov (2016) use 4-year intervals, and Baier and Bergstrand (2007) use 5-year intervals.

  • Olivero and Yotov (2012) provide empirical evidence that gravity estimates obtained with 3-year and 5-year interval trade data are very similar.

Sectoral gravity

  • Students (and myself) often estimate gravity at sectoral level because we care about specific sectoral policies.

  • Gravity estimation is separable: if we separate a sector from the general economy, it retains a gravity-like structure. i.e.:

\[ X^k_{ij,t}=\frac{Y^k_{i,t}E^k_{j,t}}{Y^k_t}\left( \frac{t^k_{ij,t}}{P^k_{j,t}\Pi^k_{i,t}} \right)^{1-\sigma_k} \]

Sectoral gravity

  • the nice feature of the this is that bilateral trade cost (which includes policy) is sector specific.

  • It can also be estimated across sectors with importer-product-time FE and exporter-product-time FE.

  • We can have a specific sector MR / policy or be pooled accross some sectors with a sleight of coding.

Practical recommendation

  1. Always use panel data when available.

  2. Experiment with lagged trade cost / policy variable.

  3. Use intra-national trade if possible. It really helps with border trade cost.

  4. Use fixed effects as discussed in previous slides.

  5. Use PPML. (4+5=use PPMLHDFE)

PPML construction

for example:

\[ X_{ij,t}=exp[\pi_{i,t}+\chi_{j,t}+\beta_1D_{ij,t}+\beta_2RTA_{ij,t}]\times \varepsilon_{ij,t} \]

\(D_{ij,t}\) is a log distance. \(\beta_1<0\) can be interpreted as an increase in D by 1% would reduce trade flow by \(\beta_1\) percent, ceteris paribus

\(RTA_{ij,t}\) is a dummy variable=1 if an RTA exists. We interpret \(\beta_2>0\) as a country would trade \(\left[e^{\beta_2}-1\right]\times 100\) more if there is a trade agreement, ceteris paribus.

Next week

Please have a look at imedkrisna.github.io/misc. Choose whether you want to use R or Stata.

Complete the preparation of installing R & RStudio or Stata.

Download everything in here. Be mindful of the size of the dataset.

Bring your laptop. We will conduct an exercise of replicating Silva & Tenreyro (2006) but also a sectoral gravity regression.

References