Last chance! 50% off unlimited learning
Sale ends in
This is the default nflseedR function to compute game results in season simulations.
nflseedR_compute_results(teams, games, week_num, ...)
A list of updated teams
and games
tables.
A list of teams by simulation number. This is usually calculated automatically and not user facing. It can be used to "transport" team information like elo ratings from one simulated week to the next. Defaults to sims_teams_example. Please see this example to understand the required data structure.
An NFL schedule where some results are missing. compute_results
is supposed to compute those results on a weekly base. Defaults to
sims_games_example. Please see this example to understand
the required data structure.
The week of a NFL season for which the function should compute results.
Additional parameters used in the function. It is possible to pass
the argument elo
to the function. This must be a named vector in which the
names correspond to the team abbreviations and the values correspond to the
initial elo ratings, which are then updated after each week based on the
results and transported to the next week.
This function implements a variant of 538's elo model initially coded by Lee Sharpe (in nflseedR 1.0) and for performance rewritten by Sebastian Carl (in nflseedR 2.0).
g <- nflseedR::sims_games_example
# The functions expects the variable "sim" instead of "season"
g$sim <- g$season
t <- nflseedR::sims_teams_example
out <- nflseedR_compute_results(
teams = t,
games = g,
week_num = 5L
)
str(out, max.level = 2)
Run the code above in your browser using DataLab