Learn R Programming

openWAR (version 0.2.2.9001)

getModelRunExpectancy: getModelRunExpectancy

Description

Build the Run Expectancy Model

Usage

getModelRunExpectancy(data, mod.re = NULL, verbose = TRUE,
  drop.incomplete = TRUE, ...)

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

# S3 method for 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

Value

An lm object

Details

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

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab