EEconomics, Built

Act VII · The World Economy

Part 36 of 68

Trade II: Scale, Firms and Gravity

Principles and the majorstarts at this level32 min of film17 chaptersprerequisites: Part 10, Part 12, Part 24, Part 35

Why is most trade between similar countries, and what did a generation of imports from China do?

The part opens on the Ideal X leaving Newark in April 1956 with fifty-eight trailers on deck, and on the trade web of 2019. It measures two-way trade with the Grubel-Lloyd index, explains it with Krugman's variety and scale and the home-market effect, and asks the viewer where Spain sells the most. Gravity is estimated on every pair of countries by least squares and PPML, with McCallum's border puzzle; then firms: Bernard and Jensen's rare exporters, Melitz's selection, and Eaton and Kortum's Ricardo with a distribution. After an intermission of America's imports from China, one formula gives the gains from trade and exact hat algebra a counterfactual on real 2019 data; then the China shock with Autor, Dorn and Hanson's design reproduced on the Island, the tariffs of 2018 and 2025, value chains, three dials, Krugman's 1995 estimate as Called it?, and a frontier.

What you need. Part 10: monopolistic pricing and markups; Part 12: firms and market structure; Part 24: local labour markets; Part 35: comparative advantage and the gains formula. Chapter 4 uses Poisson pseudo-maximum likelihood with two sets of fixed effects; chapter 7 the Frechet distribution; chapter 8 a fixed-point solution for wages; chapter 9 instrumental variables.

Hook
a box on a ship, April 1956
Ideas, models and mathematics
love of variety, the home-market effect, heterogeneous firms (Melitz) derived, gravity from Tinbergen to its micro-foundations, one formula for the gains from trade, the China shock, tariff pass-through, value chains
Agora gains
a quantitative trade model
Play it
predict the trade between two countries

What you will be able to do

Principles and the major

  • Measure two-way trade with the Grubel-Lloyd index and explain it with variety and scale.
  • State the gravity equation and interpret its distance and border effects.
  • Describe the China shock's design and findings, and who paid the 2018-19 tariffs.

Graduate

  • Solve Krugman's model and the home-market effect; solve Melitz's cutoffs and the gain from opening.
  • Estimate gravity by least squares and by PPML with fixed effects, and explain why they differ.
  • Compute the gains from trade by the ACR formula and a counterfactual by exact hat algebra.

Research

  • Derive Eaton and Kortum's trade shares from Frechet draws, and connect theta to the trade elasticity.
  • Explain what shift-share designs assume, and why the short- and long-run trade elasticities differ.

Practice

  • Run a trade-policy counterfactual from a matrix of trade flows, and read a tariff pass-through study.

Contents

Each chapter has a home level. Choose a track to see what to read and watch: Principles and the major 22 min · Graduate 28 min · Research 32 min · Practice 24 min.

  1. 0Fifty-eight boxesPrinciples and the major3 min
  2. 1Cars for carsPrinciples and the major2 min
  3. 2Variety and scalePrinciples and the major2 min
  4. 3Play it: guess the tradePrinciples and the major1 min
  5. 4GravityPrinciples and the major3 min
  6. 5Exporters are rarePrinciples and the major2 min
  7. 6Melitz: selectionGraduate2 min
  8. 7Eaton and Kortum: Ricardo with a distributionResearch2 min
  9. Intermission: America's imports from ChinaPrinciples and the major
  10. 8One formula, and a counterfactualGraduate2 min
  11. 9The China shockPrinciples and the major2 min
  12. 10The tariffs of 2018 and 2025Principles and the major2 min
  13. 11Value chainsPrinciples and the major2 min
  14. 12The Dials: elasticities, pass-through, local jobsPrinciples and the major
  15. 13In practice: modelling trade policyPractice2 min
  16. 14Frontier: market power, services, timeResearch2 min
  17. Recap, problems, and the road aheadAll tracks3 min

Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.

Lecture

The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film.

Fifty-eight boxesPrinciples and the major3 min

On the twenty-sixth of April 1956 a converted wartime tanker, the Ideal X, left Port Newark for Houston. On its deck were fifty-eight truck trailers, lifted aboard by crane, with the goods still inside. Its owner, Malcom McLean, ran a trucking company. Loading a ship by hand, sack by sack and crate by crate, cost by his reckoning about five dollars and eighty-three cents a ton. Loading his boxes cost under sixteen cents. Today most manufactured goods that cross an ocean travel in such boxes, and trade has grown into something the theories of the last part could not explain.

Here is the result in 2019: the forty largest trade flows among twenty large economies, each line as thick as the trade along it. Two things stand out. The biggest flows run between neighbours: the largest of all is between Mexico and the United States, about 594 billion dollars a year. And the rich economies trade enormous amounts with each other, Germany with France, Japan with America, often in the same kinds of goods. Neither fits the theories of Part thirty-five, which predict trade between countries that differ. In all, the world traded about 18 trillion dollars of goods that year.

This part's question: why is most trade between similar countries, and what did a generation of imports from China do? Why do similar countries trade similar goods? Why does trade fall so fast with distance, and stop at borders? Why do so few firms export, and what happens to the rest? And what did the surge of imports from China do to the American towns that made the same things?

Economics, Built. Part thirty-six: scale, firms and gravity. Here is the plan. Trade in cars for cars, and the theory of variety and scale that explains it. A game of guessing trade flows, and the most successful equation in economics, gravity. Firms: why exporters are rare, and what trade does to the rest, with two models that put firms and countries together. One formula for the gains from trade, and a counterfactual computed on real trade data. And the evidence: the China shock, the tariffs of 2018 and 2025, value chains, and three dials.

What it does: The Ideal X; the trade web of 2019; the question; objectives

1Cars for carsPrinciples and the major2 min

Part thirty-five ended on a fact that its theories could not explain. Measure how much of a country's trade in a category runs both ways: the Grubel-Lloyd index, one when exports equal imports and zero when trade runs one way. Here it is for America's trade in capital goods, cars and consumer goods since 1967. In 1967, two years after the Auto Pact with Canada, America's trade in cars and parts scored 0.93: it shipped cars north and bought cars back. In 2025 America exported 713 billion dollars of capital goods and imported 1133 billion. Herbert Grubel and Peter Lloyd showed in 1975 that much of rich countries' trade is like this, and that it is not an artefact of lumping different goods together. Neither Ricardo nor Heckscher and Ohlin predicts it: a country should not export and import the same thing.

