About
The Margin is an independent sports analytics project, built by a data analyst to show the whole process: collecting data, modeling it, testing the model honestly, and publishing the results, including the misses.
Where the data comes from
Game results, schedules, and team and player box scores come from the public statistics on NBA.com, collected with the open-source nba_api library. Coverage starts in 1983-84, the earliest season with complete results, and includes the regular season, the Play-In, the playoffs and the NBA Cup final.
Every response is saved as it arrived, then cleaned and checked before anything uses it. Each game must have exactly two teams and one winner, the scores must agree with the result, and each season must have the expected number of games. If a check fails, the previous data stays in place and nothing new is published.
The source data has a few known problems, which are corrected the same way every time:
- 15 games from the 1980s whose box scores don't match the final result. The result is kept; those box scores are left out of box-score analysis.
- Some old schedule entries with wrong scores, and old playoff games with wrong arena details.
- Neutral-site games (international games, the 2020 bubble, NBA Cup final venues). The NBA flags these from 2024-25; earlier ones are identified by rule, and that rule matches the NBA's flag on every game where both exist.
How the forecasts are made
Forecasts come from an Elo rating model. Every team has a rating; the gap between two ratings, plus a home-court edge, gives each team's chance of winning. After each game the winner takes rating points from the loser, more after an upset or a big margin. Ratings drift back toward average between seasons, and home court is taken from the previous three seasons, because it has shrunk a lot since the 1980s. The full explanation, with examples, is in How the forecasts work.
The data is updated once a day, early in the morning (US time). Forecasts cover the next seven days and change only when one of the teams plays in between.
How it was tested
The model's settings were chosen using only the 1984-85 to 2004-05 seasons. It was then scored on 2005-06 to 2025-26, seasons it had never seen, against two simple baselines: always picking the home team, and picking the team with the better record so far. Every prediction in that test uses only games played before it. Results are on Performance.
Keeping score honestly
- Forecasts are recorded before tipoff and never edited. A forecast that changes is stored as a new one; the one that counts is the last one made before the game started.
- Every forecast names the model version that made it (currently
elo-v1-6af4de15). Changing any setting creates a new version, and older versions keep their record. - Backtests and live forecasts are kept apart. The live record started Nov 22, 2026; nothing from a backtest is ever shown as a live forecast.
- The Explorer's win chances are a replay. They show what today's model gives each past game using only earlier games, which is useful for exploring history but is not a track record.
Limitations
- The main model knows results, not players: injuries, trades and rest days only show up after they affect results. A candidate version, shown alongside it on Performance, adjusts for regulars who missed the team's last two games. It only sees absences once games have been missed; it doesn't use injury reports.
- Probabilities are estimates. A 70% favorite should lose about 3 times in 10.
- The live record is young; small samples swing a lot. Judge the method by the backtest and the live record together.
- The playoffs are the model's weakest area: a simple season-record baseline did slightly better there in testing.
- Forecasts are for analysis and discussion, not betting advice.
What is published
Data: NBA.com. This site publishes only its own derived outputs: forecasts, ratings, model scores, simulations, results as wins and losses, team records and names, and summary statistics behind the articles. It does not republish scores, box scores or other raw NBA statistics. It has no database and no server; every page is built ahead of time. The underlying data and code stay with the author.
Corrections and removal requests: if you hold rights in anything used here, or spot a mistake, email [email protected] and it will be changed or removed promptly.
Not affiliated with the NBA or any league or team. No logos or league branding are used.