Function Repository Resource:

# BaseballWOBA

Calculate a batter's weighted on-base average (wOBA)

Contributed by: Bob Sandheinrich
 ResourceFunction["BaseballWOBA"][stats] computes a batter's weighted on-base average (wOBA) for the counting statistics stats. ResourceFunction["BaseballWOBA"]["player"] computes wOBA for the specified player. ResourceFunction["BaseballWOBA"][stats,y] computes a batter's weighted on-base average (wOBA) for the counting statistics stats based on the year y.

## Details and Options

The "player" identifier can be given as a Baseball-Reference id or a plain name. Both are resolved to statistics using the Bob/BaseballReferenceData paclet. Plain names are resolved using the first search result from Baseball-Reference.
Weighted On-Base Average uses linear weights to combine the positive outcomes a batter can create and divides by the number of opportunities to create a rate statistic. A description of FanGraphs wOBA is available here.
The weights are recalculated by FanGraphs each year. By default, 2021 weights are used. The option Weights can be used to specify a year or directly specify weights.
Fangraphs weights are available here.
ResourceFunction["BaseballWOBA"] takes the option Weights. Supported values include a year given as an integer or an association of weights for each statistic.

## Examples

### Basic Examples (1)

Compute Tyler O'Neill's 2021 wOBA using his counting stats:

 In[1]:=
 Out[1]=

### Scope (3)

Get Paul Goldschmidt's 2021 wOBA:

 In[2]:=
 Out[2]=

Get Nolan Arenado's 2021 wOBA using his Baseball-Reference player id:

 In[3]:=
 Out[3]=

Calculate Albert Pujols' wOBA in 2005:

 In[4]:=
 Out[4]=

### Options (3)

Use custom weights. Statistics without weights are treated like zero:

 In[5]:=
 Out[5]=

Use FanGraphs weights from a specific year:

 In[6]:=
 Out[6]=

See what wOBA Mike Trout's 2018 season statistics would have generated in other seasons:

 In[7]:=
 Out[7]=

### Applications (1)

Plot Babe Ruth's yearly wOBA:

 In[8]:=
 Out[8]=

Bob

## Version History

• 1.1.0 – 18 July 2022
• 1.0.0 – 13 July 2022

## Author Notes

Exact matches in names currently are not working because the Bob/BaseballReferenceData paclet does not handle the special case response from the Baseball-Reference search page.