**Fantasy Football Analytics in R**, and kindly contributed to R-bloggers)

In this post, I calculate the highest value you should bid on each player in an auction draft—what I refer to as the “bid up to” value. In a previous post, I showed how to determine the best starting lineup to draft using an optimizer tool. The “bid up to” value is calculated by finding the highest cost up to which a player is still on the best lineup, as determined by the optimizer.

### How it Works

The optimizer tool finds the starting lineup that maximizes your team’s projected points, while staying within your risk tolerance. By placing the optimization function in a loop, we can calculate the optimal starting lineup for each player at each cost. For example, to find Tom Brady’s bid up to value, we can start his cost at $1 and run the optimization function. At this price, Tom Brady is on the best starting lineup, so we increase his cost by $1 while keeping all other players at their expected cost. At $2, Tom Brady is still on the best starting lineup, so we increase his cost again by $1. We repeat this until Tom Brady’s cost is too high for him to be on the best starting lineup. As of this writing and given my league settings, Tom Brady’s bid up to value is $16. That means that Tom Brady is a good value up to $16—if he’s above that price, I should draft someone else because he is no longer on the optimal starting lineup at this cost. After calculating Tom Brady’s bid up to value, we reset his cost to his expected cost and then we calculate the bid up to value for the next player. We repeat this for all players to calculate each player’s bid up to value.

### The R Script

The R Script for looping the optimizer to find each player’s bid up to value is located here:

https://github.com/dadrivr/FantasyFootballAnalyticsR/blob/master/R%20Scripts/Bid%20Up%20To.R

Here is the syntax for looping the optimizer to calculate each player’s bid up to value:

### Conclusion

**leave a comment**for the author, please follow the link and comment on his blog:

**Fantasy Football Analytics in R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...