What is a win worth in ticket sales?
Fan Demand Lab
A SQL-first model of NBA home attendance, built end to end on AWS: S3 and Lambda collectors, DuckDB feature engineering, and a self-built Elo rating system validated against FiveThirtyEight's own historical ratings.
SQL · DuckDB · AWS
Team marketing departments have attendance numbers but rarely a clean answer to which levers actually move them: opponent quality, a win streak, a national TV slot, day of week. Without that, budget and scheduling decisions get made on instinct. This is a game-level model of NBA home attendance for a marketing-department audience, not a basketball-ops one.
My role
Solo: data engineering, SQL feature engineering, modeling, and the eventual write-up. Built on AWS specifically to deepen SQL and cloud data engineering alongside the job search. All feature engineering happens in DuckDB SQL, not pandas, so the repository doubles as SQL evidence alongside the model itself.
What is built so far
13 NBA regular seasons backfilled, 2013-14 through 2025-26. The two COVID-affected seasons are deliberately excluded rather than modeled around. Source: the ESPN scoreboard API.
A self-built Elo rating system, held to a 0.98 correlation check. Standard Elo, home-court adjustment, and season carry-over, validated against FiveThirtyEight’s historical ratings. One season came in far below the bar. Chasing it down separated a real bug (a date field off by a day, breaking most of the join) from a limit no tuning would fix: the excluded COVID seasons are also missing from FiveThirtyEight’s continuity, so one transition season can’t fully validate. Source: FiveThirtyEight’s historical ratings.
More of the pipeline
- Nightly AWS Lambda collectors (ESPN, SeatGeek, Ticketmaster) on EventBridge schedules, writing to S3
- A DuckDB warehouse where each SQL script asserts its own row counts and reconciles against a QC report before the next step runs
What’s next
Feature engineering, modeling, and the marketing-facing write-up. Findings publish once those phases are complete and validated, and recommendations follow the findings. The SQL pipeline and QC reports are in a private repository for now; publishing it, and linking it here, is a deliberate later step.
Limits
Nothing about attendance itself has been modeled yet. No number gets published until it traces back to the pipeline that produced it.
What I took from the work
The most useful moment so far wasn’t a modeling result, it was a validation check refusing to pass. Reporting the honest number instead of adjusting the model until the check went green felt like the actual point of building the check in the first place.