Estimating the economy
Explore 512 parameter candidates, the economies they produce, and their fit to three observed moments. Repeated for every year from 1980 to 2023, this search gives the course’s final result, shown in 44 searches, one view.
The economic model is based on De Loecker, Eeckhout and Mongey (2026). For the low-discrepancy sequence behind the search design, see Sobol (1967).
Explore a saved searchYour task: fit one year
- Given
- Three observed moments, a supplied range for σ, N and ζ, and fixed random draws.
- Find
- The parameter candidate whose economy has the smallest weighted discrepancy from those moments.
- Check
- Its σ, N and ζ, the three model moments, each loss contribution and their total, against the answer folded under step 4.
Start with year 2000 and candidate 2. Trace that one candidate through the steps below, then compare it with Best of 512.
Which point fits?
48-second explanation · EnglishHow Sobol points cover the chosen search range
Place candidate points throughout the chosen parameter range, then solve and compare them. Read the search design.
Every dot is one solved economy.
Click a dot or move the slider.
1. Read the targets and the allowed ranges
Keep these inputs fixed while comparing candidates for 2000. The same Sobol points in the unit cube are mapped into each year's ranges.
Observed targets
Parameter bounds: lower → upper
2. Choose candidate 2, then follow its parameters
Type 2 in the candidate-number box, or select any dot. Every readout and calculation below follows that same candidate.
From a unit-box coordinate to this economy
For each parameter, x = lo + u × (hi − lo). Read across one row to see how the saved Sobol coordinate becomes the parameter used by the solver.
| Parameter | Lower lo | Sobol u | Upper hi | Mapped x |
|---|
N stays continuous in the search; M = floor(N) is the number of potential firms per market. Entry and exit determine how many operate. ζ picks φ, the fixed labor of each operating firm, which stays the same in period 2. Follow the economy → moments calculation in lesson 02.
3. Turn its three moment gaps into one score
Data ModelSubtract the annual target from each model moment. Square each gap, multiply by its fixed weight, then add the three contributions. Rate gaps enter this calculation as fractions; the rate columns display % and percentage points.
| Moment | Data | Model | Model − data | Weighted loss contribution |
|---|
4. Compare with the selected winner
Write down the current candidate's three contributions. Then click Best of 512 and record the winner's parameters, moments and contributions. Which gap accounts for most of the difference in total loss?
Check your result
| Year 2000 | Candidate 2 | Best of 512 (candidate 223) |
|---|---|---|
| σ | 0.047041 | 0.046471 |
| N (M) | 14.2227 (14) | 13.5695 (13) |
| ζ | 0.919212 | 0.949837 |
| Employment reallocation | 28.928% | 29.953% |
| Sales-weighted markup | 1.45031 | 1.46872 |
| SGA / total cost | 20.498% | 21.107% |
| Contribution: reallocation | 0.142521 | 0.00932641 |
| Contribution: markup | 0.0588546 | 0.00569989 |
| Contribution: SGA / cost | 0.125781 | 0.000882754 |
| Total loss | 0.327157 | 0.0159091 |
The targets for 2000 are 30.305%, 1.47703 and 21.163%. From candidate 2 to the winner the total loss falls by 0.311. Reallocation accounts for the largest part of the fall, 0.133, and the SGA cost share for nearly as much, 0.125; the markup accounts for 0.053.
The best available point can still miss a target.
Alternatives: the 15 lowest-loss points
Click one to compare it with the winner.
Try it yourself
Search 64 candidates for 2000 on your computer.
Download the code and data, unpack them, and run this command in the unpacked folder or at the root of the course repository. It needs Python 3.10 or later with NumPy and SciPy. One economy for 2000 takes about 4.5 seconds, so the 64 candidates take about five minutes on one core; add --workers 4 to solve four at a time.
python lessons/03_estimation/search_year.py --year 2000 --points 64
The script maps the first 64 of the 512 Sobol points into the search box for 2000, solves each economy, scores it with the three weighted squared gaps and prints the lowest loss. It then compares every economy with the saved candidates that this page shows.
Check your result
The lowest loss among the first 64 points is row 10298, Sobol point 57, with loss 0.026006. This page numbers the candidates from 1, so it is candidate 58: type 58 in the candidate box to compare.
| Moment | Model | Target | Contribution |
|---|---|---|---|
| Employment reallocation | 0.30690 | 0.30305 | 0.0111206 |
| Sales-weighted markup | 1.47426 | 1.47703 | 0.000631675 |
| SGA cost share | 0.20939 | 0.21163 | 0.0142537 |
The script prints the rates as fractions; the page shows them in percent, 30.690% and 20.939%. The output should end like this:
Compared with the saved candidates: 64 of 64 economies match; largest difference 0.
In the saved search of all 512 points for 2000, row 10298 has rank 4.
Rank 4 is the “Rank among 512” of candidate 58. On another computer the largest difference can be a little above 0, but far below the 10−10 the script allows. With --points 512 the script solves the whole year, about 40 minutes on one core, and finds the page’s Best of 512: candidate 223, loss 0.0159091.
Code on GitHub lessons/ ↗ · 07_python/ ↗ · lessons/ ↗
44 searches, one view.
Optional: does the fit survive new draws?
Same parameters, three new draws.
Each year’s σ, N and ζ, solved again with seeds 300, 301 and 302. As in the search, ζ picks φ from the new draws.
- Reallocation RMSE
- —
- Markup RMSE
- —
- SGA / cost RMSE
- —
Each error pools the 44 years and three draws. With the search’s own draws the three errors are 0.223 pp, 0.03971 and 0.103 pp. Reallocation moves most in the 11 years with ζ ≥ 1 (1986–1995 and 2002): there φ is ζ times the largest break-even value, which changes more from draw to draw than the value ζ picks when ζ < 1. Nothing is estimated again.
Method & interpretation
- 01512 pointsσ, N, ζ · same Sobol design
- 02SolveM = floor(N) · φ from ζ
- 03ScoreThree squared gaps · fixed weights
- 04SelectLowest loss in this finite set
- Plot: σ–N projection; ζ also changes.
- Weights: inverse 44-year sample variances.
- Display: rates in %; objective uses fractions.
- Read with care: boundaries, draw sensitivity, early-1980s markup above target.