Work one out. In 2025 America exported 160 billion dollars of cars and parts and imported 423 billion. The smaller of the two, 160, is matched by an equal flow the other way; that overlap, counted on both sides, is two-way trade, and its share of the total is the index: 0.55. Capital goods score higher: America sells machines and aircraft and buys other machines and aircraft. Consumer goods score lower, because imports far exceed exports. Two-way trade within an industry means countries trade varieties, not just different goods. The next chapter asks why anyone would.

What it does: The Grubel-Lloyd index for America since 1967

2Variety and scalePrinciples and the major2 min

In 1979 a young Paul Krugman offered a third reason to trade, which needs no difference between countries at all. People like variety: not just more cars, but different cars. But each variety has a fixed cost of design and tooling, so it pays to make each in one place, by one firm. A market of 1000 workers on the Island can support only 250 varieties. Put two such islands together and buyers in both choose among 500. With an elasticity of substitution of 4, that raises real wages by 26 percent, though every firm sells the same amount at the same markup as before. Each country exports some varieties and imports others of the same good: cars for cars.

Add shipping costs and something else appears. If firms located in proportion to demand, the line would be the dashed diagonal. In fact the larger market gets more than its share of the industry, because firms that must pick one place to produce pick the one where most of their buyers are. With fifty-five percent of demand, the Island has 59 percent of the firms. So the larger country ends up exporting the good it most wants. Krugman called it the home-market effect: here demand creates comparative advantage, rather than the other way round.

What it does: Krugman's model; the gain from trading with an identical country; the home-market effect

3Play it: guess the tradePrinciples and the major1 min

Your turn. In 2019, to which of these three countries did Spain sell the most goods? Portugal, its small neighbour, with a GDP of a quarter of a trillion dollars; Japan, twenty times as large and ten thousand kilometres away; or Brazil, nearly eight times as large, Portuguese-speaking and Latin American. Pause, and choose.

The answer is A, by far. Spain sold Portugal 26 billion dollars of goods, Japan 3.2 billion and Brazil 3.0 billion. A country one twentieth the size of Japan, but next door, buys eight times as much. The white bars are what one equation predicts from nothing but the two countries' sizes, the distance between them, whether they share a border and whether they share a language. It gets all three close. Trade is proportional to the product of the sizes, and falls with distance. That is gravity.

What it does: Spain's exports to Portugal, Japan and Brazil, and gravity's predictions

4GravityPrinciples and the major3 min

In 1962 the Dutch economist Jan Tinbergen noticed that trade between two countries behaves like Newton's gravity: it grows with their sizes and falls with the distance between them. Here are Germany's exports in 2019 to each of its partners, divided by the partner's GDP, against distance, both on log scales. The cloud falls along a line with a slope of -1.09: twice as far, roughly half the trade, even though shipping a container twice as far does not cost twice as much. Every country's exports look like this. Gravity is the most reliable regularity in empirical economics.

Estimated on all 28,107 pairs of countries, the equation fits remarkably. By least squares on the logarithms, trade rises almost one for one with the importer's GDP, falls with distance with an elasticity of -1.18, and a shared border, a common language, a colonial past and a trade agreement each multiply it by about two or three. João Santos Silva and Silvana Tenreyro showed in 2006 that logarithms bias these estimates when errors vary with size, and proposed estimating the equation in levels by Poisson pseudo-maximum likelihood, with a fixed effect for each exporter and importer. Then distance's elasticity is -0.71, and the other effects shrink. The method is now the standard.

How well does gravity actually fit? Take the Poisson fit with each country's fixed effect, and compare its prediction for every pair of countries with the trade that happened. Each dot is a pair; on the diagonal, the prediction is exact. The big flows sit close to it: America's exports to Canada, China's to America, Germany's to France. Across all pairs, the equation explains about 66 percent of the variation in log trade, and 89 percent of the variation in dollars, because the largest flows, which carry most of world trade, are predicted best. The scatter around the line is where the interesting economics lives: pairs that trade much more, or much less, than their geography says.

Gravity also measures borders. In 1995 John McCallum used data on trade between Canadian provinces and found that, in 1988, provinces traded about twenty-two times more with each other than with American states of the same size and distance, across one of the world's most open borders. James Anderson and Eric van Wincoop showed in 2003 that part of the puzzle was a mistake: what matters is the cost of trading with a partner relative to all the others, which they called multilateral resistance, and for a small country like Canada that changes the answer a great deal. But the border effect that remains is still large. Borders matter for reasons tariffs do not capture: currencies, rules, networks, trust.

What it does: Germany's exports against distance; least squares and PPML; borders

5Exporters are rarePrinciples and the major2 min

Until the 1990s, trade theory talked about countries and industries. Then Andrew Bernard and Bradford Jensen opened the American census of manufacturing plants. Exporters were rare: 10.4 percent of plants in 1976, 14.6 percent in 1987. But they were large, making over half of all shipments. And they were better: more productive, more capital-intensive, paying higher wages, and they were so before they started to export. Good firms export; exporting is not what made them good.

The Island's firms look the same, by construction of the model in the next chapter. Of four thousand would-be firms, 260 survive, lined up here from least to most productive. Only the most productive 18 percent export, the gold bars, yet they sell 67 percent of all output. On average they are 9 times as large as the firms that sell only at home.

Why are exporters so few, and so much better? Draw each firm's profit against its productivity. At home, profit rises with productivity, less a fixed cost of producing at all: firms to the left of the teal cut-off lose money and close. Abroad, shipping costs shrink every sale, and setting up to export costs more again, so the line starts lower and rises more slowly. Only firms past the gold cut-off make money exporting. The same two lines explain all of Bernard and Jensen's facts: exporters are rare, because few firms clear the higher bar; and they are large and productive, because only the large and productive can.

What it does: Bernard and Jensen; the Island's firms

6Melitz: selectionGraduate2 min

In 2003 Marc Melitz built the model. Firms are born with a random productivity, drawn here from a Pareto distribution: the curve is the share of would-be firms above each level. Producing has a fixed cost, so only firms above a cutoff survive. Exporting has a further fixed cost and shipping costs, so only the best of those export. Now open the economy. Exporters expand and bid up wages, and the bar for survival rises: 22 percent of the firms that survived alone now exit. The best 18 percent export and grow. No firm has improved, yet output has moved from the weakest firms to the strongest, and average productivity, and with it real wages, rise by 5.9 percent. Trade raises productivity by killing firms.

