THE BOOK cover
The Unwritten Book is Finally Written!
An in-depth analysis of: The sacrifice bunt, batter/pitcher matchups, the intentional base on balls, optimizing a batting lineup, hot and cold streaks, clutch performance, platooning strategies, and much more.
Read Excerpts & Customer Reviews
If you are a media member and would like a review copy of The Book, please contact Kevin Cuddihy of Potomac Books.

Buy The Book from Amazon

MOST RECENT ARTICLES
MAIL : You ask | We say

Advanced


THE BOOK--Playing The Percentages In Baseball

<< Back to main

Monday, December 03, 2007

Weibull

By Tangotiger, 02:46 PM

I always thought that the Tango Distribution was something that was already invented.  It seems that it must be a form of the Weibull Distribution.  Hopefully, one of you with some time on your hands can do the comparison, and perhaps finally make me retire the poorly named Tango Distribution.


#1          (see all posts) 2007/12/03 (Mon) @ 22:09

Tango, I was playing around with your distribution earlier today.  The TD gives the right shape, as you would expect, but it cannot be adjusted based on the run environment (if I am reading the help file correctly).  For example, a team that scores 4.5 R/G ought to have a different shaped distribution depending on whether it plays in a 9 R/G, 1 R/G, or 30 R/G environment.  (I should check this using extreme run environments from the liveball/deadball eras, but I am almost certain this is correct.) The Weibull can correct for this based on the shape parameter gamma.

Here is a quick and dirty comparison between Tango (R/G = 4.5) and the three Weibull examples I gave above:

http://web.mit.edu/baxamusa/Public/tango_dist_weibull_dist.JPG

The TD works great for realistic run environments, but not so much in the extremes.  That’s not really a shortcoming of the TD, though, given that we don’t see environments that weird!  But it does make sense that if runs are very hard or easy to come by, then the shape of the curve should change.  The picture I linked to illustrates that well, IMO.

I still have to read a little bit about what the control parameter is in the TD and see if that affects things.


#2    Andy L      (see all posts) 2007/12/03 (Mon) @ 22:17

Tango, an academic paper that that covers this (if you haven’t found it by now) is at http://arxiv.org/PS_cache/math/pdf/0509/0509698v4.pdf. He derives the classic Pythagorean won-loss formula in it - it falls out of the presumption that runs are Weibull-distributed.

The Weibull is a continuous distribution and runs are distributed discretely of course. But the Weibull’s distribution function can be fit well to match up with the discrete probabilities of runs scored.

The infinitely helpful Wikipedia explains that the Weibull is an extreme value distribution, meaning that under certain conditions the distribution of a maximum of a set of random variables can follow a Weibull distribution (the maximum follows a more generalized distribution of which the Weibull is a special case). It’s a sort of limit theorem for the maximum of a set of variables, the way the central limit theorem predicts that averages will be normally distributed under certain conditions. The classic example I’ve seen is to, say, predict the probability distribution of the strength of the worst storm we’ll see in the next 100 years.

Here we’re crossing the limits of math that I’m familiar with. But I’ve always wondered whether some mechanical reason can be found for the fit to Weibulls. The paper linked above finds that the fit is good and uses it to derive the Pythagorean independently, which is very cool, but does not explain why the Weibull might fit well. In some sense you can think of runs as the “extreme” outcomes of base advancement? Or maybe there’s some other reason?


#3    tangotiger      (see all posts) 2007/12/04 (Tue) @ 08:15

Sal, you can modify the control parameter to give you a different shape.  Try setting it to .500 or 1.000, and you’ll see what I mean.

***

Also note that my program is limited to about 10 runs per game, because of a self-imposed looping constraint of 20 runs per inning.  I could let it go for much longer of course, but because of factorials, the running time will get into exponentially-longer times.

Maybe I should post the source code some point soon, this way, you can see exactly what it’s doing.


#4    Tangotiger      (see all posts) 2007/12/04 (Tue) @ 11:40

You can go to my homepage, and download the last two links.  One of them has the complete discussion.  Heck, let me just load it directly on my site here:
http://tangotiger.net/distributions/
http://tangotiger.net/distributions/tangodist1.htm
http://tangotiger.net/distributions/tangodist2.htm
http://tangotiger.net/distributions/tangodist3.htm

(Note: When you bring up each file, the links contained in the text of each file will go nowhere.  They are copies of Fanhome threads.  If you want to navigate to page 2 and 3, come back here, and click the links above.)

Here’s what I wrote 6 years ago, on page 1:

Given that a team scores .500 runs/inning, how often will they score 0,1,2 runs, etc?

Unlike hockey, baseball does not follow a poisson distribution.

Anyway, here’s how you can figure it:
RI = runs/inning = .500
a = RI*RI*.73 = .183
f0 = RI/(RI+a) = .733 = frequency of innings with 0 runs
dropRate = 1 - .73*f0 = .465 = f2/f1 = f3/f2 = f4/f3 ...

fo + f1 + f2 + ... + f20 = 1.00
solve for f1
(alot easier to do with Excel, and in this case it equals .143)

