getModelRunExpectancy: getModelRunExpectancy

Description Usage Arguments Details Value Examples

Description

Build the Run Expectancy Model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
getModelRunExpectancy(data, mod.re = NULL, verbose = TRUE,
  drop.incomplete = TRUE, ...)

## Default S3 method:
getModelRunExpectancy(data, mod.re = NULL, verbose = TRUE,
  drop.incomplete = TRUE, ...)

## S3 method for class 'GameDayPlays'
getModelRunExpectancy(data, mod.re = NULL,
  verbose = TRUE, drop.incomplete = TRUE, ...)

Arguments

data

a GameDayPlays dataset

mod.re

an existing Run Expectancy Model

verbose

print messages to screen during operation?

drop.incomplete

a LOGICAL indicating whether incomplete innings (e.g. walk-off innings) should be excluded

...

currently ignored

Details

This function will build the Run Expectancy Model used in openWAR.

Value

An lm object

Examples

1
2
3
4
5
6
data(May)
re.mod <- getModelRunExpectancy(May)

# Display the Run Expectancy Matrix
states = expand.grid(startCode = 0:7, startOuts = 0:2)
matrix(predict(re.mod, newdata=states), ncol=3)

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