Data
- Matches and odds. 235,796 matches from 38 leagues (2000–2026) with result, reference-bookmaker 1X2 odds, the maximum price across about 17 bookmakers and pre-match Elo ratings. They come from Football-Data.co.uk and ClubElo, compiled by Adam Gábor (2026), Club Football Match Data, under the MIT licence. The raw file (about 45 MB) is not stored in this repository: the script downloads it and only aggregated results are published.
- Spanish market. Annual reports from Spain’s gambling regulator (DGOJ) and a compilation in the Revista Española de Drogodependencias. Every figure links to its source in spain.json.
- Prevalence. The ESTUDES and EDADES surveys from the Spanish Observatory on Drugs and Addictions (Ministry of Health).
Techniques
- Monte Carlo simulation with a seeded pseudo-random generator (mulberry32), run in a Web Worker.
- Kaplan–Meier survival curves, treating players who stop after reaching their target as censored.
- Margin removal by three methods: proportional, power and Shin (1993), solved numerically.
- Calibration with 95% Wilson intervals, compared by log-loss and Brier score.
- Bootstrap intervals (percentile) for the average return of each odds range and each strategy.
- Ordinal logistic regression on the Elo difference, fitted by maximum likelihood with a time split: trained up to 2015/16, evaluated from 2016/17.
- Machine learning: multinomial logistic regression and gradient boosting (scikit-learn) on leakage-free form features, with season-by-season walk-forward validation, hyperparameters chosen on a temporal hold-out, grouped permutation importance and a paired-bootstrap comparison with the market.
Code
The site is built with Astro, React and TypeScript. The charts are hand-built SVG on top of d3 scales, with tooltips, a table view and dark mode. The maths lives in src/lib, separate from the interface and covered by tests (Vitest): the exact edge of each game, the gambler’s ruin formula, Kaplan–Meier and the margin methods. The odds analysis and the models are Python scripts (pandas, NumPy, SciPy and scikit-learn) in analysis/ that write the JSON the site reads.
npm install && npm test && npm run build
pip install -r analysis/requirements.txt
python analysis/odds/pipeline.py path/to/Matches.csv
python -m unittest analysis/odds/test_features.py
python analysis/odds/ml.py path/to/Matches.csv
python analysis/navidad/prizes.py Limitations
- The lab’s game models are simplifications: real slots have more complex paytables, though the edge works the same way.
- The odds analysis only covers the pre-match 1X2 market, one of the cheapest for bettors.
- Spanish market data are annual aggregates. Some earlier figures are revised in later reports.
Author
A project by Ángel Zamora Martínez, PhD in Psychology and data analyst. Code released under the MIT licence. If you spot a mistake, open an issue.