Anyway, here’s the breakdown for the .500 example:
0 73.26%
1 14.30%
2 6.65%
3 3.09%
4 1.44%
5 0.67%
6 0.31%
7 0.14%
8 0.07%
9 0.03%
10 0.01%
11 0.01%

If you multiply the numbers out, you get exactly .500. Now, I’ve tested this from .200 to 1.000, and it works perfectly. I don’t know why mathematically this works out, but maybe I’ve stumbled upon the Tango Distribution?

Patriot noted:

f1 = (1-f0)*(1-Droprate)

The dropRate (the control value in the program) is set to .73 here, but it works out better as .76 for real-life data, and .85 if you use two teams head-to-head.  So, you can fool around with the control value to get different shapes.

On page 3, Ben V-L (whose posts you should always pay attention to), gives the algorithm to convert runs per inning into runs per game.  That’s what I used.

So, it’s all there.  You guys should have fun with those.


#5    Guy      (see all posts) 2007/12/09 (Sun) @ 15:18

"But it does make sense that if runs are very hard or easy to come by, then the shape of the curve should change.”

Sal and/or Tango:  this is the aspect of employing the Weibull distribution that I don’t understand.  Why should the league run environment tell us anything about the run distribution for a team with RS=X?  It seems to be that a 3.5 R/G team should have the same distribution in a 3.0 league as in a 5.5 league (unless those leagues have very different OBP/SLG ratios).  What am I missing?


#6    tangotiger      (see all posts) 2007/12/09 (Sun) @ 19:59

I don’t think you are missing anything.  I was confused by the assetion to begin with.  The shape of the distribution would be based on the OBP/SLG/SB relationship, not on your run environment relative to the league.


#7    salb918      (see all posts) 2007/12/10 (Mon) @ 00:01

We *know* that the pythagorean exponent depends on the run environment (pythagenpat), right?  We also know that the pyth exp corresponds exactly to gamma in the distribution.  It should follow, although I am not sure WHY, that the distribution must depend on the run environment.

So that’s the basis of my assertion, although I do not what it implies about the OBP/SLG/SB relationship.  I’m not saying I must be right, but I think that logic is pretty sound.

If the shape did not depend on run environment, then we wouldn’t use different pyth exponents to describe the ‘68 NL and the ‘98 AL!  As an experimentalist (in real life), I ought to plot the run distribution of a 4.5 R/G team from both eras and see if gamma is different.

