EconStatsCraft Open the tool

EconStatsCraft › Gravity model of trade

Gravity model of trade

The workhorse of empirical trade, estimated the way the field actually estimates it: Poisson pseudo-maximum likelihood, which keeps the zero flows and stays consistent when the error variance moves with the regressors. Reports the log-linear regression beside it so you can see what taking logs costs.

What it needs

The intuition

Trade between two countries behaves like Newton's law: proportional to the product of their economic masses, inversely proportional to the distance between them. That analogy was noticed in 1962 and dismissed as atheoretical for twenty years, until Anderson and others derived it from proper trade models. The modern estimation problem is not the specification, which is agreed, but the fact that the obvious way to fit it - take logs, run OLS - is wrong twice over.

When to use it

Any question about what moves trade between places: does a trade agreement raise it, how much does distance still cost in an age of container ships, what would leaving a customs union do. The same model is used for migration flows, foreign direct investment and commuting.

Where the estimator comes from

The structural gravity equation is X_{ij}=\frac{Y_iE_j}{Y}\left(\frac{\tau_{ij}}{\Pi_i P_j}\right)^{1-\sigma}, where \tau_{ij} is bilateral trade cost, \sigma the elasticity of substitution, and \Pi_i, P_j the OUTWARD and INWARD multilateral resistance terms - how hard it is for i to sell anywhere and for j to buy from anywhere. Those terms are unobservable and vary by country and year, which is exactly what exporter-time and importer-time fixed effects absorb. Estimation is by PPML: maximise \sum_{ij}\left[y_{ij}\,x_{ij}'\beta-\exp(x_{ij}'\beta)\right], whose first-order condition is \sum_{ij}\left(y_{ij}-e^{x_{ij}'\beta}\right)x_{ij}=0 - a moment condition on the MEAN alone, which is why nothing about the variance or the distribution needs to hold for consistency.

The model

X_{ijt}=\exp\!\big(\beta_0+\beta_1\ln Y_{it}+\beta_2\ln Y_{jt}+\beta_3\ln d_{ij}+\beta_4 \mathrm{RTA}_{ijt}+\eta_{it}+\theta_{jt}+\mu_{ij}\big)\varepsilon_{ijt}

What it assumes

Statistical properties

How to read the output

A worked reading

On 13,464 pair-years with the elasticities built in, PPML returns distance -1.05, GDP 0.91 and 0.90, an agreement worth 0.33 - against a truth of -1.00, 0.90, 0.90 and 0.30. The log-linear regression on the same data returns -0.90 and 0.67, missing the size elasticity by a quarter, and it does so having discarded 4,416 rows - a third of the sample - because log(0) has no value. The Park-style test gives lambda = 1.57, between Poisson and Gamma, which is the sense in which the variance was "wrong" for logs all along. Nothing about this depends on the data being simulated; Santos Silva and Tenreyro found the same pattern in real trade flows.

Symptom → diagnosis → what to do

If you see thisIt meansDo this
PPML and log-OLS far apartHeteroskedasticity, as theory predictsReport PPML; the gap is the bias, not noise
Distance coefficient vanishes with pair effectsDistance does not vary within a pairCorrect. It has been absorbed, not disproved
GDP coefficients vanish with exporter-time effectsGDP varies only by country and yearSame reason; the effects contain it
Trade-agreement effect implausibly largeSelection: countries sign with partners they already trade withPair effects and lead terms, or treat it as a correlation
PPML will not convergePerfect separation, or a regressor on a wild scaleDrop separated fixed effects; scale the regressors
Standard errors tiny on 100,000 rowsNot clustered by pairThe same pair recurs every year and its shocks persist

Common mistakes

Where to read this properly

See also

Panel regression, for the fixed-effects machinery without the exponential mean. Count models, which share the Poisson likelihood but ask a different question.

Related Panel data

Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests

All analyses

Charts

Line chart · Area chart · Bar chart · Stacked bar · Scatter plot · Bubble chart · Histogram · Box plot · Pie chart · Heat map · Rebased to 100 · Lorenz curve and Gini

Maps

World map · Bivariate map · Flow map · India - state map · India - district map

Explore

Descriptive statistics · Summary by group · Two-way table · Classical statistical tests

Regression

Multiple regression (OLS) · Logit / Probit · Tobit (censored) · Truncated regression · Multinomial logit · Ordered logit / probit · Quantile regression · Poisson / Negative binomial

Time series - one series

Time-varying coefficients (Kalman) · Unit root tests · Correlogram (ACF / PACF) · ARIMA / SARIMA · Rolling-origin cross-validation · Theta method · Unobserved components · STL forecasting · Forecast combination · Markov regime switching · Change frequency (resample) · ARCH / GARCH volatility · Decompose & filter · Spectral analysis · Exponential smoothing · Forecast accuracy

Time series - several series

Yield curve (Nelson–Siegel / Svensson) · Dynamic factor model · Dynamic regression (ARIMAX) · Structural VAR · VAR · Granger causality · Cointegration · VECM · ARDL & bounds test

Panel data

Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Gravity model of trade · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests

Multivariate statistics

Principal components (PCA) · Factor analysis · Cluster analysis

Marketing research

Conjoint analysis · MaxDiff (best–worst scaling) · TURF - reach of a product line · Price sensitivity (Van Westendorp) · Market basket analysis · Perceptual map · Scale reliability (Cronbach’s alpha) · Key driver analysis

Causal

Spatial autocorrelation · Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition

Finance & risk

Black–Scholes option pricing · Bond price, duration & convexity · Merton distance to default · EMI / home loan planner · CAPM / beta estimation · Multi-factor model · Portfolio optimization · Value at Risk & Expected Shortfall · Performance & drawdown · Time value of money & NPV/IRR · Equity valuation (DDM, FCF, residual income) · Cost of capital (WACC) · Binomial option pricing · Option strategies (payoff & profit) · Forwards, futures & swaps · Credit risk & Basel capital · Extreme value theory (tail risk)

Actuarial

Life table · Life annuity · Life insurance pricing · Chain ladder reserving · Buhlmann credibility · Survival analysis · Mortality graduation · Aggregate loss model · Ruin probability · Multi-state Markov model · Loss severity fitting

Tests & breaks

Monte Carlo experiment · F-test, Wald & Chow · Structural breaks & stability

Machine learning

Regression vs machine learning · Ridge / Lasso / Elastic Net · Random forest · Gradient boosting

Open the workspace →

Starting engine…

EconStatsCraft rigorous, plain-spoken econometrics

Econometrics that explains itself.

Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.

Load a dataset to see it here.