makeWAR: makeWAR

Description Usage Arguments Details Value Examples

View source: R/makeWAR.R

Description

Computes runs above average (RAA) for each player involved in each play of the 'GameDayPlays' object.

Usage

1
makeWAR(data, models = list(), verbose = TRUE, ...)

Arguments

data

An object of class 'GameDayPlays'

models

A named list of models, each with a predict() method. See Details.

verbose

A LOGICAL indicating whether you want various messages and information to be displayed during the computation

Details

Within a 'GameDayPlays' object, each row consists of a single plate appearance and contains information about the batter, all of the baserunners, the pitcher, and all of the fielders on the field during the plate appearance. The total value of the play as determined by the change in the run expectancy matrix from the beginning of the plate appearence to the end of the plate appearance is partitioned across all players involved in with the play on offense, and that same value (with the opposite sign) is partitioned across the pitcher and all of the fielders. Thus for every single plate appearance a runs above average (RAA) value is assigned to every player involved in the play. If no models argument is supplied, then all models necessary for the computation of openWAR will be generated on the data set given. The output of this function is then used in the function getWAR to calculate a Wins Above Replacement (WAR) value for each player.

If verbose == TRUE, then various pieces of information will be displayed during the comuptation.

Elements of models:

Value

An object of class 'openWARPlays' which is a list of length 4 containing the following:

Examples

1
2
# ds = getData(start = '2013-03-31', end = '2013-09-30')
res = makeWAR(ds)

frogman141/openWAR documentation built on Dec. 20, 2021, 8:52 a.m.