exWPct: exWPct

Description Usage Arguments Details Value Examples

Description

Model for a team's winning percentage

Usage

1
exWPct(rs, ra, exponent = 2)

Arguments

rs

A numeric representing Runs Scored

ra

A numeric representing Runs Allowed

exponent

A numeric representing the desired exponent

Details

An implementation of Bill James's Pythagorean formula for a team's expected winning percentage as a function of their runs scored and runs allowed.

Value

A value of expected winning percentage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# For a .500 team
exWPct(750, 750)
# Find the partial derivatives
library(mosaic)
slope.rs = D(exWPct(rs, ra, exponent = 1.83) ~ rs)
slope.ra = D(exWPct(rs, ra, exponent = 1.83) ~ ra)
# How many wins is one run in a 700 run environment?
runsPerWin = makeFun(1 / (162 * slope.rs(r, r)) ~ r)
runsPerWin(700)
# In what run environment is 10 runs equal to 1 win?
runsPerWin(742)
# Plot Runs per Win
plotFun(runsPerWin(r) ~ r, r.lim = c(300, 1200)
, xlab = 'Runs Environment per 162 games'
, ylab = 'Runs per Win')

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