Skip to contents

Runs the bootstrapped resampling of player week outcomes on the latest rankings and rosters for a given number of seasons and weeks per season.

Usage

ffs_generate_projections(
  adp_outcomes,
  latest_rankings,
  n_seasons = 100,
  weeks = 1:14,
  rosters = NULL
)

Arguments

adp_outcomes

a dataframe of adp-based weekly outcomes, as created by ffs_adp_outcomes()

latest_rankings

a dataframe of rankings, as created by ffs_latest_rankings()

n_seasons

number of seasons, default is 100

weeks

a numeric vector of weeks to simulate, defaults to 1:14

rosters

a dataframe of rosters, as created by ffs_rosters() - optional, reduces computation to just rostered players

Value

a dataframe of weekly scores for each player in the simulation, approximately of length n_seasons x n_weeks x latest_rankings

See also

vignette("custom") for example usage

Examples

# \donttest{
# cached examples
adp_outcomes <- .ffs_cache("adp_outcomes.rds")
latest_rankings <- .ffs_cache("latest_rankings.rds")

ffs_generate_projections(adp_outcomes, latest_rankings)
#>         season fantasypros_id             player    pos   team   bye    ecr
#>          <int>         <char>             <char> <char> <char> <num>  <num>
#>      1:      1          16413 Patrick Mahomes II     QB    KCC    12   1.32
#>      2:      1          16413 Patrick Mahomes II     QB    KCC    12   1.32
#>      3:      1          16413 Patrick Mahomes II     QB    KCC    12   1.32
#>      4:      1          16413 Patrick Mahomes II     QB    KCC    12   1.32
#>      5:      1          16413 Patrick Mahomes II     QB    KCC    12   1.32
#>     ---                                                                    
#> 994528:     51          19534        Tarik Black     WR    IND    14 239.50
#> 994529:     51          19534        Tarik Black     WR    IND    14 239.50
#> 994530:     51          19534        Tarik Black     WR    IND    14 239.50
#> 994531:     51          19534        Tarik Black     WR    IND    14 239.50
#> 994532:     51          19534        Tarik Black     WR    IND    14 239.50
#>            sd  rank scrape_date  week projection gp_model projected_score
#>         <num> <num>      <Date> <int>      <num>    <int>           <num>
#>      1:  0.69     1  2021-09-03     1      44.74        1           44.74
#>      2:  0.69     1  2021-09-03     2      29.32        1           29.32
#>      3:  0.69     1  2021-09-03     3      33.48        1           33.48
#>      4:  0.69     1  2021-09-03     4      28.73        1           28.73
#>      5:  0.69     1  2021-09-03     5      34.28        1           34.28
#>     ---                                                                  
#> 994528: 20.50   243  2021-09-03    10       2.10        0            0.00
#> 994529: 20.50   243  2021-09-03    11       4.40        0            0.00
#> 994530: 20.50   243  2021-09-03    12       4.40        1            4.40
#> 994531: 20.50   243  2021-09-03    13       0.00        0            0.00
#> 994532: 20.50   243  2021-09-03    14       0.00        0            0.00
# }