Follow each firm through the opening. Here is how a firm's sales with trade compare with its sales alone, for every level of productivity. The weakest survivors of the closed economy close: their sales fall to nothing. Firms good enough to survive but not to export shrink, by about 16 percent, because foreign competitors take part of their home market and the exporters bid up wages. Only the exporters grow, and the more productive they are, the more. Nothing about any firm has changed. The market has moved its workers and its customers from the least productive firms to the most, and that reallocation is where the gain comes from. Studies of real liberalizations, in Chile, Canada and elsewhere, find exactly this pattern.

Lower the cost of shipping and both rise. The gain from opening grows as more firms find it worth exporting and the selection becomes sharper. The evidence agrees: after Chile's liberalization, Nina Pavcnik found productivity rose in its import-competing plants, much of it by reallocation; after the Canada-US Free Trade Agreement, Daniel Trefler found large productivity gains in the Canadian industries that lost protection, alongside real job losses in them.

What it does: Cutoffs, exit and reallocation; gains against shipping costs; the evidence

7Eaton and Kortum: Ricardo with a distributionResearch2 min

In 2002 Jonathan Eaton and Samuel Kortum turned Ricardo into a model of many countries. Each country draws its productivity in each of a continuum of goods at random, from a distribution whose average level is its technology, T, and whose spread is governed by theta. Every buyer buys each good from whichever country sells it cheapest, delivered. The result is a formula for the share of a country's spending that goes to each supplier. Here it is for three islands, white by the formula, gold from a simulation of twenty thousand goods with random productivities. The two agree. And the formula has the shape of gravity: more trade with suppliers that are large and efficient, less with those that are far away. Comparative advantage, with enough goods, produces gravity, and theta is the trade elasticity of Part thirty-five's formula.

The model has a property that surprises everyone who meets it. For each good, every island offers the Island a delivered price, and the cheapest wins: the bright dots. The Archipelago, with the best technology, wins 28 percent of the goods; the Island itself 70; the distant Far Isle only 2. Now ask what the Island pays for the goods it buys from each source. You might expect the strong supplier's goods to be cheaper. They are not: the average log price is the same whichever island sold the good. A strong supplier wins more goods, including ones where it is only barely the cheapest, and those marginal wins exactly offset its advantage. That is why a country's share of a buyer's spending equals its share of the goods it wins, and why the formula is so simple.

What it does: Ricardo with a distribution: the formula and a simulation

Intermission: America's imports from ChinaPrinciples and the major

This chapter has no narration to read.

8One formula, and a counterfactualGraduate2 min

Part thirty-five's formula for the gains from trade has a remarkable property. Arkolakis, Costinot and Rodriguez-Clare showed that Krugman's model, Melitz's and Eaton and Kortum's all give the same answer from the same two numbers: the share of spending on home goods, and the trade elasticity. Here it is computed from 2019 trade data with an elasticity of four, for eight economies, counting domestic spending as GDP less goods exports. Large economies that trade little relative to their size, like America and China, would lose under three percent in autarky; open ones like Germany, Korea and Mexico around nine or ten. The models differ in how trade works, but not, at this level, in how much it is worth.

The same models answer what-if questions. Robert Dekle, Jonathan Eaton and Samuel Kortum showed in 2008 that a counterfactual needs only today's trade shares and the elasticity, solved in proportional changes: exact hat algebra. Suppose trade costs between America and China rose by 25 percent, about the size of a broad tariff. Solving for the new wages and prices in all sixteen regions of the 2019 data: America's spending on Chinese goods falls from 1.9 percent to 0.9. America loses 0.22 percent of real income and China 0.34; Mexico and Canada gain, as trade diverts to them. The numbers are small because the model is static and has no inputs crossing borders; Part sixty-six returns with richer versions.

What it does: The ACR gains on 2019 data; hat algebra for US-China trade costs

9The China shockPrinciples and the major2 min

Now the evidence that changed the profession's mind. China joined the World Trade Organization in December 2001. America's imports from China rose from 19 billion dollars in 1991 to 321 billion in 2007. Over the same years American manufacturing employment fell, from 17.3 million in 2000 to 11.5 million in 2010. But many things hit manufacturing at once: automation, the recession of 2008, and trade. A national time series cannot separate them.

David Autor, David Dorn and Gordon Hanson found a way to separate them. They studied seven hundred and twenty-two local labour markets, commuting zones. Each zone's exposure to China depended on what it happened to make in 1990: furniture towns, toy towns and textile towns were hit; others were not. To keep American demand shocks out of the measure, they built it again from China's exports to eight other rich countries, which reflect China's own rise. The result: a thousand dollars more of imports per worker over a decade cut a zone's manufacturing employment, as a share of its adults, by 0.60 percentage points, with unemployment, disability claims and lower wages following. Across the country, conservatively, about a quarter of the decline in manufacturing employment from 1990 to 2007.

Why the instrument? On the Island's four hundred zones, with an effect planted at -0.6, least squares finds -0.44: industries where Islanders' own demand rose import more and employ more, which hides part of the damage. Using exposure built from other countries' imports recovers -0.58. Recent work, by Borusyak, Hull and Jaravel and by Goldsmith-Pinkham, Sorkin and Swift, shows what such shift-share designs rest on: many industry shocks that are as good as random. The China shock's estimates have held up when re-examined this way.

What it does: Imports and jobs; Autor, Dorn and Hanson; shift-share on the Island

10The tariffs of 2018 and 2025Principles and the major2 min

Here is America's average tariff since 1929: customs duties as a share of the goods it imported. After the Smoot-Hawley tariff of 1930 it peaked at 19 percent in 1933. From 1947, round after round of agreements brought it down, to 1.6 percent by 2017. In 2018 and 2019 America raised tariffs on washing machines, solar panels, steel, aluminium and, in several rounds, on most imports from China, and its partners retaliated. The average nearly doubled, to 3.1 percent. In 2025 it jumped to 8.0, the highest since 1946.

