The gravity model of trade: specification and PPML estimation

Did the trade agreement increase exports? Does a common language matter? The gravity model is the workhorse of international trade dissertations, and estimating it correctly has changed a lot since the 2000s.

2 min readReviewed 2026-11-25Stata · R
M

Made for: Master's dissertation student

Your data is ready. The model isn't cooperating.

Sound familiar?

  • The Hausman test says one thing and your supervisor says another
  • Stata or EViews throws errors you can't decode at 1 a.m.
  • You're not sure your results are even the right ones to report
  • The deadline is fixed, and your supervisor has 20 other students

We diagnose your model, run it with you, and explain every number so you can defend it.

The basic idea

Trade between two countries rises with their economic size and falls with the distance between them, like Newton's gravity (Tinbergen, 1962):

ln(Xᵢⱼ) = β₀ + β₁ ln(GDPᵢ) + β₂ ln(GDPⱼ) + β₃ ln(Distᵢⱼ) + β₄ Contigᵢⱼ + β₅ Langᵢⱼ + β₆ RTAᵢⱼ + εᵢⱼ

Typical regressors: distance, common border, common language, colonial ties, regional trade agreements (RTA), tariffs.

Modern best practice

  1. Multilateral resistance (Anderson & van Wincoop, 2003): trade between i and j depends on their barriers with all partners. With panel data, control for it with exporter-year and importer-year fixed effects.
  2. Pair fixed effects control for all time-invariant bilateral factors (distance, language) and reduce endogeneity of trade agreements (Baier & Bergstrand, 2007). The RTA effect is then identified from changes over time.
  3. PPML (Santos Silva & Tenreyro, 2006): Poisson pseudo-maximum likelihood estimates the model in levels. It handles zero trade flows (which logs drop) and is consistent under heteroskedasticity, where log-linear OLS is biased.
  4. Use intervals (e.g. every 3–5 years) rather than consecutive years, so trade can adjust to policy changes (Yotov et al., 2016).
  5. Include intra-national trade flows where available, to identify effects of non-discriminatory policies.
* Stata: ssc install ppmlhdfe
ppmlhdfe trade rta, absorb(exp#year imp#year exp#imp) cluster(exp#imp)
library(fixest)
m <- fepois(trade ~ rta | exp^year + imp^year + exp^imp, data = df, cluster = ~exp^imp)

Interpreting PPML coefficients

For a dummy like RTA, the effect is (exp(β) − 1) × 100%. A coefficient of 0.25 means about 28% more trade.

Data sources

Trade flows: UN Comtrade, IMF Direction of Trade Statistics, CEPII BACI. Gravity variables: the CEPII Gravity database. Agreements: WTO RTA database, the Mario Larch RTA database. GDP: World Bank WDI.

Thesis ideas

  • The trade effect of the African Continental Free Trade Area (AfCFTA) or EU association agreements.
  • Does a common currency or language raise trade within MENA?
  • Effects of non-tariff measures on agricultural exports.

Frequently asked questions

Can I still use OLS with logs?

As a robustness check, yes, but reviewers expect PPML with the appropriate fixed effects as the main specification.

My sample has many zeros. Is that a problem?

Not with PPML, which includes zeros naturally. That's one of its main advantages.