Category Archives: Information

The Simulation Part 5

This post will continue to explain how this simulation works.  There are no magic bullets in handicapping and this model only looks at a subset of information.  It doesn’t take into account weather, traveling schedules, righty/lefty matchups, etc. etc.

The premise of these simulations is by looking at similar historical matchups we can better understand similar matchups for future events.

The generated probabilities are based upon player value assigned by this data model which is solely based upon run production.  Defensive stats are very subjective and are not part of this model. This model counts runs scored, runs scored against, assigns them to players, and converts that into a W-L number.  Every run is accounted for and in the end, all numbers must match.  The sum of players on a team must equal the team numbers.

Defense is very important but it involves imaginary runs; runs that should have scored but didn’t due to above average defense, and runs scored but shouldn’t have due to sub par defense.  None of these runs are counted in box scores.  This model counts errors on a team level which are measured by an official score keeper.  We know with 100% certainty how many unearned runs a team let’s up.  Making errors is bad defense so we know teams who suffer.

There are stats that attempt to measure defensive ability but hat is a completely separate measure that cannot be integrated into this WAA measure.  WAR integrates defensive stats  which is why WAR has flaws.  It is how Darwin Barney got ranked part of the top 50 players with WAR in 2012 where this model had him in the bottom 200 based upon his hitting.  There is no way whatsoever fielding can make up for that — especially on a team that lost 101 games with a team WAA = -40.  Losing is a team effort.

Results from this simulation should be used as a lens into the past to clearly see strength and weakness between two teams.  Lineups and Relief are groups of players, a starter is a single player.  These get matched up as follows:

  • AWAY Lineup –> HOME Starter
  • AWAY Lineup –> HOME Relief
  • HOME Lineup –> AWAY Starter
  • Home Lineup –> AWAY Relief

Lineups don’t face other lineups, they face pitching just like starters don’t face other starters either.  Games are usually framed by the two starters listed prominently in game promos.   Strength of lineups and relief are not.   This model breaks down all three aspects of each team.

Each of the above 4 bullet items ( Tier Combos ) generates an integer from +6 to -6 with reference to a lineup.  The best lineup facing the worst pitcher would be +6.  Worst lineup facing best pitcher would be -6.

There are around 100K games since 1970.   A snapshot of every player, every team, every relief squad, and every lineup is measured at the beginning of each day.  Tier Combos get assigned and we count how many runs each lineup scored that day.  That gets pushed into a distribution based upon its Tier Combo integer.

Let’s look at today’s CHN game with SEA.

processing CHN_SEA_05_01_6:40_PM -1 2 1 1
processing CHN_SEA_05_01_6:40_PM 25622 177168 24769 208265

The above processing records show -1 2 1 1 representing the 4 Tier Combos described in the above bullet list.  First number, -1 , means AWAY Lineup (Cubs) one tier worse than HOME Starter.  but two tiers better than HOME Relief, second number, +2.

Seattle has an exceptional top top tier lineup but Jon Lester is pitching today and he’s having another decent season so SEA lineup is only 1 tier above Lester and one tier above CHN Relief.

Lineups score runs.  How many depends upon the value of pitching they face.  The next 4 numbers shows how many games are in the distribution for lineup –> starter combos, how many innings are in the distribution for lineup –> relief combos.  The -1 lineup –> starter was seen in 25622 instances since 1970.  There are 100K games and two lineup –> starter combos per game.  Thus 25K represents around 1/8 or 12% of total instances.

The number of instances drop off as the difference in talent increases.  For example, a +6 Tier Combo pitting the best lineup against the worst pitcher only has around 2K instances to draw from in its distribution.

The simulator runs 1 million iterations randomly grabbing runs scored from whatever distribution for lineups against starter, lineups against relief, home and away, counts who wins and loses, and in the end calculates a Win%.  This uses  historical games that actually happened in real life.

A lineup –> starter combo lookup returns a number of runs and how many innings pitched for a starter.  Better starters will pitch longer and use less relief, vice versa for worse starters.  Lineup –> relief returns number of runs/inning.   That number will be low for bad lineups against good relief, high for the opposite.

The foundation for everything above is the WAA value generated for players by this data model.  In Part 6 we’ll go over more examples using current game data.  Right now a rudimentary prototype page showing all current games is up here.  Still learning HTML5 and javascript.   We’ll step through in more detail with examples what those numbers mean.  Even though you may not agree with the EV value calculated on the differences between Vegas and TC SIm, probabilities the underlying L, S, R info is a valid representation of that team at that moment in time.

There are some issues however and those will be discussed in subsequent parts to this series.  That is all for now.  Until then ….

