# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

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

Contributed by:
Bob Sandheinrich

ResourceFunction["BaseballWOBA"][ computes a batter's weighted on-base average (wOBA) for the counting statistics | |

ResourceFunction["BaseballWOBA"][" computes wOBA for the specified player. | |

ResourceFunction["BaseballWOBA"][ computes a batter's weighted on-base average (wOBA) for the counting statistics |

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.

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

In[1]:= |

Out[1]= |

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]= |

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]= |

Plot Babe Ruth's yearly wOBA:

In[8]:= |

Out[8]= |

- 1.1.0 – 18 July 2022
- 1.0.0 – 13 July 2022

This work is licensed under a Creative Commons Attribution 4.0 International License