Skip to content

MLB Model Methodology

Hierarchical Bayesian skill model and per-PA Monte Carlo simulator, end to end

Project Overview
Hierarchical Bayesian skill model + per-PA Monte Carlo simulator for probabilistic run prediction

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

Example Output: Today's Featured Game
Per-team simulated run distributions, win probability band, and total runs percentiles

No predictions for today yet. The chart populates each morning after the daily pipeline runs.

Model Changelog
Significant changes to model behavior, most recent first

November 2, 2026

One market-priced pick per game at a flat unit

On the 2026 games, 327 replayed moneyline picks over the 4.5-point bar won 42%, against a claimed 51% and a market-implied 42%, so the sim's edge was noise. Each game now publishes at most one pick, priced from the market consensus and staked at 1 unit in place of quarter-Kelly sizing. Earlier picks keep the thresholds they were flagged under.

October 30, 2026

Forecasts graded against a closing line captured at first pitch

The market benchmark used to be the morning quote. The live worker now stores one closing line per game at first pitch, and the frozen forecasts are also scored against it.

September 29, 2026

Run-line and totals probabilities reconciled with the market

The published win, run-line and totals probabilities now come from one reweighted score distribution that matches the moneyline blend, the run-line consensus and a totals blend. Before this, run-line and totals probabilities were pure sim.

September 8, 2026

Sampled pitcher workloads and a proven-reliever bullpen

Starters used to exit at a fixed batter count. They now exit at a workload drawn from their recent starts, and only established relievers enter the bullpen. The win-probability band now removes simulation noise before it is shown.

September 4, 2026

Moneyline flags require a paired market anchor

A moneyline play is flagged only when at least one book quotes both sides of the game, so the anchored probability behind the flag always exists.
See full changelog (6 older entries)

August 18, 2026

Published win probability anchored to the de-vigged market consensus

Underdogs the market priced under 33% came out at 37% from the raw sim and won 29%, so the sim flagged them +EV far too often. The published win probability became a logit-scale blend of the sim and the de-vigged consensus across the paired moneylines, plus a +0.09 home-field logit the sim lacks. The sim weight was 0.2, chosen on 2026 games already played, and moved to 0.5 on September 9, 2026 as a product decision. Both weights were chosen with those results in hand.

July 18, 2026

Weather effects in the simulator, and odds shopped across three books

Temperature and wind now shift the outcome logits per game, with coefficients fit on Statcast PAs controlling for park, batter and pitcher. Two days later the odds feed started pulling DraftKings, FanDuel and BetMGM and pricing each side at the best available number. Pinnacle joined them on November 2.

May 27, 2026

Totals predictions switched off, and form noise raised to 0.18 in June

Every totals edge bucket lost money on the 2026 backtest and model edge had no relationship to outcome, so totals flags are disabled. The per-game form-noise scalar went from 0.13 to 0.18 on June 16 after a recalibration against actuals.

May 12, 2026

v2 cutover: hierarchical Bayesian skill model + per-PA Monte Carlo simulator

Replaced the v1 XGBoost regressor after a 542-game comparison (Mar 26 to May 9, 2026), scored in sample for v2 against v1's live picks: Brier and log loss about 7% lower, max calibration gap from 42% to 3%, ROI higher on each market on paper. Totals then kept losing live.

April 20, 2026 (v1)

Raised +EV thresholds from 3% to 4.5% (ML/RL) and 6.5% (totals)

Below the typical vig on a −110 line there is no cushion for model miscalibration. v2 kept these thresholds until November 2, 2026.

April 2026 (v1)

Win probability switched from Poisson to negative binomial

MLB run-scoring is overdispersed relative to Poisson. v2 makes no parametric assumption and reads win probability from the simulated run distributions.
Architecture & Daily Pipeline
From pitch-level data to market probabilities: morning refit and scoring, intraday lineup re-scoring

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.

01

Schedule & Bullpen

Games, scores and per-pitcher workload

02

Lineups, Odds & Weather

Stats API lineups and weather, ML/RL/totals from The Odds API

03

Posterior Refit

Morning NUTS run in season: pitcher, batter, park (about 15 min)

04

Score Games

30 posterior draws × ~333 sims, ~10,000 per matchup

05

Derive Markets

Sims reweighted to the market targets, then one pick per game

06

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.

Bayesian Skill Layer
Hierarchical multinomial-logit per actor, fit with NUTS in numpyro/JAX

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)

μ ~ Normal(logitleague, 0.5)7 // per-outcome league intercept
σ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)

ModelR-hatmin ESSDivergencesWall
Batter (869 × platoon)1.00127308.2 min
Pitcher (1142 × role)1.00172406.4 min
Park (30 venues)1.0033.9k015 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.

Per-PA Monte Carlo Simulator
30 posterior draws × ~333 sims per draw, so parameter uncertainty reaches each game

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)

ℓk = μk + batter_offset[b] + vs_LHP · platoon_offset[b] + pitcher_offset[p, role]
+ 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)

Var(total_runs) = Varposterior(parameter draws)
+ 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.

From Simulated Runs to Market Probabilities
Weighted frequencies over the simulated games, reconciled with the market, and one flat-stake pick per game

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(home wins) = Σi wi · 𝟙[hi > ai]
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.

Player Grades
A projected grade, a trade value in dollars, and last season's impact for every 40-man player

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.

Head-to-Head Backtest vs Frozen v1
542 games, March 26 to May 9, 2026, scored in sample for v2 against v1's live picks.

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.

Metricv1v2ΔGate
Brier score (ML)0.2570.239−7%–
Log-loss (ML)0.7240.671−7%–
Max calibration gap42%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.

Legacy: v1 XGBoost Model (pre-2026-05-12)
Predictions on the History and Performance tabs before the dashed v2 cutover line come from this model

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.