wRAA: Batting: Calculate Weighted Runs Above Average (wRAA)

Description Usage Arguments See Also Examples

Description

Find the wRAA for all players with one or more hits for a particular season. Required fields from the batting table are "AB", "H", "BB", "X2B", "X3B", "HR", "HBP", "SF", "IBB."

Usage

1
2
wRAA(BattingTable = NULL, PitchingTable = NULL, FieldingTable = NULL,
  Fangraphs = FALSE, NA_to_zero = TRUE, Sep.Leagues = FALSE)

Arguments

BattingTable

A full batting table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

PitchingTable

A full pitching table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

FieldingTable

A full batting table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

Fangraphs

If TRUE the function will download wOBA values from Fangraphs. Both wOBA scale and league wOBA are used in the wRAA calculation. If FALSE the function will use the internal wOBA algorithm, which is adapted from Tom Tango's original wOBA formula. This algorithm produces a slightly different wOBA scale than the Fangraphs wOBA scale, so variations in wRAA should be expected. The default internal method does not require an external download from Fangraphs. If not specified, the default is set to FALSE.

NA_to_zero

If TRUE this will replace NAs with 0 for years that certain stats were not counted. For example, sacrifice hits were not a counted statistic until 1954, therefore we are technically unable to calculate wRAA for any player prior to 1954. The default is set to TRUE. Even though this is bad practice mathematically, many in the sabermetrics community accept the practice. If FALSE, the wRAA calculation will return NaN for years with missing data.

Sep.Leagues

If TRUE the algorithm will calculate different run environments for the National and American leagues. Grouping the leagues can solve problems introduced by the designated hitter and hitting pitchers. It also serves to further isolate for park factors between the American and National leagues. The default for this argument is FALSE.

See Also

Other Batting functions: BABIP, BA, BBpct, CTpct, HRpct, ISO, Kpct, OBP, OPS, PA, RC2002, RCbasic, RCtech, SLG, TBs, XBHpct, XBperH, wOBA, wRC

Examples

1
2
3
4
5
6
7
8
9
data("Batting2016")
head(Batting2016)
data("Pitching2016")
head(Pitching2016)
data("Fielding2016")
head(Fielding2016)

Batting2016$wRAA <- wRAA(Batting2016, Pitching2016, Fielding2016, Fangraphs=FALSE,
                          NA_to_zero=TRUE, Sep.Leagues=FALSE)

baseballDBR documentation built on May 2, 2019, 5:56 a.m.