Standings Prototype

Update 4/28/2019: A prototype WordPress page will now be kind of updated until this gets automated;  That page is here and in the main menu above.

Update 5/1/2019: A prototype non WordPress auto updated page replaces both this post and the above WordPress page.  Eventually the entire data model for all MLB teams and minor league affiliates will have its own web site outside of WordPress.  WordPress is a convenient easy to use framework but requires too much manual intervention to update.

This post will show a standings prototype format keeping numbers down to an absolute minimum but providing a unique insight by using data fundamental to this data model.  The goal for this season is to build a web interface that will allow you to drill down into any team for the current year and get real time information based upon the valuations from this data model.  In past years we mainly talked through the Cubs numbers.

The code to manage and do lookups into this model has been available as bash shell and perl scripts for me to publish here since the beginning and has been refined over the years to include more features.  A prototype web interface was set up in 2013 using static html pages.  This is not an ideal way of doing things.  Once handicapping begins we should have a rudimentary interface set up for current year data.  The historical data will be added as the season progresses.

That said, the first of these scripts was finished and I’ll just copy/paste the html code here.  The table below shows divisional standings for all 30 MLB teams using a modified team status record.

Update: These tables will be replaced manually for now.  Updated for today, 4/24/2019

MLB Standings as of beginning of day 4/24/2019

NL Central

TeamID W L BAT PITCH UR
SLN 14 9 20.5 3.4 2.7
PIT 12 9 -34.0 38.5 -3.3
MIL 13 12 15.0 -29.5 5.7
CHN 11 10 8.5 17.5 -4.3
CIN 9 13 -27.5 29.5 4.7

NL East

TeamID W L BAT PITCH UR
NYN 13 10 19.0 -16.5 -11.3
PHI 12 11 10.0 -7.5 -2.3
WAS 11 11 12.0 -4.5 3.7
ATL 11 11 11.5 -1.6 -0.3
MIA 7 16 -44.5 -2.5 2.7

NL West

TeamID W L BAT PITCH UR
LAN 15 10 30.0 -5.5 -1.3
SDN 13 11 -23.0 10.4 -1.3
ARI 13 11 16.0 -8.6 1.7
SFN 10 14 -32.5 21.5 0.7
COL 10 14 -19.5 -2.6 3.7

AL Central

TeamID W L BAT PITCH UR
MIN 13 8 10.5 8.4 0.7
DET 12 10 -36.5 29.4 -1.3
CLE 12 10 -27.0 21.5 -1.3
CHA 9 13 -1.5 -15.4 -2.3
KCA 7 17 -4.0 -26.5 4.7

AL East

TeamID W L BAT PITCH UR
TBA 16 8 10.5 31.5 6.7
NYA 13 10 11.5 17.5 0.7
TOR 11 13 -7.5 17.5 -4.3
BOS 9 15 -11.5 -29.6 -3.3
BAL 9 16 2.5 -50.6 -3.3

AL West

TeamID W L BAT PITCH UR
SEA 16 10 56.0 -16.6 -10.3
HOU 14 9 7.0 16.5 0.7
TEX 12 10 13.0 -19.5 2.7
OAK 13 13 18.0 -17.5 3.7
ANA 9 15 -3.5 -13.6 3.7

Edit: The below was written 4/22 for the first prototype which has been replaced above.

No baseball sites show BAT and PITCH and UR numbers which can be very interesting.  Although Seattle has the best record in MLB right now, their PITCH and UR is terrible.  How will that affect them down the road?   Pittsburgh who lead the NL Central right now have terrible BATting but great PITCHing.  The Mets have the worst Unearned Runs above average at -11.9 but they’re second in NL East.  Will that haunt them?  Can they improve?  Who knows?

On the web interface you’ll be able to click on each team and examine their roster valuations according to this data model.  This will be important information as you see the handicapping coming in May.  Until then ….

Cubs Brewers Matchup

Cubs start a short two game series with the Brewers today. Let’s look at the Brewers to get an idea what the Cubs are up against.

MIL Team Status

BAT PITCH Rs Ra W L UR LR TeamID
-0.9 38.2 284 242 39 26 2.4 2.2 MIL 6/11/2018
-0.6 20.8 533 507 67 54 1.6 4.2 MIL 8/14/2018

The Brewers were +13 two months ago and they’re +13 today.  Their BAT remained the same but PITCH tanked a little.  Their PE estimate suggests they should be at around +6 so they are exceeding expectations with respect to run differential.  The MLB commissioner however only looks at the win/loss column when determining who goes to the playoffs.  Let’s hear what the people think of these two teams.

