MLB Model Methodology
Hierarchical Bayesian skill model and per-PA Monte Carlo simulator, end to end
This model predicts a full distribution of runs per team per MLB game, then derives win, run-line and totals probabilities by simulating each matchup roughly 10,000 times. Predictions are graded daily against sportsbook lines. Sharp bettors move those lines toward true probabilities quickly, so the market is a better probability signal than most models built from scratch, mine included, and the published win probability borrows from it.
The current model (v2, live since May 12, 2026) has two layers: a hierarchical Bayesian skill model, a multinomial-logit over the eight plate-appearance outcomes fit with NUTS, and a per-PA Monte Carlo simulator with rest-aware bullpens, an empirical baserunner-advancement table, weather effects, and per-game posterior draws that carry parameter uncertainty through. It replaced an XGBoost regressor (v1) after a 542-game comparison against v1's live picks. v2 was scored in sample there, because its skill model had been fit on data that included those games. The live record since May 12 is the out-of-sample evidence.
Prediction target
Per-team run distribution per game
Skill model
Hierarchical multinomial-logit (8 outcomes), NUTS via numpyro / JAX
Training data
~480k PAs across 2024, 2025 and 2026 to date, growing nightly
Simulator
30 posterior draws × ~333 sims each (~10,000 per matchup)
Probability output
Sim reconciled with the market consensus, with p10/p90 bands
Picks
At most one ML or RL pick per game at 1 unit, totals off
No predictions for today yet. The chart populates each morning after the daily pipeline runs.
November 2, 2026
One market-priced pick per game at a flat unit
October 30, 2026
Forecasts graded against a closing line captured at first pitch
September 29, 2026
Run-line and totals probabilities reconciled with the market
September 8, 2026
Sampled pitcher workloads and a proven-reliever bullpen
September 4, 2026
Moneyline flags require a paired market anchor
See full changelog (6 older entries)
August 18, 2026
Published win probability anchored to the de-vigged market consensus
July 18, 2026
Weather effects in the simulator, and odds shopped across three books
May 27, 2026
Totals predictions switched off, and form noise raised to 0.18 in June
May 12, 2026
v2 cutover: hierarchical Bayesian skill model + per-PA Monte Carlo simulator
April 20, 2026 (v1)
Raised +EV thresholds from 3% to 4.5% (ML/RL) and 6.5% (totals)
April 2026 (v1)
Win probability switched from Poisson to negative binomial
The skill layer learns slow-moving parameters from years of Statcast data and is refit each morning of the season. The simulator turns them into per-game run distributions, and the markets layer reconciles those with the betting market and picks at most one bet per game.
Inputs
Statcast pitch data
~480k PAs, 2024+25+26-YTD
MLB Stats API
Schedule, lineups, rosters, boxscores, weather
The Odds API
ML, RL, totals across four books
Active bullpen workload
Per-pitcher outs per day (rest)
Bayesian Skill Layer
Batter model
~870 batters × 2 platoon cells
Pitcher model
~1,140 pitchers × 2 roles (SP/RP)
Park log-PF
30 venues, residual wOBA
Sampler
NUTS via numpyro/JAX, 4 chains × 2000 draws
Monte Carlo Simulator
Per-PA outcome sampler
Vectorized over 8 categories
Empirical advancement
P(state', runs | state, outs, outcome)
Rest-aware bullpen
Proven relievers, sampled workloads, 1d/2d caps
30 posterior draws × ~333 sims
~10,000 simulated games per matchup
Markets & EV
Market reconciliation
Sims reweighted to match ML, RL and total targets
One score distribution
Win, RL, totals and percentiles share the weights
One pick per game
Highest expected value at the best price
Flat stakes
1 unit per pick, totals switched off
During the season a full NUTS refit runs on GitHub Actions around 4 AM PT and, on success, triggers the scoring run, so scoring uses that morning's posteriors. From about 5 AM to 7:40 PM PT a lineup refresh fires every 20 minutes and re-scores any game whose posted lineup changed. A midnight job grades yesterday's games. In the offseason the refit is run by hand.
Predictions track lineups, scratches and late odds up to first pitch. Once a game starts its row is frozen, the database refuses any later write to it, and that final pregame version is what gets graded. A pick shown in the morning can change or disappear after a re-score. Earlier versions and all odds quotes stay in an append-only history. A pick also requires a known starter, a fully posted lineup and enough pitching-usage evidence, so a game scored on a fallback lineup gets no pick.
Schedule & Bullpen
Games, scores and per-pitcher workload
Lineups, Odds & Weather
Stats API lineups and weather, ML/RL/totals from The Odds API
Posterior Refit
Morning NUTS run in season: pitcher, batter, park (about 15 min)
Score Games
30 posterior draws × ~333 sims, ~10,000 per matchup
Derive Markets
Sims reweighted to the market targets, then one pick per game
Verify & Publish
Pairing, range, anti-correlation and posterior-age checks, then a write to Supabase
The stack is Python. PyMC describes the models, numpyro and JAX sample them, NumPy runs the vectorized simulator, and GitHub Actions and Supabase pg_cron schedule the jobs. Results land in Supabase (Postgres), the only source this Next.js site reads.
Each plate appearance is a categorical draw over eight outcomes: strikeout, walk, hit-by-pitch, single, double, triple, home run, in-play out. Three hierarchical models learn the additive log-odds offsets that each actor (batter, pitcher, venue) contributes to those logits, with OUT as the reference category. The pitcher model fits first and sets the league intercept. The batter model then fits with that intercept frozen, so both models share one baseline. On the log-odds scale, platoon, role, park and weather effects are additive terms.
Generative model (batter, schematic)
σb ~ HalfNormal(0.6)7 // batter-level scale per outcome
zi ~ Normal(0, 1)7 // non-centered batter offsets
βi = μ + σb ⊙ zi // batter i's log-odds vector
πi = softmax([0, βi])
yi ~ Multinomial(ni, πi) // aggregated per-batter PA counts
Two implementation choices matter at this scale. The parameterization is non-centered, which avoids Neal's funnel, the distorted posterior geometry that stalls HMC on hierarchical models. The likelihood is a Multinomial over each actor's aggregated outcome counts, which is mathematically identical to a per-PA Categorical but roughly 400× faster on 400k PAs (about 3 minutes against a projected 19 hours).
Batters are fit per (batter, vs_LHP) cell, with the platoon offset given its own tighter prior (HalfNormal(0.3)); pitchers per (pitcher, role ∈ {SP, RP}), with no platoon split. Position players who pitch in blowouts are dropped from the pitcher pool, with true two-way players exempted.
Park is fit last, on the residual wOBA after batter and pitcher effects. A per-venue scalar park_log[v] shifts the non-OUT logits, weighted by each outcome's wOBA coefficient, so HR and 3B move most under park and K, whose wOBA weight is zero, does not move at all.
Sampler diagnostics (4 chains, 2000 draws, 2500 tune)
| Model | R-hat | min ESS | Divergences | Wall |
|---|---|---|---|---|
| Batter (869 × platoon) | 1.00 | 1273 | 0 | 8.2 min |
| Pitcher (1142 × role) | 1.00 | 1724 | 0 | 6.4 min |
| Park (30 venues) | 1.00 | 33.9k | 0 | 15 s |
R-hat near 1.00 means the chains mixed and sample the same posterior. Effective sample size (ESS) is how many independent draws the autocorrelated chains are worth. The gate is R-hat ≤ 1.01 and minimum ESS > 400.
For each game I draw 30 posterior samples and run about 333 simulations per draw, roughly 10,000 per matchup. Each draw sets all batter, pitcher and park parameters together, so the spread across draws is parameter uncertainty and the spread within a draw is ordinary run-scoring noise.
Per-PA outcome sampler (vectorized)
+ park_log[v] · wOBA_weightk
+ weather_shiftk(temp, wind)
+ form_noisek // sigma = 0.18, per team per game, zero-sum across outcomes
π = softmax([0, ℓ1..7])
outcome ~ Categorical(π)
Indices: batter b, pitcher p, role ∈ {SP, RP}, venue v, outcome k ∈ 1..7 (K, BB, HBP, 1B, 2B, 3B, HR; OUT is the reference 0 logit).
On contact, baserunners move according to an empirical advancement table built from 365k Statcast PAs: P(new_state, runs_scored, outs_added | state, outs, outcome, out_subtype). Cells with fewer than 100 observations are shrunk toward the outcome-level marginal in proportion to their count. HR, BB and HBP advances are deterministic forced moves.
Each simulated starter leaves at a workload drawn from his recent starts (between 3 and 21 outs), or earlier after 6 runs allowed, 4 runs by his twelfth out, or 24 batters faced. The bullpen holds only established relievers from the active roster, ordered by how often they have pitched, and any reliever with ≥ 6 outs yesterday or ≥ 9 outs in the last 2 days is skipped. A reliever also works a sampled outing and comes out after 3 runs. In the postseason every bullpen arm is treated as rested. Workloads are refreshed daily from MLB boxscores.
Variance decomposition (per-game total runs)
+ Varform(per-game form noise, σ=0.18)
+ Varaleatoric(inning-level sim noise)
The form-noise scalar is calibrated against actual game outcomes. Calibrating it against market backtests would hide modeling errors inside the noise.
The pre-cutover shape check replayed 200 stratified 2025 games: simulated mean runs per team-game came out 4.59 against an actual 4.38 (+4.86%), and simulated variance 9.72 against 10.32 (−5.86%). The model is mildly underdispersed. Blowouts and large totals get a little less probability than they should, and that is one reason totals are switched off.
Market probabilities are counted directly from the simulated games, with no Poisson or negative binomial assumption on top. With hi, ai the home and away runs in sim i = 1..N and wi its weight (1/N before the market step below):
P(total > L) = Σi wi · 𝟙[hi + ai > L]
P(home covers sh) = Σi wi · 𝟙[hi − ai > −sh]
sh is the book's home spread (−1.5 means home must win by 2 or more). Only ±1.5 run lines are compared. Pushes split 50/50 at integer lines.
Before publication, each book's prices are de-vigged as a pair and averaged into a market consensus, and the simulated games are reweighted, as little as possible, to match three targets at once. The moneyline target blends the sim's home logit, shifted +0.09 for the home field the sim does not produce on its own, with the consensus at weight 0.5 on the sim. The run line matches the consensus exactly, and the total blends sim and market at 0.5. The raw sim flagged big underdogs as +EV all season, and they did not win at the rate it said. The weights were set with 2026 results in hand, so they are a product decision.
Percentiles, histograms and expected runs use the same weights, so all the numbers on a game describe one score distribution. If matching the market would lean on too few simulated games, the reweighting is rejected. The game then shows the moneyline blend, the plain sim for everything else, and no pick. A game with no paired moneyline shows the shifted sim probability.
The p10/p90 win-probability band comes from the 30 posterior draws, each of which yields a win probability. Their spread mixes parameter uncertainty with the noise of running only about 333 games per draw, so the estimated simulation noise is subtracted first, and the band is pushed through the same market blend. When the remaining spread is too small to tell apart from simulation noise, no band is shown.
Each game publishes at most one pick, the moneyline or run-line side with the highest expected value at the best available price. The pick probability behind that expected value is the de-vigged consensus, nudged toward the sim at a weight of 0.07 on moneylines and not at all on run lines, because on the 2026 games the sim added almost nothing the market did not already know. A pick at or above zero expected value is tier value, one slightly below it a lean, and each date's three best-priced games publish a minimum pick even below that floor so every slate has picks. Every pick is staked at 1 unit. Totals stay switched off.
Picks published before November 2, 2026 were flagged when the modeled probability beat the best price's implied probability by 4.5 points (6.5 for totals), sized at quarter-Kelly, and are still graded that way. A high-variance flag marks games where a team's simulated runs stdev exceeds 4.0.
Forecasts are scored against two market benchmarks: the morning consensus the forecast used, and a closing line the live worker stores once at first pitch, from The Odds API median across books with ESPN's DraftKings line as the fallback. Each closing row records which feed it came from, and the two feeds are counted separately.
The Grade is a 20 to 80 projection of true talent for a full season at the player's position. Fifteen traits (contact, power, discipline, batted-ball quality, platoon, range, arm, reliability, baserunning, sprint speed for hitters; stuff, command, bat-missing, contact management, workload for pitchers) are each a weighted composite of skill measurements from Statcast and Baseball Savant: swing decisions, whiffs, bat speed, exit velocity, pitch velocity and movement, outs above average, arm strength. A trait's weights are a bounded ridge fit of the player's own next-season value of that trait on the inputs, and the Grade's weights a second ridge of next-season runs above average on the traits, a shrunk three-season outcome record, and seasonal age. A hitter with a thin major-league record shrinks toward his translated Triple-A record instead of the position mean, and his Triple-A Statcast enters the inputs with a same-season level offset. Both fits use the 2021 to 2026 development pairs with each pair held out in turn. The hitter Grade also learns from in-season pairs, each month start scored against the rest of that season. Relievers have small samples, so their Grade is fit on full-season pairs back to 2015 and reads the pitch-level inputs directly beside the traits.
Trade value prices the projection over the player's remaining control years from Baseball-Reference contract data: projected FanGraphs WAR each season after the age curve, times the price of a win, minus salary, discounted 8 percent a year. Pre-arbitration seasons pay the league minimum, arbitration seasons a fitted share of market value, options go the way of whoever holds them. The price of a win, about $9.9 million per projected WAR, is fitted on verified free-agent contract values above the league minimum with separate prices for batters, starters and relievers. It is calibrated to those contracts and has not yet been checked against contracts signed after the fit. A player with no control years left shows a one-season Market value instead.
Impact is descriptive: FanGraphs wins above replacement for the completed season, read from the MLB Stats API. It anchors the season-by-season outlook.
The current grade has no untouched test yet. Its development pairs run 2021 to 2022 through 2025 to 2026, and the 2026 to 2027 pair is the first its design never saw. Held out one pair at a time, its rank correlation with next-season runs averages 0.47 for hitters against 0.37 for a Marcel projection, 0.42 for starters against 0.31, and 0.29 for relievers against 0.17. Hyperparameters were chosen on the same pairs, so these are development results. The previous version, scored once on the 2025 to 2026 pair it never saw, reached 0.40 for hitters against 0.38 for prior-season xwOBA, a gap within sampling noise. A comparison with ZiPS, THE BAT X and Steamer, on the grade's own fielding-inclusive target and on hitting alone, is on the performance page. A player is graded once his season-equivalent sample reaches 100 plate appearances or batters faced. Below that the page shows no number.
Prospect grades, award forecasts, playoff odds, pitch and batting run values and xWAR each have their own page: Prospects, Awards, Playoffs, Pitching value, Batting value, xWAR.
Before cutover, v2 was benchmarked against a pinned copy of the v1 XGBoost baseline on every completed 2026 game where both models had a prediction. v2's skill model had been fit on 2024 to 2026 data that included these games, so its side is in sample. v1's side is its live picks. The table shows that v2 fit the season better. Whether it forecasts better out of sample is a question for the live record since May 12.
| Metric | v1 | v2 | Δ | Gate |
|---|---|---|---|---|
| Brier score (ML) | 0.257 | 0.239 | −7% | – |
| Log-loss (ML) | 0.724 | 0.671 | −7% | – |
| Max calibration gap | 42% | 3% | −39pp | – |
| ROI moneyline (flagged) | +16% | +26% | +10pp | – |
| ROI run line (flagged) | +5% | +15% | +10pp | – |
| ROI totals (flagged) | −13% | −8% | +5pp | – |
Brier and log-loss are proper scoring rules, so the comparison scores calibration and sharpness together. v1's 42% max calibration gap is partly thin-bin variance, but the direction holds. Totals ROI improved on paper here, then kept losing once v2 went live, and totals were switched off. A six-week backtest is a small sample, and the ROI rows rest on a few hundred flagged bets or fewer. The numbers are rounded to match and frozen from that run. Live results, including ongoing Brier and calibration, are on the Performance page.
v1 was a gradient-boosted regressor (XGBoost) on 14 hand-built team-level features per game: starter and bullpen xFIP, WHIP and K/9, team OPS, ISO and K%, rolling run scoring, park factor, home field and bullpen rest. It predicted expected runs per team. Win, total and run-line probabilities came from a negative binomial score distribution with isotonic calibration.
v1 had no concept of individual batter or pitcher skill, so lineup changes, platoon advantages and bullpen identity were invisible to it. It also reported no parameter uncertainty, and its calibration degraded in the tails, so v2 replaced it. The v1 code was deleted on September 1, 2026. Its predictions before May 12, 2026 are kept in archive tables so the historical record is unchanged, and a dashed vertical line on every time-series chart marks the cutover.