In each simulation, we determine each batter's hit results
through a multinomial random trial where the probability of walk (W), single (S),
double (D), triple (TR), home run (HR), and batter out (O) are assigned per input player
statistics. We incorporate the impact of "fast" players through the following assumptions:
If a fast player is on first and the batter hits a single, the fast
player will stretch to third base (leaving the batter on first).
If a fast player is on second and the batter hits a single, the fast
player will stretch home (leaving the batter on first and a single run scored).
If a fast player is on first and the batter hits a double, the fast
player will stretch home (leaving the batter on second base and a single run scored).
A typical player (not fast) who successfully steals a base will become
a fast player for the remainder of that inning (meaning that a player
who successfully steals second base will stretch home on a single).
Aside from these fast player assumptions, runners advance bases as expected (a single
advances each runner one base, a double advances each runner two bases, etc.).
Following softball norms, we only entertain steals of second base. Steals are considered
in cases when there is a runner on first and no runner on second. In these situations,
we use a bernoulli coin flip (based on the runner's SBA probability) to determine whether the
runner on first will attempt a steal. In practice, these decisions are commonly left up to coaches.
If it is decided that the player will attempt a steal, a second bernoulli coin flip (based
on the runner's SB probability) determines whether the steal was successful or whether the player was
caught stealing.
The stats input must be a data frame containing player probabilities. It must
contain columns "O", "S", "D", "TR", "HR", and "W" whose entries are probabilities summing
to one, corresponding to the probability of a player's at-bat resulting in each outcome.
The data frame must contain either a "NAME" or "NUMBER" column to identify players (these
must correspond to the lineup). Extra rows for players not in the lineup will be ignored.
This data frame may be generated from player statistics using prob_calc.
The stats data frame may optionally include an "SBA" (stolen base attempt) column
that provides the probability a given player will attempt a steal (provided they are on first
base with no runner on second). If "SBA" is specified, the data frame must also include
a "SB" (stolen base) column that provides the probability of a given player successfully
stealing a base (conditional on them attempting a steal). If these probabilities are not
specified, calculations will not involve any steals.
The stats data frame may also include a logical "FAST" column that indicates
whether a player is fast. If this column is not specified, the "FAST" designation
will be assigned based on each player's "SBA" probability. Players who are more
likely to attempt steals are likely the fast players.
As a default, simulations will be processed in parallel over all but one of the
maximum available cores. Parallelization is recommended to reduce computation time.
Interactive plotting (graphic = TRUE) requires no parallelization and will
override specified cores with cores = 1.