Ouija Board

DATE 08_14_2:20_PM MIL CHN

LINEAWAY MIL [ 0.455 ] < 0.435 > +130 $230
STARTAWAY 0.59(0.519) Jhoulys_Chacin_MIL TIER 3
--------------------------------------------
LINEHOME CHN [ 0.583 ] < 0.583 > -140 $171
STARTHOME -0.29(0.489) Jose_Quintana_CHN TIER 3
--------------------------------------------
MIL 67 54 CHN 68 49
DELTAWAA 6 WINPCT 0.542 CHN
--------------------------------------------
TIER COMBOS
MIL Lineup 2 ==> CHN Starter 3 / Relief 2 == 0.495 MIL 4.67 runs
CHN Lineup 1 ==> MIL Starter 3 / Relief 2 == 0.505 CHN 4.73 runs
--------------------------------------------
EXPECTED VALUE
deltaWAA EV MIL 105 CHN 93
TCsim EV MIL 114 CHN 86

The Tier Combo simulations call this an almost even steven game.  The market favors the Cubs with a 58.3% break even probability of winning today.   Expected Value based upon Tier combo simulations give MIL 114 which is well above 100 but below our 120 threshold.  Both lines a discard.  Let’s look at the Tier breakdown for MIL.

MIL Tier Data

Type Tier Name_Teamid WAA
Lineups 2 MIL 8.32
SP 3 Chase_Anderson_MIL 0.38
SP 3 Jhoulys_Chacin_MIL 0.59
SP 2 Junior_Guerra_MIL 1.97
SP 3 Wade_Miley_MIL 1.74
SP 3 Freddy_Peralta_MIL -0.50
RP 2 MIL 6.07

That’s a pretty mediocre starting rotation.  They have a Tier 2 above average relief staff (RP) however.  Lineup is also Tier 2 which exceeds what would be expected from their completely league average BAT in team status.  Team status is based upon seasonal run differential and as the season progresses, negative players go and positive players are acquired — especially for teams in the hunt for a playoff spot.  Below are the relievers Cubs will face according to our source for current rosters.

MIL Relief

Rank WAA Name_TeamID Pos
+034+ 3.63 Jeremy_Jeffress_MIL PITCH
+037+ 3.46 Josh_Hader_MIL PITCH
XXXXX 1.11 Dan_Jennings_MIL PITCH
XXXXX 0.46 Jacob_Barnes_MIL PITCH
XXXXX 0.08 Corbin_Burnes_MIL PITCH
XXXXX -0.63 Jordan_Lyles_TOT PITCH
XXXXX -0.69 Corey_Knebel_MIL PITCH
-185- -1.24 Aaron_Wilkerson_MIL PITCH
Total 6.18

Note:  There is a difference in total value between this table and the Tier Data table.  This is due Jordan Lyles whose TOT value is an estimate — but it’s very close.   The sims use the Tier Data table.

Now let’s look at that Tier 2 lineup Cubs pitching will face.

MIL Lineup

WAA Name_TeamID Pos PA Aug_12_1:35_PM
-0.92 Lorenzo_Cain_MIL CF 439
3.97 Christian_Yelich_MIL LF-RF-CF 454
5.29 Jesus_Aguilar_MIL 1B 393
1.51 Ryan_Braun_MIL LF-1B 313
-0.50 Hernan_Perez_MIL 2B-RF-3B-LF-SS 257
1.07 Mike_Moustakas_TOT 3B-DH 470
-0.15 Jonathan_Schoop_TOT 2B 402
-1.16 Manny_Pina_MIL CR 266
-0.80 Chase_Anderson_MIL PR 38
TOTAL WAA=8.32 PA=3032 WinPct=0.553

According to this data model Jesus Aguilar is right behind Javier Baez for NL MVP.   Again, past results do not affect future results.  These numbers only show capability to estimate a probability.  Anyone who thinks their math can predict the future is peddling in Astrology — a field many people believe is true.

That is all for now.  Game starts in 7 minutes … Go Cubs.

How often does leadoff man get a hit?

The other day at the pub there was an argument whether Joe Maddon preferred beer or wine.  Since he is spokesman for Binny’s Beverage Depot holding a glass of wine people thought that was proof of his preference for wine.   That led to a question about the Binny’s leadoff man promo:  How often does the leadoff man get at hit?

Since I don’t get event data for this year until December from retrosheet.org I can’t tell.  Luckily there’s this site called Google that has answers to every question imaginable.  Here is  current year data according to Binny’s Beverage Depot.

binnys2

