SPB Git forge

spb/wp19_uqo

Public
0commits 0branches 0releases
0 Bsize
maindefault branch
—last push
2.0 KB · 39 lines python
Raw Blame History
1"""Illustrative parameterisation report (no data are used). Prints the baseline parameters with units and the implied baseline2moments next to the ranges reported in the verified empirical literature (see research/lit_notes_B.md); run:3python -m src.calibration4"""5from __future__ import annotations67from pathlib import Path89import pandas as pd10import yaml1112ROOT = Path(__file__).resolve().parents[1]1314# (moment, model column, literature range, source keys) — literature values are *not* targets, only comparison points15COMPARISONS = [16    ("mean time on market of sales (months)", "mean_tom_sold_months", "a few months; no aggregate figure in the verified matrix", "—"),17    ("urgency / forced-sale discount, most urgent type (%)", "D_urgent", "about 27 (foreclosures), 0–21 (auctions), 3.7 for 9.5 days of waiting", "campbell2011forced; mayer1998auctions; levitt2008agents"),18    ("cash discount, transaction-weighted (%)", "—", "2–3.9 (Los Angeles); mortgage premium 11 (US, reduced form)", "han2024cash; reher2024mortgage"),19    ("price s.d. among identical houses (%)", "price_sd_total", "n/a (hedonic residual s.d. 10–20 includes quality)", "—"),20    ("seller contact-hazard elasticity to theta", "—", "0.84 (CRS)", "genesove2012search"),21]222324def main():25    cfg = yaml.safe_load((ROOT / "config" / "baseline.yaml").read_text())26    print("Baseline parameters (illustrative; see config/baseline.yaml for justifications)")27    for sec, vals in cfg.items():28        if isinstance(vals, dict):29            print(f"  [{sec}] " + ", ".join(f"{k}={v}" for k, v in vals.items()))30    m = pd.read_csv(ROOT / "results" / "processed" / "exp01_baseline_moments.csv").iloc[0]31    print("\nBaseline moments vs literature comparison points (not calibration targets)")32    for name, col, rng, src in COMPARISONS:33        val = f"{100 * m[col]:.2f}" if col in ("D_urgent", "price_sd_total") else (f"{m[col]:.2f}" if col != "—" else f"alpha = {cfg['matching']['alpha']}")34        print(f"  {name:<55} model {val:>8}   literature {rng:<45} [{src}]")353637if __name__ == "__main__":38    main()39