getRunEx: Computes run expectancy.

Description Usage Arguments Details Value Note Examples

Description

Find the Run Expectancy for a given state.

Usage

1
getRunEx(data, drop.incomplete = TRUE, ...)

Arguments

data

an MLBAM dataset

drop.incomplete

a LOGICAL indicating whether incomplete innings (e.g. walk-off innings) should be excluded from the run expectancy model. Default is TRUE.

...

currently ignored

Details

Given a data set, returns a function giving the run expectancy for any base/out state

Value

A function that takes two arguments: baseCode and outs, and returns a run value

Note

baseCode takes on integer values between 0 and 7 with each value correpsonding to a unique base state (e.g. runner on second, runners on first and third, bases loaded). The baseCode is the binary representation of the base state with first, second, and third base represented by 1, 2, and 4, respectively. For example, runners on second and third corresponds to a baseCode of 6 (i.e. 2 + 4 = 6).

Examples

1
2
3
4
5
6
#Data from May 2013
data(May)
fit.rem = getRunEx(May)

fit.rem(0,0)
fit.rem(4,1)

beanumber/openWAR documentation built on May 12, 2019, 9:43 a.m.