The other option is that Weibull distribution’s ability to model run distributions is purely phenomenological.  I find that hard to believe for two reasons: 1) its ability to predict the Pythagorean equation and 2) I want to believe that there is a mechanical reason (and #2 stated) for the Weibull to be an appropriate distribution.

From wikipedia: “Its importance arises from the fact that it is the limit distribution of the maxima of a sequence of independent and identically distributed random variables.”

http://en.wikipedia.org/wiki/Generalized_extreme_value_distribution

Wouldn’t it be nice, if, say, run scoring was the maxima of a sequence of independent and identically distributed random variables such as base advancement?


#8    David Gassko      (see all posts) 2007/12/10 (Mon) @ 00:31

I think there’s some confusion here on Sal and Guy/Tom’s part. You guys actually seem to be agreeing. When Sal says run environment, what I think he really means (and certainly hope) is a pitcher/team’s specific run environment. So Johan Santana’s run environment might be very similar to the 1968 environment, even if the overall run environment in 2008 is not.


#9    tangotiger      (see all posts) 2007/12/10 (Mon) @ 00:58

What Guy and I are saying that one you know the expected mean for the pitcher or team for a game, you don’t care anymore about the opponent or league.

That is, if Santana’s expected mean is a 2.8 RPG on Jul 23 against the Brewers, it doesn’t matter what the Brewers, NL or AL means are after that 2.8 mean has been established.  He’s got a 2.8 RPG mean, and the distribution will be the same as if you have some crappy pitcher in the Astrodome against a poor hitting team, also with a mean of 2.8 RPG.

The shape around that mean would depend highly on whether the expectation is for lots of HR, walks, or SB.

Are we disagreeing on anything?


#10    Guy      (see all posts) 2007/12/10 (Mon) @ 01:24

I always assumed that the pythag exponent works (as opposed to a constant exponent) because the win probability is partially a function of the run differential, not just the RS:RA ratio.  That is, a 6:4 team wins more often than a 3:2 team because it outscores opponents by 2 runs rather than 1.  In any case, I don’t see that the RPG relationship to the pythag exponent necessarily means it’s tied to run distribution. 

Logically, how can the scoring by the opposing team tell us anything about the distribution that follows from a given mean?  I don’t think there can be a direct relationship.  Indirectly, I guess it could be that the shape of the distribution changes as the mean rises, and RPG roughly captures that.  But really it would remain a function only of RS.

As it happens, I’ve always disliked the use of run “environment” to describe RPG in the pythag context.  Environment suggests something one operates within, and can’t control.  To say Bob Gibson’s 1968 run “environment” was 5.0 RPG is confusing if not misleading.  Personally, I think environment should be used only to describe the league average.


#11    tangotiger      (see all posts) 2007/12/10 (Mon) @ 08:50

Environment is where you find yourself, your universe, even if you are God, as it would be the case for Pedro.

Pedro’s environment would be a 2.50 RPG defense (his performance, the league average offense, plus whoever his fielders are) and a 5.00 RPG offense (his hitters, plus whatever the league average pitching and fielding is).

The shape of Pedro’s 2.50 RPG in this particular environment should be no different than some other pitcher’s 2.50 RPG defense in a 2.00 RPG offense.

The dependence of the shape, after the mean has been determined, can only be based on the frequency of walks, HR, SB, etc.


#12    Guy      (see all posts) 2007/12/10 (Mon) @ 09:35

Sal:  I think what RPG tells us for pythag is the average margin of victory.  For any given RS:RA ratio, the run differential is proportional to RPG. 

Tango:  This is totally subjective, of course.  But to me, saying Pedro pitched in a 7.5 R/G “environment” is more confusing than enlightening.


#13    Tangotiger      (see all posts) 2007/12/10 (Mon) @ 10:09

I would definitely not say “7.5”.  I would say “5 offense and 2.5 defense”.  That’s his environment.


#14    salb918      (see all posts) 2007/12/10 (Mon) @ 10:30

12: That sounds reasonable.  I still can’t wrap my head around what I said in 7, though - if Weibull <--> Pythag, and gamma is different for different leagues, then the shape of the distribution will change based on the league.  Would you recommend using a single gamma (pyth exp) for all teams in all leagues across all years?  Of course not.

I do think that I may be doing it wrong by using a separate gamma for each team.  Maybe it is better to have a gamma for each league?


#15    Guy      (see all posts) 2007/12/10 (Mon) @ 11:11

Sal:  I confess the math here is over my head.  But is it possible that gamma is really just an exponential function of the mean (which will be roughly proportional to RPG in most real-world settings)? 

In any case, I think it would be interesting to look at the actual RS distribution for, say, 4.2 RPG teams across various league environments, so see if the curves look any different.


#16    Tangotiger      (see all posts) 2007/12/10 (Mon) @ 11:28

You can actually do it yourself.  The expanded version of my Markov model (by Bill Skelton) includes the runs per game chart:
http://tangotiger.net/markov_wes.html

So, you can get a fantastic set of charts of all kinds of run environments, using a logically perfect baseball model (with the only provision is that it doesn’t include outs on base).


#17    Tangotiger      (see all posts) 2007/12/10 (Mon) @ 17:58

Sal, unless I’m missing something, the frequency for x=0 runs is zero, regardless of whatever k or lambda you chose.  The Weibull is a product of three terms, the second of which is “x” divided by something.  So, at x=0, the function will return 0.

How did you get around this?


#18    salb918      (see all posts) 2007/12/16 (Sun) @ 22:59

I’ve been a little out of the loop, sorry.

Tango, Miller uses a three-parameter Weibull.  In addition to k and lambda he uses a translation parameter beta: replace all instances of “x” with “x-beta”

By setting beta = 0.5, you translate the distribution appropriately.  What this really is doing is setting the edges of each bin for the run distribution histogram - in other words, it is a trick that allows you to discretize the continuous Weibull equation.


#19    Guy      (see all posts) 2007/12/20 (Thu) @ 19:04

Sal has more good stuff here:
http://www.hardballtimes.com/main/article/consistency-is-key-part-two/.

However, I disagree when he writes “The argument basically boils down to whether the run environment is best described at a team level or at a league level.” What I am arguing—and Tango as well, I believe—is that BOTH of these are wrong.  The scoring by the opposing team cannot possibly tell us much about what the RS distribution should look like; RS cannot possibly determine the RA distribution (with the caveat that it may have some tiny amount of information about the team’s OBP:SLG ratio).  That is probably one reason that using team-level R/G gives you such screwy results.

There should be just one distribution for every unique RS, regardless of environment.  And gamma should be either a constant or a function of RS; RA shouldn’t matter.  To the extent the pythag exponent appears to give you a decent fit, it’s likely to be a proxy for something else.


#20    Tangotiger      (see all posts) 2008/01/07 (Mon) @ 10:39

Excel Tutorial for Weibull:

http://www.qualitydigest.com/jan99/html/weibull.html

(Hat tip: SABRmatt)


Page 1 of 1 pages


Name (required)
E-Mail (optional)
Website (optional)

<< Back to main


Latest...

COMMENTS

Nov 21 17:29
Sabermetric Moves of the 2009 Pre-Season

Nov 22 06:40
The New Triple Crown

Nov 22 06:24
Chance of Scoring by Base/Out, Retrosheet Years

Nov 22 02:48
How good are the Fans in evaluating fielding?

Nov 21 20:13
Runs Produced

Nov 21 19:27
Marcel 2009 is here

Nov 21 16:43
Nate Silver: hero to interviewers

Nov 21 10:57
New BBTN

Nov 20 20:34
ABSO-lutely… not!

Nov 20 19:23
R.I.P. Tom Boswell, sabermetrician; P.A.L.L.(*) Tom Boswell, human being