**Fantasy Football Analytics » R | Fantasy Football Analytics**, 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:

```
pb <- txtProgressBar(min = 0, max = length(optimizeData$name), style = 3)
for(i in 1:length(optimizeData$name)){
setTxtProgressBar(pb, i)
j <- 1
listOfPlayers <- rep(optimizeData$name[i],numTotalStarters)
newCost <- optimizeData$inflatedCost
while(!is.na(match(optimizeData$name[i],listOfPlayers))){
newCost[i] <- j
listOfPlayers <- optimizeTeam(points=optimizeData$projections, playerCost=newCost, maxRisk=(max(optimizeData$risk)+1))$players
bidUpTo[i] <- j
j <- j+1
}
}
```

### Conclusion

I demonstrated how to calculate a bid up to value for each player. Calculating a bid up to value for each player is a great way to calculate a player’s value in an auction draft because it helps you determine the highest bid you should make for each player. If a player goes for more than his bid up to value, you should draft someone else.

The post Calculating the Highest Value to Bid on Each Player in an Auction Draft: The Bid Up To Value appeared first on Fantasy Football Analytics.

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

**Fantasy Football Analytics » R | Fantasy Football Analytics**.

R-bloggers.com offers

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