The tariffs of 2018 and 2019 covered more than three hundred billion dollars of imports. Who paid? Part thirty-five's large-country argument says foreign sellers should cut their prices and bear part of the tariff. They did not: Mary Amiti, Stephen Redding and David Weinstein, and Pablo Fajgelbaum and coauthors, found that the prices foreigners charged did not fall, so the tariff passed in full to American buyers. The buyers of imports lost about 51 billion dollars a year; after counting the tariff revenue and the gains to protected producers, the net loss was about 7.2 billion, 0.04 percent of GDP. In 2025, with the average tariff at 8.0 percent, America's imports from China fell from 440 billion dollars to 309 billion. Part sixty-six measures what followed.

What it does: Pass-through and the bill

11Value chainsPrinciples and the major2 min

Much of modern trade is not in finished goods but in tasks. The iPhone of 2009 was designed in California, built from parts made in Japan, Korea, Germany, Taiwan and America, and assembled in China, which added about six dollars and fifty cents to each phone. Yet every phone shipped from China counted as a Chinese export at its full factory cost, about 179 dollars: in gross terms, Yuqing Xing and Neal Detert calculated, the iPhone added 1.9 billion dollars to America's trade deficit with China that year. Counted by value added, China's share of each phone was its six dollars and fifty cents of assembly, and the same trade showed a small American surplus. Chains like this make countries more productive and more fragile: a factory closed by a flood or a pandemic stops production everywhere downstream, the subject of Parts sixty-three and sixty-six.

The iPhone generalizes. Statistical offices now measure trade in value added, using the input-output tables of Part three. On the Island's chain, the Far Isle assembles phones from the Archipelago's components, which contain the Island's chips. When the Far Isle ships a hundred dollars of phones to the Island, gross trade records a hundred dollars from the Far Isle and nothing from anyone else. The Leontief inverse follows each dollar back through the chain: the Far Isle added 30 dollars, the Archipelago 51, and the Island itself 19, its own chips coming home inside the phone. Bilateral deficits measured in gross trade can be wildly misleading: the Island's deficit with the Far Isle is a hundred dollars gross but thirty in value added. Johnson and Noguera, and Koopman, Wang and Wei, built these measures for the whole world.

What it does: The iPhone's gross and value-added accounting

12The Dials: elasticities, pass-through, local jobsPrinciples and the major

This chapter has no narration to read.

What it does: The trade elasticity; pass-through; import competition and local jobs

13In practice: modelling trade policyPractice2 min

Who does this for a living? Trade ministries and agencies like America's International Trade Commission run quantitative models built on real trade shares, the hat algebra of chapter eight, to estimate what an agreement or a tariff will do. Firms employ supply-chain strategists who decide where to source, how much to stock, and what a tariff will cost. Banks and consultancies employ trade economists who run gravity equations and measure pass-through. And regional economists now map which places a shock will hit, the lesson of the China shock.

A typical first assignment for a trade analyst: what would a new agreement do to trade between its members? Read it off the gravity equation, estimated with each country's fixed effect. Pairs with an agreement trade about 39 percent more than otherwise similar pairs. Sharing a border adds about 44 percent; doubling the distance removes about 39 percent. These are partial effects: they hold fixed everything else each country trades. A real agreement also diverts trade from outsiders and shifts prices, which is why the analyst's second step is the general-equilibrium calculation of chapter eight.

Called it? In 1995 Paul Krugman estimated that trade with low-wage countries had raised the ratio of skilled to unskilled wages in America by about three percentage points, a modest effect, in line with most estimates of the decade. For the years he studied, the estimate has held up. But after 2000 imports from China grew far faster, and the China shock's losses were concentrated in particular places, which national averages had smoothed away. The verdict: partly right. Averages can be right while particular places are devastated.

What it does: Trade-policy modelling and supply chains; Called it? on Krugman (1995)

14Frontier: market power, services, timeResearch2 min

The frontier. Market power: when trade is dominated by a few large firms, how much of its gain goes into markups rather than lower prices? Services: the fastest-growing kind of trade, from software to tourism, and the hardest to measure. Time: an elasticity of one in the first year and two after a decade, so which governs the gains, and how should a counterfactual handle the path between? Adjustment: why the places hit by the China shock were still worse off a decade later. And geography: why economic activity clusters in a few places at all, the subject of the next part.

One frontier is how large the gains from trade really are. Part thirty-five's formula gave America about 2.8 percent of real income. But that formula assumes one sector and no traded inputs. When firms import parts to make goods that are themselves traded, a fall in trade costs compounds through the chain: with half of costs in traded inputs, the exponent doubles, and America's gain rises to 5.5 percent, Germany's to 17. Arnaud Costinot and Andrés Rodríguez-Clare showed how many sectors, intermediate goods and other features change the answer; their later estimates put America's gains between 2 and 8 percent of GDP. The same simple formula, with the economy's structure added, gives answers several times larger.

What it does: Market power, services, time, adjustment, geography

Recap, problems, and the road aheadAll tracks3 min

So: why is most trade between similar countries, and what did a generation of imports from China do? Because people want variety and firms have fixed costs, similar countries trade different versions of the same goods; and because trade falls with distance and stops at borders, most of it is between large neighbours. Only the best firms export, and trade raises productivity by moving output to them. Imports from China raised America's income as a whole, and devastated the places that made the same things, and those places have not recovered.

Part thirty-six in twelve lines. The container made shipping cheap. Rich countries trade the same kinds of goods in both directions. Love of variety and economies of scale explain it, and give the larger market more than its share of an industry. Trade falls with distance, as gravity says, and borders cut it further. Exporters are few, large and productive, and opening to trade moves output to them, raising productivity without any firm improving. Comparative advantage, with a distribution, produces gravity, and three models give one formula for the gains, a few percent for large economies. The China shock cost particular places a great deal. Tariffs fell on American buyers. And trade is increasingly in tasks along value chains, with an elasticity that grows with time.

The problems. The gains from variety; the Grubel-Lloyd index; gravity and distance; the home-market effect; Melitz's exporters; the gains formula; the China shock's arithmetic; and a starred derivation of Eaton and Kortum's shares. Full solutions are in the part's notes.

The reading: Krugman, Obstfeld and Melitz, and Feenstra, for the theory; Head and Mayer's chapter on gravity equations; and Marc Levinson's history of the box. Then the papers, from Tinbergen to the tariffs of 2018.

This part ended in particular places. The next is about places. In 1971 Thomas Schelling published a model you can play with coins on a checkerboard. Each coin moves to an empty square when too few of its neighbours are like it. Even when every coin is content to be in the minority, the board sorts itself into large blocks of one kind: an outcome nobody wanted. Part thirty-seven: cities and regions. Why is economic activity piled up in a few places, and what does that do to the people in them?

Where it goes next. Part 37 turns to why activity clusters in a few places; Part 63 to fragile networks; Part 66 to tariffs, industrial policy and the 2025 tariffs on the quantitative model.

Key results

The part's results in one place, for revision.

Grubel-Lloyd\(\displaystyle GL = 1 - \frac{|X - M|}{X + M}\)
Gravity\(\displaystyle X_{od} = \exp(a_o + b_d - \delta \ln D_{od} + \dots)\)
Melitz's export cutoff\(\displaystyle \varphi_x^* = \tau \left(\frac{f_x}{f}\right)^{1/(\sigma-1)} \varphi^*\)
Eaton-Kortum\(\displaystyle \pi_{ni} = \frac{T_i (w_i d_{ni})^{-\theta}}{\sum_k T_k (w_k d_{nk})^{-\theta}}\)
Hat algebra\(\displaystyle \hat W_n = \hat E_n / \hat P_n, \quad\allowbreak \hat P_n = \Big(\sum_i \pi_{ni} (\hat w_i \hat d_{ni})^{-\theta}\Big)^{-1/\theta}\)
The China shock\(\displaystyle \Delta L^m_{z} = \beta \sum_k \frac{L_{zk}}{L_z} \frac{\Delta M_k}{L_k} + \varepsilon_z\)

Try it

Lab 36 · Scale, firms and gravity

Compute the gains from variety and the home-market effect; estimate gravity on real 2019 trade by least squares and by PPML with fixed effects; solve Melitz's model and simulate its firms; check Eaton and Kortum's formula against a simulation; compute the gains from trade and a counterfactual by exact hat algebra; and see why the China shock needs an instrument.

Figure produced by Lab 36: Scale, firms and gravity
Produced by the lab below, seed 0, in 0.4 s.
python -m videos.economics.labs 36 needs numpy, scipy, matplotlib · download lab36.py · source on GitHub
Krugman: real-wage gain from trading with one identical country; the home-market effect at 55%  26.0%; 59.3% of firms
gravity, 2019: OLS elasticities on GDPs and distance; R-squared                                 1.34, 0.99, -1.37; 0.65 (28,113 pairs)
PPML with exporter and importer effects: distance, border, language                             -0.75, 0.39, 0.03
Melitz: exporters among survivors (formula, simulation); exit on opening; the gain              18.5%, 18.5%; 21.7%; 5.92%
Eaton and Kortum: largest gap between formula and simulation                                    0.0047
hat algebra to autarky against the ACR formula (three islands)                                  -5.43% / -5.43%, -3.98% / -3.98%, -4.21% / -4.21%
the China shock on the Island: planted effect; OLS; IV                                          -0.60; -0.437; -0.578

Variety and scale make similar countries trade similar goods; distance and borders shape how much; only the best firms export, and opening moves output to them; Ricardo with a distribution gives gravity, and three models give one formula for the gains. A shift-share design needs an instrument because demand shocks raise imports and jobs together.
The code (107 lines; it asserts its own result)
"""Lab 36: scale, firms and gravity: Krugman's gains from variety and the home-market effect, gravity on CEPII's 2019
data by least squares and PPML with fixed effects, Melitz's cutoffs and a population of firms, Eaton and Kortum's
shares by formula and simulation, the gains-from-trade formula and an exact-hat-algebra counterfactual on 2019 trade,
and the shift-share design of the China shock on the Island's zones."""

import numpy as np

from videos.coursekit import labs
from explainer.economics import data
from explainer.economics.agora import trade
from explainer.economics.island import truths

TITLE = "Scale, firms and gravity"
GOAL = ("Compute the gains from variety and the home-market effect; estimate gravity on real 2019 trade by least "
        "squares and by PPML with fixed effects; solve Melitz's model and simulate its firms; check Eaton and "
        "Kortum's formula against a simulation; compute the gains from trade and a counterfactual by exact hat "
        "algebra; and see why the China shock needs an instrument.")
TASKS = [
    "Gravity: add the colonial tie and the trade agreement to the PPML regressors. How much does distance's "
    "coefficient move?",
    "Melitz: halve the fixed cost of exporting. What happens to the share of exporters and the gain from opening?",
    "Hat algebra: raise trade costs between America and Mexico instead of China. Who gains from diversion?",
]


def _gravity():
    G = data.gravity()
    g = {k: np.array(v, float) if k not in ("iso3_o", "iso3_d") else np.array(v) for k, v in G.items()}
    ok = (np.isfinite(g["tradeflow_baci"]) & np.isfinite(g["gdp_o"]) & np.isfinite(g["gdp_d"]) &
          np.isfinite(g["distw_harmonic"]) & (g["distw_harmonic"] > 0) & np.isfinite(g["contig"]) &
          np.isfinite(g["comlang_off"]))
    return {k: v[ok] for k, v in g.items()}


def run(seed=0):
    lab = labs.Lab()
    T = truths(36)

    K = T["krugman"]
    g2 = trade.krugman_variety(K["L"], K["f"], K["sigma"], 2)["welfare_gain"]
    lab.row("Krugman: real-wage gain from trading with one identical country; the home-market effect at 55%",
            f"{100 * g2:.1f}%; {100 * trade.home_market([0.55], K['phi'])[0]:.1f}% of firms")
    assert abs(g2 - (2 ** (1 / (K["sigma"] - 1)) - 1)) < 1e-12

    g = _gravity()
    X = np.column_stack([np.log(g["gdp_o"]), np.log(g["gdp_d"]), np.log(g["distw_harmonic"]), g["contig"],
                         g["comlang_off"]])
    R = trade.gravity_ols(g["tradeflow_baci"], X)
    oc = {c: i for i, c in enumerate(sorted(set(g["iso3_o"])))}
    dc = {c: i for i, c in enumerate(sorted(set(g["iso3_d"])))}
    P = trade.ppml_fe(g["tradeflow_baci"], X[:, 2:], np.array([oc[c] for c in g["iso3_o"]]),
                      np.array([dc[c] for c in g["iso3_d"]]))
    lab.row("gravity, 2019: OLS elasticities on GDPs and distance; R-squared",
            f"{R['beta'][0]:.2f}, {R['beta'][1]:.2f}, {R['beta'][2]:.2f}; {R['r2']:.2f} ({R['n']:,} pairs)")
    lab.row("PPML with exporter and importer effects: distance, border, language", ", ".join(f"{b:.2f}" for b in
                                                                                            P["beta"]))
    assert -1.6 < R["beta"][2] < -0.6 and -1.2 < P["beta"][0] < -0.4

    Mt = T["melitz"]
    kw = {k: Mt[k] for k in ("sigma", "k", "f", "fx", "fe", "tau", "delta")}
    M = trade.melitz(**kw)
    F = trade.melitz_firms(n=Mt["n"], seed=Mt["seed"] + seed, **kw)
    alive, ex = F["alive_trade"], F["exporter"] & F["alive_trade"]
    lab.row("Melitz: exporters among survivors (formula, simulation); exit on opening; the gain",
            f"{100 * M['export_share']:.1f}%, {100 * ex.sum() / alive.sum():.1f}%; {100 * M['exit_share']:.1f}%; "
            f"{100 * M['welfare_gain']:.2f}%")
    assert M["phi_export"] > M["phi_trade"] > M["phi_autarky"]

    E = T["ek"]
    a = trade.eaton_kortum_shares(E["T"], np.ones(3), E["d"], E["theta"])
    s = trade.eaton_kortum_simulate(E["T"], np.ones(3), E["d"], E["theta"], E["goods"], E["seed"] + seed)
    lab.row("Eaton and Kortum: largest gap between formula and simulation", f"{np.abs(a - s).max():.4f}")
    assert np.abs(a - s).max() < 0.02

    X3 = np.array([[80, 10, 10], [10, 85, 5], [10, 5, 80.]])
    aut = np.ones((3, 3)) * 1e3
    np.fill_diagonal(aut, 1)
    H = trade.hat_algebra(X3, aut, 4.0)
    acr = [-trade.acr_gains(X3[i, i] / X3[i].sum(), 4.0) for i in range(3)]
    lab.row("hat algebra to autarky against the ACR formula (three islands)",
            ", ".join(f"{100 * h:.2f}% / {100 * c:.2f}%" for h, c in zip(H["welfare"], acr)))
    assert np.allclose(H["welfare"], acr, atol=1e-4)

    S = trade.shift_share(**{**T["shock"], "seed": T["shock"]["seed"] + seed})
    lab.row("the China shock on the Island: planted effect; OLS; IV", f"{S['beta']:.2f}; {S['ols']:.3f}; "
            f"{S['iv']:.3f}")
    assert abs(S["iv"] - S["beta"]) < abs(S["ols"] - S["beta"])

    lab.note = ("Variety and scale make similar countries trade similar goods; distance and borders shape how much; "
                "only the best firms export, and opening moves output to them; Ricardo with a distribution gives "
                "gravity, and three models give one formula for the gains. A shift-share design needs an instrument "
                "because demand shocks raise imports and jobs together.")

    fig, ax = labs.figure(2, size=(11, 4.4))
    de = g["iso3_o"] == "DEU"
    ax[0].scatter(np.log(g["distw_harmonic"][de]), np.log(g["tradeflow_baci"][de] / g["gdp_d"][de]), s=8,
                  color=labs.ORANGE)
    ax[0].set(title="Germany's exports per dollar of partner GDP, 2019", xlabel="log distance", ylabel="log")
    tau = np.linspace(1, 2.5, 31)
    ax[1].plot(tau, [100 * trade.melitz(**{**kw, "tau": t})["welfare_gain"] for t in tau], color=labs.BLUE,
               label="gain from opening, %")
    ax[1].plot(tau, [100 * trade.melitz(**{**kw, "tau": t})["export_share"] for t in tau], color=labs.ORANGE,
               label="exporters, % of firms")
    ax[1].set(title="Melitz: gains and exporters against shipping costs", xlabel="tau")
    ax[1].legend()
    lab.fig = fig
    return lab

Now change it

  1. Gravity: add the colonial tie and the trade agreement to the PPML regressors. How much does distance's coefficient move?
  2. Melitz: halve the fixed cost of exporting. What happens to the share of exporters and the gain from opening?
  3. Hat algebra: raise trade costs between America and Mexico instead of China. Who gains from diversion?

Problems, with solutions

Try each problem before opening its solution.

1. Variety: with σ = 4, how much do real wages rise when two identical countries trade? When ten do?

Solution

The real wage is proportional to the number of varieties to the power 1/(σ − 1). Doubling varieties raises it by 2^{1/3} − 1 = 26%; ten countries, by 10^{1/3} − 1 = 115%. Firm size and the markup σ/(σ − 1) = 4/3 are unchanged: the whole gain is choice.

2. Grubel-Lloyd: America exported $713 billion of capital goods and imported $1,133 billion. Compute the index, and say what aggregation does to it.

Solution

1 − |713 − 1,133|/(713 + 1,133) = 1 − 420/1,846 = 0.77. Aggregating different goods into one category raises the index, since exports of one good can offset imports of another; Grubel and Lloyd's finding survives at fine levels of detail, but the level of the index depends on the classification.

3. Gravity: with trade ∝ Y_o Y_d / D, how does trade with a partner 5,000 km away compare with one 500 km away of the same size?

Solution

With a distance elasticity of −1, ten times as far means a tenth of the trade. With the PPML estimate of −0.71 it is 10^{−0.71} = 0.19, about a fifth; with the least-squares −1.18, 0.066.

4. Home market: with φ = 0.3, show that 55% of demand gives about 59% of firms, and find the share of demand that attracts all of them.

Solution

s_n = 1/2 + (1 + φ)/(1 − φ)(s_L − 1/2) = 0.5 + (1.3/0.7)(0.05) = 0.593. All firms locate in the larger country when s_n = 1: s_L = 1/2 + (0.7/1.3)(1/2) = 0.77.

5. Melitz: with Pareto shape 4.25, σ = 4, τ = 1.3 and f_x/f = 1.5, find the share of firms that export.

Solution

The export cutoff is φ_x = τ(f_x/f)^{1/(σ − 1)} φ* = 1.3 × 1.5^{1/3} φ* = 1.488 φ*. With Pareto productivity the share of survivors above it is 1.488^{−4.25} = 0.185.

6. Gains: America spends 89.4% of its income on home goods. Find the loss from autarky with θ = 4 and with θ = 2.

Solution

1 − 0.894^{1/4} = 2.8%; 1 − 0.894^{1/2} = 5.4%. A long-run elasticity of two, as Boehm and coauthors estimate, doubles the measured gains.

7. China shock: exposure rose $1,839 per worker in 2000-07. With a coefficient of −0.596, what fall in the manufacturing share follows?

Solution

1.839 × 0.596 = 1.10 percentage points of the working-age population, against an actual fall of 2.00 points over those years: a little over half in that period, and about a quarter of the decline over 1990-2007 by the authors' conservative reckoning.

8. \(\bigstar\) Eaton-Kortum: derive π_ni = T_i (w_i d_ni)^{−θ}/Φ_n from Fréchet productivity draws.

Solution

With P(Z_i ≤ z) = exp(−T_i z^{−θ}), the delivered price p_ni = w_i d_ni / Z_i has P(p_ni ≥ p) = exp(−T_i (w_i d_ni)^{−θ} p^θ) = exp(−φ_ni p^θ). The probability that i is cheapest is ∫ φ_ni θ p^{θ−1} exp(−φ_ni p^θ) Π_{k≠i} exp(−φ_nk p^θ) dp = φ_ni/Σ_k φ_nk, the stated share; with a continuum of goods it is also the share of spending, since the distribution of the price paid does not depend on the source.

Notes and sources

Sources

The studies the film states are listed with what each shows in dials.SHOWN[36]; the trade elasticity, pass-through and the local effect of import competition are dials (explainer/economics/dials.py); Krugman's 1995 estimate is a Called it? entry (explainer/economics/calls.py). CEPII's Gravity database (V202211) and FRED's series were retrieved on 2026-11-20. Autor, Dorn and Hanson's coefficient and exposure figures were checked against NBER Working Paper 18054; Fajgelbaum et al.'s and Boehm et al.'s numbers against their abstracts; the iPhone figures against Xing and Detert's abstract and later summaries; the Ideal X's loading costs are McLean's estimates as reported, $5.83 a ton (the plan's $5.86 was not found in any source).

About this partfrom its README

Part 36 of a sixty-eight-part course in economics (see the series plan and the syllabus), the third of Act VII, The World Economy. It asks why most trade is between similar countries, and what a generation of imports from China did. Its answer: because people want variety and firms have fixed costs, similar countries trade different versions of the same goods; and because trade falls with distance and stops at borders, most of it is between large neighbours. Only the best firms export, and trade raises productivity by moving output to them. Imports from China raised America's income as a whole and devastated the places that made the same things, and those places have not recovered.

It opens on the Ideal X leaving Port Newark on 26 April 1956 with fifty-eight trailers on deck, and on the trade web of 2019 drawn from CEPII's data. From there it covers:

  • two-way trade: America's Grubel-Lloyd indices by end use since 1967 (cars and parts 0.93 in 1967, two years after the Auto Pact; capital goods 0.77 in 2025);
  • Krugman's love of variety and economies of scale: two identical islands trading raise real wages 26% with σ = 4; the home-market effect (55% of demand attracts 59% of the industry);
  • a game: did Spain sell more in 2019 to Portugal, Japan or Brazil? ($26.0 billion, $3.2 billion and $3.0 billion; gravity predicts all three closely);
  • gravity on all 28,107 country pairs of 2019: Germany's exports, per dollar of the partner's GDP, fall with distance with a slope of −1.09; least squares gives a distance elasticity of −1.18 and PPML with exporter and importer fixed effects −0.71; McCallum's border puzzle and Anderson and van Wincoop's multilateral resistance;
  • firms: Bernard and Jensen's exporters (10.4% of plants in 1976, 14.6% in 1987, over half of shipments), and the Island's firms (19% export and sell 67% of output, nine times larger than the rest);
  • Melitz's model derived and computed: opening makes 22% of surviving firms exit and raises productivity and real wages 5.9%; the gains grow as shipping gets cheaper; Pavcnik's and Trefler's evidence;
  • Eaton and Kortum's Ricardo with a distribution: the trade-share formula against a simulation of 20,000 goods;
  • an intermission without narration: America's imports of goods from China, 1985-2025, as a tune;
  • one formula for the gains (Arkolakis, Costinot and Rodríguez-Clare) computed for fifteen economies and the rest of the world on 2019 data (autarky would cost America 2.8% and Germany 9.1% with θ = 4), and a counterfactual by exact hat algebra: trade costs between America and China up 25% cost America 0.22% and China 0.34%, while Mexico gains;
  • the China shock: imports from China ($19 billion in 1991, $321 billion in 2007), manufacturing employment (17.3 million in 2000, 11.5 million in 2010), Autor, Dorn and Hanson's design (−0.596 points per $1,000 per worker; a quarter of the decline), and the shift-share logic reproduced on the Island's 400 zones;
  • the tariffs of 2018-19 (complete pass-through; buyers lost $51 billion a year, $7.2 billion net) and of 2025 (America's average tariff on goods 2.6% to 8.0%);
  • value chains: the iPhone's accounting (China's value added $6.50 a phone);
  • three dials: the trade elasticity (new), pass-through (two rows added), and the local effect of import competition (new); the Facts of gravity and few exporters get Agora's column, and two-way trade is explained; Called it? on Krugman's 1995 estimate of trade and wages (partly right); a frontier chapter.
What is computed and built

Everything plotted is computed by compute.py from Agora's trade (explainer.economics.agora.trade, part II) with the Island's Part 36 truths, or from the Data Room; the narration states the cached numbers.

  • Gravity. CEPII's 2019 rows for pairs of existing countries with BACI trade recorded; least squares of log trade on log GDPs, log population-weighted distance, a shared border, a common official language, a colonial tie and a WTO-notified trade agreement; PPML in levels on the same recorded flows (BACI records positive flows), with exporter and importer fixed effects concentrated out by their first-order conditions and Newton steps for the rest.
  • The Play-it predictions. The least-squares gravity equation without the colonial and agreement terms.
  • Krugman. 1,000 workers, a fixed cost of one worker per variety, σ = 4; the home-market effect with freeness φ = 0.3 and an outside good that equalizes wages.
  • Melitz. Pareto productivity with shape 4.25 and minimum 1, σ = 4, fixed costs of 1 (producing), 1.5 (exporting) and 2 (entry), shipping 1.3, exit rate 0.1, two symmetric countries; 4,000 simulated draws for the firms chapter.
  • Eaton and Kortum. Three islands with technologies 1, 2 and 0.5, θ = 4 and the shipping costs in island.py; 20,000 goods with Fréchet draws.
  • The counterfactual. The fifteen largest economies by 2019 GDP and the rest of the world; spending on home goods is GDP less goods exports (a rough proxy, since GDP is value added and services are left out); exact hat algebra with θ = 4 and each region's deficit fixed in units of world income.
  • The Island's zones. 400 zones with random industry mixes over 30 industries; each industry's import rise has a supply part (also seen by other rich countries) and a demand part that raises imports and jobs together; the planted effect is −0.6.
Chapter notes
# Chapter What it does
0 Fifty-eight boxes The Ideal X; the trade web of 2019; the question; objectives
1 Cars for cars The Grubel-Lloyd index for America since 1967
2 Variety and scale Krugman's model; the gain from trading with an identical country; the home-market effect
3 Play it: guess the trade Spain's exports to Portugal, Japan and Brazil, and gravity's predictions
4 Gravity Germany's exports against distance; least squares and PPML; borders
5 Exporters are rare Bernard and Jensen; the Island's firms
6 Melitz: selection Cutoffs, exit and reallocation; gains against shipping costs; the evidence
7 Eaton and Kortum Ricardo with a distribution: the formula and a simulation
— Intermission America's imports from China, 1985-2025, as a tune
8 One formula, and a counterfactual The ACR gains on 2019 data; hat algebra for US-China trade costs
9 The China shock Imports and jobs; Autor, Dorn and Hanson; shift-share on the Island
10 The tariffs of 2018 and 2025 Pass-through and the bill
11 Value chains The iPhone's gross and value-added accounting
12 The Dials The trade elasticity; pass-through; import competition and local jobs
13 In practice Trade-policy modelling and supply chains; Called it? on Krugman (1995)
14 Frontier Market power, services, time, adjustment, geography
— Outro The answer; twelve lines; problems; reading; next, Part 37, Cities and Regions
Notes
  • python -m videos.economics.labs 36: Krugman's gains and the home-market effect, gravity by least squares and PPML on CEPII's 2019 data, Melitz's cutoffs and firms, Eaton and Kortum's shares by formula and simulation, the gains formula and hat algebra on 2019 trade, and the shift-share design on the Island.
  • The interactive (course site): gravity. The reader sets the two countries' sizes, the distance and the distance elasticity, and sees the predicted trade and how it compares with real pairs.

Companion material in this repository

The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
  1. Hook: the Ideal X; a data film of the trade web; the question; objectives.
  2. Intra-industry trade (Grubel and Lloyd 1975): cars for cars.
  3. Krugman (1979, 1980): love of variety and scale; trade between identical countries; the home-market effect.
  4. Play it: guess the trade between two countries from their sizes and the distance.
  5. Gravity: Tinbergen (1962); the fit; borders (McCallum 1995) and the repair (Anderson and van Wincoop 2003): multilateral resistance.
  6. Firms: exporters are rare, large and productive (Bernard and Jensen 1995).
  7. Melitz (2003) derived: a productivity cutoff, selection, reallocation; trade raises productivity by killing firms.
  8. Eaton and Kortum (2002): Ricardo with a distribution; gravity from technology.
  9. One formula (Arkolakis, Costinot and Rodríguez-Clare 2012): the gain from trade from the home share and one elasticity; what it leaves out.
  10. Counterfactuals by exact hat algebra (Dekle, Eaton and Kortum 2008).
  11. The China shock (Autor, Dorn and Hanson 2013): commuting zones, the shift-share design and its modern reading; a decade of slow adjustment; the consumer side.
  12. The 2018–19 tariffs: near-complete pass-through to US import prices (Amiti, Redding and Weinstein 2019; Fajgelbaum et al. 2020).
  13. Value chains: trade in tasks; the iPhone's accounting; resilience (a pointer to Parts 63 and 66).
  14. Dials. 14. In practice: trade-policy modelling, supply-chain strategy. 15. Frontier: trade and market power; services trade; trade elasticities in the short and long run (Boehm, Levchenko and Pandalai-Nayar 2023).

Agora: trade (II): Krugman, Melitz and Eaton–Kortum models; a many-country quantitative model solved by hat algebra on real trade shares; gravity by PPML. Dials: the trade elasticity; tariff pass-through; local employment effects of import competition. Facts: gravity; exporters are few and productive. Called it? the pre-2000 consensus on trade and wages. Reading: Krugman 1979, 1980; Melitz 2003; Eaton & Kortum 2002; Anderson & van Wincoop 2003; Arkolakis, Costinot & Rodríguez-Clare 2012; Autor, Dorn & Hanson 2013; Levinson, The Box; Feenstra chs 5–6; Head & Mayer 2014.

Build the film

python -m videos.economics.econ36.compute        # the part's numbers, into .cache/econ36
python tools/build.py econ36                  # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py econ36 Hook   # one chapter, silent, with a contact sheet

Scenes: videos/economics/econ36. Setup: see the course page. Source of these notes: the README and the scenes' narration.

Build it
python -m videos.economics.econ36.compute              # every number (about a minute), into .cache/econ36/
python tools/qa_scene.py econ36 Gravity                # one chapter, silent, at 480p, with a contact sheet
EXPLAINER_TTS=silent python tools/build.py econ36 -q l   # the whole part, silent preview
python tools/build.py econ36                           # 1080p30 with narration and the series' computed score
python -m videos.economics.labs 36                     # the lab

The data are in explainer/economics/data/, registered in SOURCES.md: CEPII's Gravity database (V202211, Etalab 2.0), an extract of 2019; from FRED, the Census Bureau's imports from and exports to China, the BLS's manufacturing employment, the BEA's end-use trade, customs duties and imports of goods; and tables transcribed from Autor, Dorn and Hanson, Bernard and Jensen, Fajgelbaum et al., Boehm et al., Xing and Detert, McCallum, Krugman and accounts of the Ideal X.