(EXPERIMENTAL) This function adds a basic wins-added calculation for each player on every team, presenting the change in wins if that player was removed from the team as the net wins-over-replacement for that player. This can be a bit of a time/compute-expensive calculation.
Arguments
- conn
an connection to a league made with
ff_connect()
and friends (required)- ...
Arguments passed on to
ff_simulate
n_seasons
number of seasons to simulate, default = 100
n_weeks
number of weeks per season, default = 14
best_ball
a logical: are weekly wins based on optimal lineups?
seed
an integer to control reproducibility
gp_model
select between "simple", "none" to apply a model for whether a player played in a given game, defaults to "simple"
base_seasons
a numeric vector that selects seasons as base data, earliest available is 2012
actual_schedule
a logical: use actual ff_schedule? default is FALSE
replacement_level
a logical: use best available on waiver as replacement level? defaults to TRUE
pos_filter
a character vector of positions to filter/run, default is c("QB","RB","WR","TE","K")
verbose
a logical: print status messages? default is TRUE, configure with options(ffsimulator.verbose)
return
one of c("default", "all") - what objects to return in the output list
Details
Runs base simulation once (with the usual parameters available for ff_simulate), then for every player on every team (except replacement level players):
remove them from that specific roster
reoptimize the lineups just for that roster without the player to calculate what the score ends up being without the player
summarise the new simulation
return the delta in wins and points
Summarise wins added as the difference between the sim with the player and the sim without them
Examples
# \donttest{
try({ # try block to prevent CRAN-related issues
# n_seasons set so that the example runs more quickly
ff_wins_added(mfl_connect(2021,54040), n_seasons = 5)
})
#> ── BASE SIMULATION ─────────────────────────────────────────────────────────────
#> ── Starting simulation 2024-10-03 14:20:48.769104 ──────────────────────────────
#> ℹ Importing data
#> ✔ Importing data ... done
#>
#> ℹ Generating Projections
#> ✔ Generating Projections ... done
#>
#> ℹ Calculating Roster Scores
#> ✔ Calculating Roster Scores ... done
#>
#> ℹ Optimizing Lineups
#> ✔ Optimizing Lineups ... done
#>
#> ℹ Building Schedules
#> ✔ Building Schedules ... done
#>
#> ℹ Summarising Simulation Data
#> ✔ Summarising Simulation Data ... done
#>
#> ── Simulation complete! 2024-10-03 14:21:05.733499 ─────────────────────────────
#> ── Start WAR calcs 2024-10-03 14:21:05.737915 ──────────────────────────────────
#> ── WAR calcs complete! 2024-10-03 14:21:31.413683 ──────────────────────────────
#> <ff_wins_added: 5 simulated seasons of The Super Smash Bros Dynasty League>
#> List of 15
#> $ war :Classes ‘data.table’ and 'data.frame': 449 obs. of 13 variables:
#> $ summary_simulation:Classes ‘data.table’ and 'data.frame': 14 obs. of 11 variables:
#> $ summary_season :Classes ‘data.table’ and 'data.frame': 70 obs. of 12 variables:
#> $ summary_week :Classes ‘data.table’ and 'data.frame': 980 obs. of 16 variables:
#> $ schedules :Classes ‘data.table’ and 'data.frame': 980 obs. of 5 variables:
#> $ optimal_scores :Classes ‘data.table’ and 'data.frame': 980 obs. of 10 variables:
#> $ roster_scores :Classes ‘data.table’ and 'data.frame': 37100 obs. of 22 variables:
#> $ projected_scores :Classes ‘data.table’ and 'data.frame': 19810 obs. of 14 variables:
#> $ scoring_history : tibble [58,572 × 26] (S3: tbl_df/tbl/data.frame)
#> $ franchises : tibble [14 × 8] (S3: tbl_df/tbl/data.frame)
#> $ rosters :'data.frame': 449 obs. of 13 variables:
#> $ lineup_constraints: tibble [4 × 7] (S3: tbl_df/tbl/data.frame)
#> $ latest_rankings : nflvrs_d [1,324 × 8] (S3: nflverse_data/tbl_df/tbl/data.table/data.frame)
#> $ league_info : tibble [1 × 17] (S3: tbl_df/tbl/data.frame)
#> $ simulation_params :List of 9
# }