ff_wins_added: Wins Added

View source: R/0_ff_wins_added.R

ff_wins_addedR Documentation

Wins Added

Description

(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.

Usage

ff_wins_added(conn, ...)

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

Value

a dataframe summarising the net effect of each player on their team's wins

Examples


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)
})



ffsimulator documentation built on Feb. 16, 2023, 5:37 p.m.