Download & Run the Empirical Tests

All 284 empirical tests are fully reproducible from public data sources. The test suite downloads data from FRED, BEA, World Bank, OECD, Census, and other public APIs, then runs statistical tests against CES theory predictions.

Prerequisites

  • Python 3.11+ with pip
  • Git
  • Free API keys: FRED and BEA

1. Clone the repository

git clone https://github.com/jonsmirl/thesis-tests.git
cd thesis-tests

2. Set up the virtual environment

python -m venv .venv
source .venv/bin/activate    # Linux/macOS
# .venv\Scripts\activate     # Windows

pip install -r requirements.txt

3. Configure API keys

cp .env.example .env
# Edit .env and fill in your API keys:
#   FRED_API_KEY=your_fred_key_here
#   BEA_API_KEY=your_bea_key_here

4. Download all data

This fetches data from all public APIs and builds compiled datasets. Takes 5-15 minutes on first run.

python download_data.py --source all

To verify data without re-downloading:

python download_data.py --verify-only

5. Run all tests

python run_all.py

Results are saved to results/scorecard.json.

Running individual tests

# Run a single test
python run_all.py --test test_aggregation_puzzle

# Run all tests in a folder
python run_all.py --folder foundations

# Print last scorecard
python run_all.py --scorecard-only

Data sources

The download script fetches from these public APIs:

  • FRED — ~100 series (CPI, IP manufacturing, macro aggregates, PPI, employment)
  • BEA — Regional GDP/compensation/GOS/employment, NIPA tables, I-O tables, Fixed Assets
  • World Bank — WDI indicators (GDP, trade, Gini, financial depth) and WGI governance
  • OECD STAN — Structural analysis database (25 sectors, 38 countries)
  • Census BDS — Business Dynamics Statistics (firm entry/exit by sector)
  • NBER-CES — Manufacturing industry database

A small number of hand-compiled datasets (literature values, academic paper tables) are committed in data/compiled/.

Test structure

Tests are organized into 8 folders mirroring the Lean formalization:

FolderPaperTests
foundations/Paper 1CES emergence, correlation, estimation
curvature_roles/Paper 1Auctions, natural gradient, phase transitions
potential/Paper 2Akerlof, Arrow, H-O, Tsallis, institutions
dynamics/Paper 3Business cycles, crises, Onsager, Minsky
hierarchy/Paper 4Damping, dispersion, Leontief, EMD
entry_exit/Paper 6Firm dynamics, diversity, variety
macro/MacroTwo-factor CES, growth, tax, Ramsey
applications/Papers 6-7AI transition, stablecoins, trade