Type Package Package mlbstats Marc 16, 2018 Title Major League Baseball Player Statistics Calculator Version 0.1.0 Autor Pilip D. Waggoner <pilip.waggoner@gmail.com> Maintainer Pilip D. Waggoner <pilip.waggoner@gmail.com> Computational functions for player metrics in major league baseball including batting, pitcing, fielding, base-running, and overall player statistics. Tis package is actively maintained wit new metrics being added as tey are developed. License MIT + file LICENSE Encoding UTF-8 LazyData true RoxygenNote 6.0.1 NeedsCompilation no Repository CRAN Date/Publication 2018-03-16 09:15:57 UTC R topics documented: ab_r............................................ 2 aera............................................. 3 ba.............................................. 4 baa.............................................. 4 babip............................................ 5 9............................................. 6 _k............................................. 6 BsR............................................. 7 dice............................................. 7 EqA............................................. 8 era.............................................. 9 erc.............................................. 9 fip.............................................. 10 fp.............................................. 11 1
2 ab_r go_ao............................................ 11 gpa.............................................. 12 9.............................................. 13 iso.............................................. 13 k9.............................................. 14 k_............................................. 14 obp............................................. 15 ops.............................................. 16 pafa............................................. 16 pa_so............................................ 17 pfr.............................................. 18 ra.............................................. 18 rc.............................................. 19 rc2.............................................. 19 rc3.............................................. 20 rfa.............................................. 21 risp............................................. 21 rp.............................................. 22 sba.............................................. 22 sbsr............................................. 23 slg.............................................. 23 ta.............................................. 24 tc.............................................. 25 tob.............................................. 25 vorp............................................. 26 wip............................................. 26 wr.............................................. 27 wra............................................. 27 xb............................................. 28 Index 29 ab_r Calculates at bats per ome run Takes number of at bats and divides by number of ome runs ab_r(ab, r) ab r Number of at bats Number of ome runs
aera 3 ab_r ab_r(400, 25) aera Calculates adjusted earned run average (ERA+) Computes adjusted earned run average accounting for park factor and league era (compare wit "era" wic is te traditional formula for earned run average, "erc" wic is te component earned run average, or "dice" wic is te defense-independent component earned run average) aera(er, ip, lera, ome_rs, ome_ra, ome_r, road_rs, road_ra, road_r) er ip lera ome_rs ome_ra ome_r road_rs road_ra road_r Number of runs tat did not occur as a result of errors or passed balls Number of innings pitced Average league ERA Number of pitcer s team runs scored at ome park Number of pitcer s team runs allowed at ome park Total number of runs scored at ome park Number of pitcer s team runs scored at away park Number of pitcer s team runs allowed at away park Total number of runs scored at away park aera aera(10, 5.5, 2.5, 8, 7, 15, 6, 4, 10) # for a pair of games (one away, one ome)
4 baa ba Calculates batting average Takes number of its and divides by at bats. 1.000 (read one-tousand" is perfect) ba(, ab) ab Number of its Number of at bats ba ba(200, 525) baa Calculates batting average against Computes pitcer s ability to prevent its, based on, bfp,, bp, sf, s, and ci (catcer s interference) baa(, bfp,, bp, s, sf, ci) bfp bp s sf ci Number of its allowed Number of batters facing pitcer Number of it batters Number of sacrifice its Number of sacrifice flies Number of catcer s interference
babip 5 baa baa(105, 250, 50, 15, 10, 5, 1) babip Calculates batting average on balls in play Generates te frequency a batter reaces a base after putting te ball in play (normal around.300) babip(, r, ab, k, sf) r ab k sf Number of its Number of ome runs Number of at bats Number of strikeouts Number of sacrifice flies babip babip(200, 25, 525, 55, 6)
6 _k 9 Calculates bases on balls per nine innings pitced (W/9) Computes bases on balls (walks) per nine innings pitced 9(, ip) ip Number of innings pitced 9 9(35, 210) _k Calculates walk to strikeout ratio (batting) Takes te number of bases on balls and divides by number of strikeouts (for pitcing version, see "k_") _k(, k) k Number of strikeouts _k _k(65, 125)
BsR 7 BsR Calculates te base runs estimator Takes te number of its, bases on balls, ome runs, total bases, and at bats to compute te base runs estimator, wic is similar to runs created BsR(,, r, tb, ab) r tb ab Number of its Number of ome runs Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of at bats BsR BsR(135, 22, 12, 155, 330) dice Calculates defense-independent component earned run average Computes earned run average from its and walks (compare wit "era" wic is te traditional formula for earned run average, "aera" wic is a pitcer s adjusted earned run average, or "erc" wic is te component earned run average) dice(, bp, r, k, ip)
8 EqA bp r k ip Number of it batters Number of ome runs Number of strikeouts Number of innings pitced dice dice(45, 10, 60, 130, 400) EqA Calculates equivalent average Takes te number of its, total bases, bases on balls, its by pitc, stolen bases, sacrifice its, sacrifice flies, at bats, and caugt stealing to compute te base runs, wic is a player s batting average absent park and league effects EqA(, tb,, bp, sb, s, sf, ab, cs) tb bp sb s sf ab cs Number of its Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of its by pitc Number of stolen bases Number of sacrifice its (typically bunts) Number of sacrifice flies Number of at bats Number of caugt stealing EqA EqA(135, 155, 22, 3, 15, 4, 2, 365, 1)
era 9 era Calculates earned run average Computes a pitcer s earned run average (compare wit "erc" wic is te component earned run average, "aera" wic is a pitcer s adjusted earned run average, or "dice" wic is te defenseindependent component earned run average) era(er, ip) er ip Number of runs tat did not occur as a result of errors or passed balls Number of innings pitced era era(150, 400) erc Calculates component earned run average Computes earned run average from its and walks (compare wit "era" wic is te traditional formula for earned run average, "aera" wic is a pitcer s adjusted earned run average, or "dice" wic is te defense-independent component earned run average) erc(,, bp, r, i, bfp, ip)
10 fip bp r i bfp ip Number of its allowed Number of it batters Number of ome runs Number of intentional bases on balls Number of batters faced by pitcer Number of innings pitced erc erc(110, 45, 10, 70, 5, 400, 215) fip Calculates fielding independent pitcing Computes pitcing performance statistic similar to ERA, but based on factors witin te pitcer s control (compare wit "dice" wic is te defense-independent component earned run average) fip(r,, k, ip) r k ip Number of ome runs Number of strikeouts Number of innings pitced fip fip(65, 50, 100, 175)
fp 11 fp Calculates fielding percentage Computes te fielding percentage (aka, fielding average), wic reflects te percentage of proper ball andling fp(p, a, e) p a e Number of putouts Number of assists Number of errors fp fp(13, 4, 2) go_ao Calculates ground outs-fly outs ratio (GO/AO) Takes te number of ground ball outs and divides by number of fly ball outs to compute te GO/AO ratio go_ao(go, ao) go ao Number of ground ball outs Number of fly ball outs go_ao
12 gpa go_ao(150, 88) gpa Calculates gross production average Computes te gross production average, wic is 1.8 times on-base percentage (OBP) plus slugging percentage (SLG), divided by four gpa(,, bp, ab, sf, b1, b2, b3, r) bp ab sf b1 b2 b3 r Number of its Number of its by pitc Number of at bats Number of sacrifice flies Number of singles Number of doubles Number of triples Number of ome runs gpa gpa(150, 40, 2, 400, 5, 100, 40, 3, 7)
9 13 9 Calculates its per nine innings pitced (H/9IP) Computes its per nine innings pitced 9(, ip) ip Number of its allowed Number of innings pitced 9 9(150, 175) iso Calculates isolated power Computes isolated power, wic is a player s ability to obtain extra bases from a it. Te statistic subtracts a itter s batting average from te slugging percentage, wit te maximum ISO being 3.000. iso(b1, b2, b3, r, ab, ) b1 b2 b3 r ab Number of singles Number of doubles Number of triples Number of ome runs Number of at bats Number of its
14 k_ iso iso(100, 40, 3, 7, 350, 150) k9 Calculates strikeouts per nine innings pitced (K/9) Computes strikeouts per nine innings pitced k9(k, ip) k ip Number of strikeouts Number of innings pitced k9 k9(105, 175) k_ Calculates strikeout to walk ratio (pitcing) Computes strikeouts to walk ratio, based on number of strikeouts and number of walks (for batting version, see "_k") k_(k, )
obp 15 k Number of strikeouts k_ k_(105, 40) obp Calculates on-base percentage Computes te on-base percentage based on number of its, bases on balls, its by pitc, at bats, and sacrifice flies obp(,, bp, ab, sf) bp ab sf Number of its Number of its by pitc Number of at bats Number of sacrifice flies obp obp(150, 40, 2, 400, 5)
16 pafa ops Calculates on-base plus slugging Computes te on-base percentage plus slugging average (OPS) based on number of its, bases on balls, its by pitc, at bats, sacrifice flies, and total weigted bases (represented individually, as in SLG and GPA calculations) ops(,, bp, ab, sf, b1, b2, b3, r) bp ab sf b1 b2 b3 r Number of its Number of its by pitc Number of at bats Number of sacrifice flies Number of singles Number of doubles Number of triples Number of ome runs ops ops(200, 18, 4, 401, 4, 50, 20, 3, 13) pafa Calculates park factor Computes te runs a team scores at ome versus away (it is often used in oter metrics, e.g., adjusted era (ERA+) for pitcers; see "aera") pafa(ome_rs, ome_ra, ome_r, road_rs, road_ra, road_r)
pa_so 17 ome_rs ome_ra ome_r road_rs road_ra road_r Number of pitcer s team runs scored at ome park Number of pitcer s team runs allowed at ome park Total number of runs scored at ome park Number of pitcer s team runs scored at away park Number of pitcer s team runs allowed at away park Total number of runs scored at away park pafa pafa(5, 6, 11, 4, 8, 12) # for a pair of games (one ome, one away) pa_so Calculates plate appearances per strikeout (PA/SO) Computes te number of times a itter strikes out in relation to teir plate appearances pa_so(pa, so) pa so Number of plate appearances Number of strikeouts pa_so pa_so(450, 120)
18 ra pfr Calculates power finesse ratio Computes pitcer s performance eiter by game or overall, based on k,, and ip pfr(k,, ip) k ip Number of strikeouts Number of innings pitced pfr pfr(115, 30, 400) ra Calculates run average Computes pitcer s run average based on number of runs allowed and innings pitced ra(r, ip) r ip Number of runs allowed Number of innings pitced ra ra(75, 400)
rc 19 rc Calculates runs created Computes te basic version of te estimated runs a itter creates or contributes (see also "rc2" for te stolen base iteration and "rc3" for te tecnical iteration of te rc statistic) rc(,, tb, ab) tb ab Number of its Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of at bats rc rc(150, 35, 165, 400) rc2 Calculates runs created accounting for stolen bases Computes te estimated runs a itter creates or contributes, accounting for base stealing (see also "rc" for te basic iteration and "rc3" for te tecnical iteration of te rc statistic) rc2(,, tb, ab, cs, sb) tb ab cs sb Number of its Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of at bats Number of stolen bases caugt Number of stolen bases
20 rc3 rc2 rc2(150, 35, 165, 400, 7, 9) rc3 Calculates runs created accounting for all offensive indicators Computes te tecnical iteration of estimated runs a itter creates or contributes accounting for virtually all offensive indicators (see also "rc" for te basic iteration and "rc2" for te stolen base iteration of te rc statistic) rc3(,, i, tb, ab, cs, sb, bp, gidp, s, sf) i tb ab cs sb bp gidp s sf Number of its Number of intentional bases on balls Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of at bats Number of stolen bases caugt Number of stolen bases Number of its by pitc Number of grounded into double play Number of sacrifice its Number of sacrifice flies rc3 rc3(150, 35, 3, 165, 400, 7, 9, 5, 1, 6, 2)
rfa 21 rfa Calculates range factor Computes te amount of te field covered by a player rfa(p, a, ip) p a ip Number of putouts Number of assists Number of innings played in a defensive position rfa rfa(20, 5, 450) risp Calculates batting average wit runners in scoring position Computes batting average accounting for runners in scoring position risp(risp, abrisp) risp abrisp Number of its wit runners in scoring position (on eiter 2nd or 3rd base) Number of at bats wit runners in scoring position (on eiter 2nd or 3rd base) risp risp(35, 120)
22 sba rp Calculates runs produced Computes te number of runs contributed by a itter, based on runs, runs batted in, and ome runs rp(r, rbi, r) r rbi r Number of runs Number of runs batted in Number of ome runs rp rp(70, 41, 22) sba Calculates stolen base attempts Computes total attempts to steal a base, by adding sb and cs sba(sb, cs) sb cs Number of stolen bases Number of caugt stealing sba sba(20, 4)
sbsr 23 sbsr Calculates stolen base success rate Computes percentage of bases successfully stolen sbsr(sb, cs) sb cs Number of stolen bases Number of caugt stealing sbsr sbsr(20, 4) slg Calculates slugging percentage Computes te slugging percentage (SLG), based on te weigted number of singles, doubles, triples, ome runs, and at bats slg(b1, b2, b3, r, ab) b1 b2 b3 r ab Number of singles Number of doubles Number of triples Number of ome runs Number of at bats
24 ta slg slg(100, 40, 3, 7, 350) ta Calculates total average Computes overall offensive contribution of a single player ta(tb, bp,, sb, ab,, cs, gidp) tb bp sb ab cs gidp Number of total bases (one for 1B, two for 2B, tree for 3B, and four for HR) Number of its by pitc Number of stolen bases Number of at bats Number of its Number of caugt stealing Number of grounded into double play ta ta(125, 11, 40, 10, 400, 105, 2, 6)
tc 25 tc Calculates total cances Computes te opportunities for defensive ball andling tc(p, a, e) p a e Number of putouts Number of assists Number of errors tc tc(11, 5, 5) tob Calculates times on base Computes total times a player reaces a base by adding, bp, and tob(, bp, ) bp Number of its Number of its by pitc tob
26 wip tob(234, 6, 24) vorp Calculates value over replacement player (pitcing) Computes a pitcer s marginal utility vorp(ip, lr, lg, r) ip lr lg r Number of innings pitced Number of league runs Number of league games played Number of runs vorp vorp(400, 98, 20, 110) wip Calculates walks plus its per innings pitced (WHIP) Computes walks plus its per innings pitced, wic reflects te number of baserunners allowed by a pitcer over a given period wip(,, ip) ip Number of its allowed Number of innings pitced
wr 27 wip wip(50, 110, 425) wr Calculates wiff rate Computes pitcer s ability to get a batter to swing and miss pitces over any period of time (e.g., in a single game, single season, career, etc.) wr(sw, tp) sw tp Number of swings and misses Total pitces trown wr wr(300, 750) wra Calculates win ratio Computes a team s win ratio, wic is used in te so-called "Pytagorean expectation" wra(rs, ra) rs ra Number of runs scored Number of runs allowed
28 xb wra wra(400, 301) xb Calculates extra base its Computes total its by a player greater tan singles (1B) by adding 2B, 3B, and r xb(b2, b3, r) b2 b3 r Number of doubles Number of triples Number of ome runs xb xb(20, 18, 4)
Index ab_r, 2 aera, 3 ba, 4 baa, 4 babip, 5 9, 6 _k, 6 BsR, 7 dice, 7 EqA, 8 era, 9 erc, 9 fip, 10 fp, 11 rp, 22 sba, 22 sbsr, 23 slg, 23 ta, 24 tc, 25 tob, 25 vorp, 26 wip, 26 wr, 27 wra, 27 xb, 28 go_ao, 11 gpa, 12 9, 13 iso, 13 k9, 14 k_, 14 obp, 15 ops, 16 pa_so, 17 pafa, 16 pfr, 18 ra, 18 rc, 19 rc2, 19 rc3, 20 rfa, 21 risp, 21 29