As of August 10 the Cubs played around 114 games so 28/114 = 0.245.   Binny’s has a payout ratio of around 1/4.  If you were to bet the Binny’s leadoff man promo this would be good to know.  It seems low however.   Usually managers put the hottest hitter in the leadoff spot because the leadoff hitter bats the most.  Mathematically you want your best hitter to get the most plate appearances.  There are always exceptions.

The 0.245 above is not a batting average and since retrosheet.org does not publish current year event data until December we don’t know how many walks there are this season at the leadoff spot.  We know there are always exactly 0 sac bunts and sac flies for the first batter in every game.  We have event data from past years.  Here is a table compiled for the year 2017.

Year Hits Binnys % CUBS BA LEAGUE % LEAGUE BA
2017 41 0.253 0.270 0.243 0.265

Second column shows Binny’s paid out on 41 hits with a win % of almost exactly 1/4.  The  LEAGUE % column is if Binny’s had to pay out for every team in every 2017 game.  It is lower than the Cubs which should be expected because the Cubs had a good team last year.

The fourth column incorporates walks into the BA stat and it’s 0.270, also higher than league average.  But what does this mean?  There are a bunch of tables In Part 5 of our OPS series.  Scroll down to second table and you will see the average league wide BA from 2010 – 2017 is 0.262 which is almost matches the LEAGUE BA column  above.

What does that mean?  I don’t know.  Here is a complete table from 2010 – 2017.

Year Hits Binnys % CUBS BA LEAGUE % LEAGUE BA
2010 33 0.204 0.213 0.238 0.258
2011 49 0.302 0.327 0.241 0.261
2012 40 0.247 0.265 0.242 0.262
2013 37 0.228 0.245 0.236 0.257
2014 40 0.247 0.263 0.244 0.263
2015 35 0.216 0.240 0.244 0.262
2016 52 0.321 0.382 0.260 0.284
2017 41 0.253 0.270 0.243 0.265

One of the baseball constants used in this data model is  1 game = 38.4 plate appearances.  PA is a measure of playing time and that’s how you convert PA into games.  Pitchers have a baseball constant used forever which says that there are exactly 9 innings to a game.  A game is not always 9 innings but they kept the math simple because they didn’t have calculators when Ted Williams played.  In the end it doesn’t matter.  Nine innings/game is close enough just like 38.4 PA/game.

The leadoff hitter then represents 1/38.4 = 0.026 = 2.6% of all plate appearances.  This lack of data leads to a large year to year variation in payouts which you can see in the above table.  Binny’s had to payout almost a third of the time in 2016.

Not sure what the above is supposed to mean however.  New series with the Brewers tomorrow so we’ll have a look see into their team.  Until then ….

The Ouija Board Part 4

The Ouija Board is once again expanding.    It is called a  Ouija Board here because markets are influenced by many people resulting in an outcome that comes very close to an actual probability — as if it was controlled by the beyond or the future.  We can measure error in the market by comparing them to  actual results (because we’re from the future now).  The market, or the house line, is very accurate in most cases.

The purpose of this handicapping model is to validate player and team evaluation math behind this data model.   If this model is a more accurate representation of the past than Sabermetrics, then our handicapping should have less error than the market which means the market can be exploited to gain a percentage edge on the house — much like what is done counting cards in blackjack.  The house only sets the opening line, the market, all the people pushing and pulling on that Ouija Board, set line adjustments during the day.

In Part 4 of this series a league wide table will be introduced showing Expected Value instead of probabilities.  This concept can get very complicated but our use case is rather simple.  We only have a single probability and a single value so our equation looks like this:

EV = P(win) * Value

In past Ouija Board sections we have been eyeballing percentages.  Our margin was 0.07 over the break even probability in order to for a line to become a betting opportunity.   The break even probabilities in all Ouija Board sections have an expected value of $100 on a $100 bet.  This means in the long run you break even betting a line where your expected probability equals that.   It makes no sense to bet if you only break even, less so if your expected value is less than your bet.  In all games in Vegas your expected value on every bet is less than your bet.  The house always gets a cut which pays for all the flickering lights.

Although adding a rough margin to probabilities was fine for eyeball estimates to see if we’re in the right ballpark (pun not intended),  it’s not proper to use that kind of math in an algorithm.  We must manipulate expected values, not probabilities which are ratios between 0 and 1.

A simple example of expected value is flipping a coin.  Heads and tails are two equal outcomes so each has a probability = 0.500 or 1/2.  If you bet $1 on heads or tails your expected value of that bet would be:

EV = P(heads or tails) * $(1+1) = 0.5 *$2 = $1

