Skip to content

runexp

Softball Run Expectancy using Markov Chains and Simulation

v0.2.1 · Mar 21, 2021 · LGPL

Description

Implements two methods of estimating runs scored in a softball scenario: (1) theoretical expectation using discrete Markov chains and (2) empirical distribution using multinomial random simulation. Scores are based on player-specific input probabilities (out, single, double, triple, walk, and homerun). Optional inputs include probability of attempting a steal, probability of succeeding in an attempted steal, and an indicator of whether a player is "fast" (e.g. the player could stretch home). These probabilities may be calculated from common player statistics that are publicly available on team's webpages. Scores are evaluated based on a nine-player lineup and may be used to compare lineups, evaluate base scenarios, and compare the offensive potential of individual players. Manuscript forthcoming. See Bukiet & Harold (1997) <doi:10.1287/opre.45.1.14> for implementation of discrete Markov chains.

Downloads

CRAN

276

Last 30 days

17417th

696

Last 90 days

2.7K

Last year

Trend: +37.3% (30d vs prior 30d)

r2u CRAN

0

Last 30 days

24

Last 90 days

83

Last year

Trend: -100% (30d vs prior 30d)

autoCRAN

3

Last 7 days

9

Last 30 days

1

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

13 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 13 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Jul 4, 2026
ERROR 12 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Jul 1, 2026
ERROR r-devel-linux-x86_64-debian-clang

examples

Running examples in ‘runexp-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: scrape
> ### Title: Softball Webscraper
> ### Aliases: scrape
> 
> ### ** Examples
> 
> url <-"https://wmubroncos.com/sports/softball/stats/2019"
> test <- scrape(url)
Error in open.connection(x, "rb") : cannot open the connection
Calls: scrape -> <Anonymous> -> read_html.default
Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 14, 2026
ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 13, 2026
ERROR r-devel-linux-x86_64-debian-gcc

examples

Running examples in ‘runexp-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: scrape
> ### Title: Softball Webscraper
> ### Aliases: scrape
> 
> ### ** Examples
> 
> url <-"https://wmubroncos.com/sports/softball/stats/2019"
> test <- scrape(url)
Error in open.connection(x, "rb") : cannot open the connection
Calls: scrape -> <Anonymous> -> read_html.default
Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Code

Structure

Lines of code

2,760

Files

23

Compiled share

0%

Has compiled src

No

Language breakdown

R 2,189 (79.3%)Docs 571 (20.7%)

API

Exported functions

4

Internal functions

10

Recent export changes

v0.2.0+1 scrape
v0.1.0+3 chain, prob_calc, sim

Testing & CI

Has tests

No

Test-to-code ratio

0.00

testthat edition

CI present

No

CI type

[]

PR gated

No

Docs

Return-value doc rate

100%

\dontrun example ratio

0%

Roxygen coverage

100%

Has pkgdown

No

NEWS present

No

Health & Security signals

Informational signals; not verdicts.

on.exit coverage

100%

Unsafe pattern score

0

Dep constraint coverage

0%

Secret pattern count

0

Bundled 3rd-party code

2 items

Portability & License

Min R version

3.6

System requirements

C++ standard

License

LGPL

License flags

not SPDX, not OSI

History

Versions

3

First release

2021-02-15

Latest release

2021-03-22

Avg cadence

18 days

Cold removal rate

Dep drift

1

LOC over versions

v0.1.0: 2,648 LOCv0.2.0: 2,761 LOCv0.2.1: 2,760 LOC

Per-file churn detail lives in the source pipeline: https://github.com/r-observatory/cran-code-metrics.

Dependency Network

Dependencies Reverse dependencies doParallel foreach runexp

Version History

4 tracked
new 0.2.1 Mar 10, 2026
updated 0.2.1 ← 0.2.0 diff Mar 21, 2021
updated 0.2.0 ← 0.1.0 diff Feb 28, 2021
new 0.1.0 Feb 14, 2021