This repository implements and validates a numerical calibration of a dynamic product-line model with country- and state-specific research capital. The exercise asks how hard exit targets for advanced- and middle-income producers restrict stationary solutions for catch-up, innovation, and frontier sorting.
The repository is a computational research prototype, not a finished structural estimate. The archived vectors solve the implemented system to high precision, while the diagnostics also show that the current moments do not point-identify a unique equilibrium.
- Translates the static and dynamic model blocks into nine equilibrium and first-order-condition residuals.
- Adds four calibration targets: a wage ratio, an R&D-intensity ratio, and two catch-up probabilities implied by the exit moments.
- Uses bounded parameter transformations and deterministic multistart nonlinear least squares.
- Recomputes saved results instead of trusting stored metadata.
- Checks transition-matrix invariance, constraints, archived roots, and local Jacobian rank.
- Regenerates compact result tables and representative sampled points.
The archived reference vector has a maximum hard residual of
The
The archived search count is sensitive to numerical-library versions. Python 3.12.13, NumPy 2.3.3, pandas 2.2.3, and SciPy 1.16.2 are pinned here.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
pytestValidate the reference point:
python scripts/reproduce_selected.pyRun the broader independent diagnostics:
python scripts/audit_selected_equilibrium.pyRegenerate result summaries from the archived roots:
python scripts/summarize_results.pyThe full multistart search is slower and writes to outputs/recomputed/ so it
does not overwrite the archived reference files:
python scripts/search_multistart.py --workers 8A fast smoke test is available with --max-seeds 5 --workers 1.
| Path | Purpose |
|---|---|
src/hard_exit_model/equilibrium.py |
Economic primitives, transforms, static block, contests, Bellman equations, FOCs, and serialization |
src/hard_exit_model/calibration.py |
Hard residuals, search bounds, and root deduplication |
src/hard_exit_model/diagnostics.py |
Transition, metadata, Jacobian, and identification checks |
scripts/search_multistart.py |
Deterministic parallel nonlinear search with run metadata |
scripts/reproduce_selected.py |
Fail-loud verification of the archived reference vector |
scripts/summarize_results.py |
Reproducible CSV and representative-result generation |
scripts/audit_selected_equilibrium.py |
Independent numerical and model-scope audit |
tests/ |
Transform, derivative, accounting, archive, seed, and solver tests |
config/ |
Authoritative calibration targets and restrictions |
seed_data/ |
Inputs used to construct deterministic multistart seeds |
outputs/ |
Archived roots and compact descriptive results |
The code establishes numerical accuracy for the equations that are actually implemented. It does not establish uniqueness, global optimality, empirical validation of the preliminary exit moments, or full resource feasibility. These distinctions are documented rather than hidden; see Model and computational structure, Validation and limitations, and Output provenance.