Not too complicated.  Since your expected value on a $1 bet is exactly $1 if you played this bet a trillion times you would end up losing nothing and gaining nothing.  It would be a complete waste of time.  If you had a loaded coin where you increase the probability of your pick to say 0.600 instead of 0.500 then your EV would be:

EV = 0.600 * $2 = $1.20

This means for every bet you will average $0.20 profit and if you play this a trillion times you’ll be very rich with virtual certainty.

Like a flip of a coin, the probability behind a baseball game is just as simple.  There are two possible outcomes, home team wins or away team wins — that’s it.  If you knew nothing of either team or where they’re playing you would have to assume each team has a probability of 0.500 — like a flip of a coin.

We have more information however.  Home field advantage is historically 0.540 home team, 0.460 visiting team.  If you knew nothing other than which team is home and away you could assume home team probability is 0.540 and away field is 0.460.

Just knowing home/away is not good enough however.   There are differences in win loss records and differences in starting pitching, lineups, and relief.  These are somewhat  independent from each other in that win loss record has some influence on the value of talent playing for a single game but we don’t know how much.  Teams with great records have been known to slide into oblivion at various points in the season and vice versa.  This demise or rise would be due to the makeup of the talent on the team.  This is where Tier Combo simulations come into play and the basis for our handicapping.

Update 7/13/2018:   There is a relationship between win/loss record differences (deltaWAA) and the Tier Combo simulations based upon player talent.  That relationship is unknown right now.

As has been explained in the many matchup posts here, deltaWAA is a table lookup that represents the differences in wins and losses between the two teams.  DeltaWAA is double what most people call games behind.   We chose a dataset from 1970 – 2016 and counted wins and losses based upon deltaWAA and derived a table of win/loss percentages from it.  So if deltaWAA is say 10 the higher team should have a probability greater than 0.500.  That is one way of  handicapping two teams.

The Tier Combo simulations take a snapshot of value for each day of those 46 years and run the tiering calculations that are done each day for this current season.  Historical data  based on the combination of talent between the two teams are turned into a distribution which is used in simulation to estimate win/loss percentage — which is an expected probability for that game.

Which probability is correct;  deltaWAA or Tier Combo?   Both of these could be independent or somewhat dependent.  A team that enjoys a high deltaWAA should have high value talent playing.  If they don’t then perhaps  Tier Combo simulation results should take precedent.

The following is a first draft of a table showing all the expected values on $100 bets for each game today 7/12/2018.  The Cubs start a new series tomorrow with SDN so more will be explained then.  Don’t like showing tables with a lot of numbers and the below will be consolidated in the future.

Expected Values for 7/12/2018

Away Home Away simEV Home simEV Away dWAA Home dWAA dWAA Fav dWAA Pct
ARI COL 92 103 112 83 ARI 0.565
NYA CLE 93 103 115 78 NYA 0.619
TBA MIN 92 105 107 88 TBA 0.582
PHI BAL 105 90 139 56 PHI 0.711
LAN SDN 90 110 94 103 LAN 0.619
MIL PIT NEW GUY STARTER FOR MIL
SEA ANA 100 95 121 74 SEA 0.619
TOR BOS 111 90 87 104 BOS 0.664
OAK HOU 126 83 110 91 HOU 0.619
WAS NYN 81 128 89 111 WAS 0.616

We’re not going to get into how the above was calculated until we do the Cubs tomorrow and can show it in detail for an individual game.   The expected values in bold blue show two possible betting opportunities.  Currently $120 is our EV threshold.  This may be relaxed in the future.   We only bet on simulation results — never deltaWAA.  DeltaWAA EVs are used to wave off bets.   Simulations are based upon the entire spectrum of teams with different wins/loss records.  If there are extreme differences in wins/losses it is better to play it safe and take a pass.  This also may change as we gather more data.

Highlighted are two possible betting opportunities ; Oakland and Mets.  Each has EV greater than 120 based upon Tier Combo simulations.  The brown colored numbers represent their corresponding EV based upon deltaWAA.  OAK drops to 110 and NYN drops to 111.  If you average the two both EVs fall under 120 making both a wave off discard.  This means there are no betting opportunities today.  It also means we can’t lose. :-)

Since MIL is starting a pitcher without enough innings (Wade Miley)  this season the entire game is tossed for lack of information.  A starter is one of the three important factors in the Tier Combo simulations.  Games do not get tossed when there are new guys in a lineup or relief.

That is all for now.  This is still a work in progress and the above EV table will become simpler to visualize in the future.  Tomorrow CHN starts a series with SDN so an new and expanded Ouija Board will be introduced to hopefully make more sense to the above table.  Until then ….