NFL Timing Study:
Bayesian Analysis (Patriots)
Research Overview
Built a scraping pipeline and Bayesian model to test whether game timing (night vs. day) measurably shifts the Patriots' win probability after controlling for home field and opponent strength.
The Question
Popular belief: the Pats are "better at night." Reality check: is the timing effect statistically credible once we account for confounders?
Data Pipeline
- Sources: Multi-year game logs (opponent, location, score), kickoff time, rest days.
- Scraping: Requests/BeautifulSoup for static pages; Selenium fallback for JS-rendered pages.
- Cleaning: Standardized team names, parsed kickoff as night/day, created features:
home
,night_game
,rest_days
, optionalelo_diff
. - Storage: CSV + SQLite snapshot per run with idempotent writes and de-duplication.
Model
- Outcome: binary win (1/0).
- Link: logistic regression in a Bayesian framework.
- Predictors:
night_game
,home
,elo_diff
(or opponent strength proxy),rest_days
. - Priors: Normal(0, 1) on coefficients; weakly informative intercept.
- Inference: PyMC NUTS; 4 chains, 2k draws; checked
r_hat
, ESS, and energy diagnostics. - PPC: Posterior predictive checks to validate calibration.
Results
- Night Game Coefficient: median near zero with wide credible interval overlapping 0 (i.e., no strong evidence of a timing effect once controls are included).
- Home Field: positive and credible, as expected.
- Opponent Strength: meaningful driver of outcome; rest days small/modest effect.
Interpretation: any "prime-time magic" is likely narrative, not signal—at least for the studied seasons.
Takeaways
- Bayesian framing makes the uncertainty explicit; we report credible intervals, not just p-values.
- Scraper + schema-first exports make reruns robust to site changes.
- Template generalizes to other teams and hypotheses with minimal changes.