In this post, we use an OpenCPU app in R to determine the best possible players to pick in a daily/weekly fantasy football (DFS) league. The app includes the most accurate fantasy football projections available, and calculates a robust average of more sources of projections than any other website (see here for a list of the sources of projections). You can even choose how much weight to give each source. Based on your league settings, it determines which players you should pick to maximize your starting lineup’s projected points. It also allows you to change your risk tolerance to avoid picking risky players. Best of all, the app updates the selections automatically with your inputs, and you can download the data for yourself. So let’s get to it. Here’s a more thorough description:
To Use the DFS Optimizer App
To use the DFS Optimizer App, you will need to subscribe to FFA Insider (for more info, see here).
How it Works
First, we use a script to scrape player’s projected points from numerous sources using R. Second, we scrape player prices from various DFS websites. Third, based on the user’s league scoring settings, we calculate players’ projections using an average of the analysts’ projections (by default, the sources are weighted according to historical accuracy). You can choose which projection sources to include, modify the weights, and choose to calculate a mean, weighted average, or robust average. A robust average is less affected by outliers (crazy projections). Fourth, we calculate players’ risk levels, as defined by the average of: 1) injury risk from Sports Injury Predictor, and 2) the standard deviation of the players’ projected points and rankings across analysts. Note that risk is standardized to have a mean of 5 and a standard deviation of 2.
Then, based on how many players you need for each position, your cap available, and your maximum risk tolerance, we use the Rglpk package to find your optimal lineup by selecting the remaining players available that maximize the lineup’s sum of projected points while meeting all of the constraints. For a similar execution using Excel’s Solver function, see here.
It is generally best to select players with minimal risk to ensure solid, if not superior, performance. We include players’ upside potential (ceiling) in the output, as defined by the players’ 90th percentile of their projected points across analysts.
Note that VOR, ADP, ECR, and AAV are not shown for weekly projections (only seasonal projections).
Season: which season of projections to use.
Week: which week(s) of projections to use.
Number of Starters by Position: how many players in your starting lineup at each position.
League Scoring: source of DFS scoring settings.
Positions: which positions of players to include in calculations.
Calculation Type: the type of average to calculate: mean, weighted average, or robust average. By default, a weighted average is used with analysts weighted by their historical accuracy. You can modify the weights in the weighted average. The mean is equivalent to a weighted average where all analysts are equally weighted (weight = 1). The robust average gives less weight to outliers (crazy projections).
Analysts: Select which analysts to include and, if weighted average, the weights for each analyst (i.e., how much weight to give each source of projections when calculating projected points). For instance, if you want to exclude ESPN projections, you would give them a weight of 0. If you want to give Yahoo projections twice the weight of CBS, you would give Yahoo a weight of 2 and CBS a weight of 1. The default weights reflect historical accuracy (higher = more accurate). Note that FantasyPros shows a default weight of zero because we already include all of their sources in our projections, so it would be double counting to give them a weight above 0. You can certainly do so, though, if you’d like. FantasyFootballNerd also shows a default weight of zero because it uses the same projections as FantasyData.
Scoring Settings: specify the number of points for each statistical category and position.
Maximum Risk Tolerance: Selects the maximum risk allowed for any player to be considered for inclusion in the optimal starting lineup. Players’ risk levels have a mean of 5 and a standard deviation of 2 (see below for more info on how risk is calculated).
Remaining Cap for Starters: How much cap you have remaining to spend on starters.
Players You Drafted: Select all players you’ve already picked (click “Pick” button next to player or type player’s name).
Other Players Drafted: Select players to exclude.
Lineup with Highest Points: Players with highest sum of projected points within your league cap and risk tolerance.
Lineup with Highest Floor: Players with highest sum of projected floor within your league cap and risk tolerance.
Lineup with Highest Ceiling: Players with highest sum of projected ceiling within your league cap and risk tolerance.
Pick: Click “Pick” button next to player to add to “Players You Drafted”.
Rank: Overall rank by projected points.
Player (Team): Player name and team. Click player’s name to add to “Other Players Drafted”.
Points: Average projected points for a player across analysts.
Ceiling: A player’s upside, calculated as the 90th percentile of a player’s projected points across analysts.
Floor: A player’s downside, calculated as the 10th percentile of a player’s projected points across analysts.
Pos Rank: Position rank.
Dropoff: The “dropoff” in projected points for the next best 2 players at the same position.
Risk: Risk of injury and degree of uncertainty of players’ projected points, calculated as the average of: 1) injury risk from Sports Injury Predictor, and 2) the standard deviation of the players’ projected points and rankings across analysts. Standardized within position to have a mean of 5 and a standard deviation of 2 (higher values reflect greater risk).
Displays two types of graphs:
- A density plot of projected points by analyst
- Line plot of each optimal starting lineup by projected points, floor, and ceiling
A density plot shows, for each analyst, what proportion of players are projected to score a given number of points. Density plots can be helpful for comparing analysts and finding analysts with wildly different projections. In the line plots, the dot represents the average (mean, weighted average, or robust average) estimate of projected points for each player. The line shows the range from a player’s floor to ceiling.
The DFS Optimizer App
For the DFS Optimizer app, go to: