Computational Economics
03 / Method

How each candidate is scored

The inputs, the three moment gaps and the weights behind the search.

This note describes the course’s implementation of the economy in De Loecker, Eeckhout and Mongey (2026); the search and its numerical settings are the course’s own.

  1. 01Try 512 pointsσ · N · ζ
  2. 02Solve10,000 markets · 2 periods
  3. 03ScoreSame three targets
  4. 04Keep the lowestOne selected candidate
The objective

Three gaps. Added up.

Gap = model − annual data
Employment reallocationw1 × gap12
Sales-weighted markupw2 × gap22
Sales-weighted SGA / total costsw3 × gap32
Weighted lossLoss
One fixed weight per moment
wk = 1Var44 years(targetk)
  • Full sample: 44 years
  • Sample variance: ddof = 1
  • Same weights for every candidate and year
Inside the objectiveRates as fractionsOriginal weights and targets
On the pageRates as % · gaps as ppDisplay only; the weights stay the same
How to read the small bars
  • Data/model bars: one common scale per year and moment, across all 512 candidates.
  • Brown bar: that moment's share of the selected candidate's total loss.
  • Adjacent value: actual weighted contribution.
  • The three contributions add up to the total loss, up to rounding.
Inputs

The inputs behind every dot.

Watch the 48-second explanation: Sobol points in the chosen range ↗

For year t, read the three targets from Moments.csv and the six bounds from boxes.csv. For candidate i and parameter p ∈ {σ, N, ζ}, map the saved unit coordinate as xitp = lotp + uip × (hitp − lotp). This gives three parameters for one economy; repeat the same mapping for each of the 512 points.

The selected-candidate walkthrough shows the actual u, bounds and mapped parameters. The solver uses M = floor(N), draws productivity with σ and the fixed seed, lets ζ pick φ, and computes the three moments. It then scores those moments against that year's targets.

How ζ sets φ

In the first round of period 1, the solver computes and sorts the firms’ break-even fixed-labor values. For ζ < 1, it selects the first value whose cumulative share is strictly greater than ζ. For ζ ≥ 1, it multiplies the largest value by ζ. That value is φ, and it stays the same in later rounds and in period 2. So ζ is a search coordinate and φ is an outcome of the solve. φ is in model labor units, not a percentage; 1e−6 is one millionth.

Source: qmp/equilibrium.py::_solve_period. Every candidate uses this rule.

Annual boxes
44
1980–2023
Candidates per year
512
Same 3D Sobol design
Potential firms
M = floor(N)
N is a continuous coordinate
Markets
10,000
Per candidate economy
Periods
2
φ from ζ
Random inputs
Seed 100
NumPy’s PCG64
Share tolerance
10−10
float64
Output-root tolerance
10−12
Same numerical precision
Design and checks
  • 512 points fixed in advance in each year’s search box.
  • Coordinates: productivity dispersion σ, continuous N, fixed-cost control ζ.
  • Lower corner included; upper corner excluded.
  • Candidates with the same M share the corresponding random inputs.
  • All 22,528 records must be valid.
  • Selection sorts by (loss, row_id).
  • The selected points are checked against the annual winners table.
Reading the results

What the annual results show.

Best of 512

The lowest saved loss.

  • All candidates use the same annual targets and fixed weights.
  • Top 15 lists the 15 candidates with the lowest loss.
Annual paths

Annual values, not smoothed.

  • Search boundaries can constrain a result.
  • The early-1980s markup stays above its target.
Numerical checks

Converged is not the same as stable.

  • A solve that converges can still change with new random draws.
  • See the optional fresh-draw check.
Fresh draws: what is held fixed, what changes?
Keep
  • The annual fitted σ, N and ζ.
  • The rule: ζ picks φ from the draws.
Change
  • PCG64 seeds 300, 301, 302.
  • New draws, generated for each M as in the estimation.
  • φ, which ζ picks from the new draws.
  • The figure shows the mean and the range of three draws.
  • Years with the same M share draws for each seed, so the year–seed results are not independent.
  • The draws follow the estimation’s convention for each M, not unit 02’s 18-firm draws.
Return to the fresh-draw figure ↗
Reproduce or extend

Keep each result with its inputs.

Code, records and merging
  • Python download: solver, estimation driver, a one-year search that checks itself against the saved candidates, and a script that runs the full search on one computer.
  • Choose the number of workers for your computer.
  • Keep each worker’s results with the inputs and settings that produced them.
  • Merge only runs with the same inputs and settings, and report every failed candidate.
  • Exercises cover checkpointing, parallel work, complete merging, box boundaries and measured scaling.