Blog

Daily Fantasy Baseball Strategy: Stacking

As I mentioned in the previous post, stacking is possibly the most common strategy used in MLB DFS Tournament contests. Perhaps a more accurate statement is that it is very common in winning Tournament lineups. If you want to win a large Tournament, your best bet is to employ this strategy.

It works.

At this point, you’re probably asking the first question most of us asked in our lives: why? Good question, let’s talk about it. There are several reasons why stacking can give you an advantage, but two main reasons carry more weight than the others.

Take Advantage of Bad Pitching

One thing stacking allows you to do is select multiple batters that are going to be facing off against a bad pitcher. Bad pitchers give up more hits and runs, which results in more fantasy points. It should be obvious why this is a good reason to consider stacking. But it goes even further than that.

If you consider yourself a baseball fan and watch games often, think about what happens when a pitcher performs poorly. If a pitcher starts the game by giving up a lot of hits and runs in the first few innings, his pitch count gets too high early in the game. This usually leads to that team going to the bullpen to use relief pitchers a couple innings before they intended. On top of that, if they are already down by several runs, they probably won’t be using their best relievers.

Why is this important?

If you stacked 4 players in your lineup going against the starting pitcher that performed poorly, gave up a lot of runs, and got replaced early, your lineup is likely to see two main benefits.

  1. The players in your lineup were likely a part of the fun against that starting pitcher. This means that they likely racked up a few hits, RBI, runs, or stolen bases just in their first 2 – 3 plate appearances. So, you already have a good chunk of fantasy points with a lot of game left to be played.
  2. When a team is down by several runs early and has to replace their starter in the 3rd or 4th inning, they usually don’t put in their best bullpen pitchers. If this is the case, your players that you stacked go from seeing a bad starting pitcher to bad relieving pitchers. Bad relievers are typically even worse than bad starters. So, you get even more opportunity for high fantasy scores in the late innings. It really snowballs in your favor.

What’s Next?

In the next post, we’ll talk about the other big reason why stacking is a good strategy. Then we’ll touch on some of the other reasons as well.

If you want to play along and enter some FanDuel lineups of your own, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: Common Daily Fantasy Baseball Strategy
Click here for next post:
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

Common Daily Fantasy Baseball Strategy

Now that we have discussed the basics about how FanDuel, DraftKings, and daily fantasy baseball works, we can start talking about the strategies we will want to use to build lineups. A quick Google search for “MLB DFS Strategy” yields tons of common strategies used by players across the inter-webs. These strategies can range from beginner to advanced. Let’s start with a general overview of some of the most common strategies in this article. I’ll come back and link to more detailed breakdowns as we deep dive into some of these in future posts.

Stacking

This is possibly the most common DSF strategy in baseball contests. Stacking just means that you select multiple players from the same team, usually 3 or 4. There are a few reasons why this strategy makes sense. I found many articles that prove these ideas mathematically. If you want to read more about that, you can check out some of them here and here. I’ll summarize the main takeaways, but since others have already done the math to prove it, I won’t bother with that here. I just want to talk about general strategy for now.

  • If you choose several players from the same team, it allows you to have several players going against a specific bad pitcher. Bad pitchers give up more fantasy points to batters, so we can capitalize on this more by picking 4 players against that bad pitcher instead of just 1.
  • There is a correlation between fantasy performances of players on the same team. Usually players on the same team will do better than average together or worse than average together. This goes back to the “boom or bust” strategy we talked about earlier.
  • Stacking allows you to choose multiple players in other advantageous positions. This can allow you to capitalize more on things like hitter’s parks, or good weather.

Batting Order

A good general rule of thumb: pick players closer to the top of the batting order. You can read more about the math behind this here, but the logic is simple. Players batting at the top of the order get more at bats. Extra at bats equals extra opportunities to score fantasy points, which may lead to actually scoring more fantasy points.

Weather

Most importantly, it’s probably a good idea to avoid players in games with a chance of rain. If you have a player in a game that gets postponed due to rain, that player gets 0 points. It’s nearly impossible to win a large tournament with any zeros in your lineup.

On top of that, players playing in warm or hot games are more likely to score more points than players in cold games. The ball flies a little bit farther in higher temperatures, meaning home runs and extra base hits are going to be a little bit more likely. This translates to more runs scored in MLB games, and more fantasy points for players in that game.

What’s Next?

In the next several posts, we’ll start talking about these strategies in a bit more detail. More importantly, we’ll start talking about how we can set up experiments to test which variations of these strategies produce better results and win more DFS contests.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: High Variance or Low Variance in Tournaments vs 50/50s
Click here for next post: Daily Fantasy Baseball Strategy: Stacking
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

High Variance or Low Variance in Tournaments vs 50/50s

We now know how to calculate variance of fantasy performances of a given player, but now you’re probably thinking: why is this important?  You are asking the right questions.  It is a good one.  It all goes back to the differences between the payout structure and the number of lineups entered in the two types of contests.

Payout structure differences have a more significant impact, so let us start with that.

Impact of Payout Structure on Desired Variance

As a reminder, there are 2 main differences between the payout structure of a Tournament and a 50/50 contest.

Percentage of lineups entered that win

  • In a paid 50/50 contest, half of all entries win money giving an entry a 50% chance to win.
  • On the other hand, roughly 25% of all lineups entered in a Tournament end up winning.

Payout received for winning

  • In a paid 50/50 contest, all winning entries win the same amount of money.  Whether you are in 1st place or 50th place out of 100 entries, you receive the same payout.  As a result, if you can consistently be slightly better than the median lineup, you would have a profitable strategy for 50/50 contests.
  • Tournament contests have a very top-heavy payout structure.  As a result, you can still have a profitable strategy even if you win a lot less often than you would need to in a 50/50 contest.  In fact, the lineup that ends in 1st place can receive 300-500 times their entry fee.  This means that if you can manage to create a better lineup than everyone else in the contest, you may be able to enter 299 losing lineups and still break even.

Key Takeaways

The significance of these differences can be summarized quite simply. 

If you are entering Tournaments, you want players in your lineup with high variance in fantasy points scored per game.  This would give you a higher chance of finishing in the top-heavy winning portion of entries.  It will also make you more likely to finish at the bottom, but since you win $0.00 for finishing above 70% of lineups or for finishing in last place, that won’t make much difference. 

However, if you want to enter 50/50 contests, you should select players with low variance that give you high chance of doing just a little bit better than half of the other entries.

In other words, if you want to enter Tournaments, the “boom or bust” strategy is likely going to work better for you in the long run.  Keep in mind though that this approach requires a large sample size created by entering many Tournaments.  Even if we know we have a profitable system, since a 1st place finish may require hundreds of entries before it actually hits.  If this is the approach you want to take, you should choose an entry fee you can afford to pay 1000 times, not one that you can afford to pay once. 

You would effectively be playing the lottery at that point.  That is not my goal with these posts.  Plan to achieve a large sample size when using math to create a profitable betting system. Again, nothing in these posts should be thought of as fanatical or gambling advise. However, if you want to implement any of the strategies discussed, it’s important to test their statistical significance.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: Lineup Strategy Differences in Tournaments vs 50/50s
Click here for next post: Common Daily Fantasy Baseball Strategy
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

Lineup Strategy Differences in Tournaments vs 50/50s

As you might expect, the payout structure differences between Tournaments and 50/50 contests will impact our strategy. Number of lineups in the contest will likely impact our choices as well. However, the payout structure should be considered more significant. The players we choose to create a lineup will be different depending on what type of contest we are entering.

Both factors will impact our strategy for a similar reason. It all comes down to one main thing: variance.

What is Variance?

If you have taken any statistics courses, you should be familiar with the concept of variance. If not, it can be thought of most simply, as how spread out a set of numbers are. A set of numbers that are generally close to each other will have a lower variance than a set of numbers that are more spread out. This is a bit of a vague oversimplification, but it should be enough to understand why it is important here.

The concept of variance materializes in fantasy points and sports in general as consistency. Consistent players would have a low variance in their fantasy production, and inconsistent players would have a high variance.

You need to be careful here though. Just because you have noticed a player getting 2 hits per game for the last week, or always coming through late in the game, does not mean he is consistent. We need to measure the variance of all his performances to get a ligament measure of how consistent he is.

How to Measure Variance

First, you will need to find a list of fantasy points a player scored in games. This could be any sample of games you want to measure: last week, this season, career, etc. Once you have a list of fantasy points scored over the period you want to consider, you can simply use the variance formula.

Sample variance, often denoted as S^2, can be found by:

$$S^2 = \frac{\Sigma (x_i \ – \ \bar{x})^2}{n-1}$$

Where,
S^2 = sample variance
x_i = the value of one fantasy performance
\bar{x} = the mean of fantasy points scored per game
n = the number of game performances in sample

If this type of formula is intimidating to you, do not worry about calculating this with the formula. If you want to try calculating this for a specific player, it can be calculated easily using Microsoft Excel using the VAR.S function.

My main point here is that consistency of a fantasy player can be quantified. In the next post, we will discuss how we can use this measure to decide which players we want in a Tournament lineup vs a 50/50 lineup.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: DFS Contest Types: Tournaments vs 50/50s
Click here for next post: High Variance or Low Variance in Tournaments vs 50/50s
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

DFS Contest Types: Tournaments vs 50/50s

Now that we have talked about the differences between FanDuel vs DraftKings scoring, we need to discuss the different type of contests. Tournaments and 50/50s are the two most common contest types if you want to enter a full roster MLB contest. FanDuel does also offer other contest types, like Head to Heads, Multipliers, and 3-100 Players, but those are less available and less popular than Tournaments and 50/50s. Plus, the payout structure for Head to Heads and Multipliers are very similar to 50/50s. As a result, I’m only going to go into detail on the main two contest types.

There are two main differences between these contest types we will discuss: the number of lineups in the contest, and the payout structure.

Number of lineups in Tournaments vs 50/50s

Generally, Tournaments are going to contain a lot more lineup entries than a 50/50 contest. There are small tournaments with fewer than 20 lineups, but they are usually going to be much larger. There are typically going to be tournaments with several hundred or thousand entries for the main slate of games each day throughout the MLB season.

It does depend on what the cost to enter the tournament is with lower entry fee Tournaments usually allowing more lineups than those that cost more to play.

However, 50/50s are much smaller. 50/50 contest range anywhere from 10-100 total entries typically. You don’t really see any larger than 100, like you do with Tournaments. I will touch on how we might expect the different sizes of contests to impact our optimizer in the next post.

Payout Structure in Tournaments vs 50/50s

50/50 contests have a simple payout structure in FanDuel. 50% of entries win, and 50% do not. The amount you win is 180% of whatever the entry fee is. So, if you enter a 50/50 contest with a $1 entry fee and finish in the top 50% of entries, you get back $1.80. In a 50/50 contest, FanDuel is paying out 90% of total entries paid, and keeping 10% for themselves.

The payout structure for a Tournament is a bit more complex. It’s more top heavy, so the winner gets a lot more than they paid to enter. And a lot more entries finish “out of the money” and receive nothing. The exact payout structure can vary depending on the entry fee and number of lineups allowed, but they all payout a larger amount of money to a smaller number of players than 50/50s. Here is an example of the payout structure for a FanDuel Tournament with a $2.22 entry fee in the 2022 MLB season. There was a total of 5,362 entries in this Tournament.

Place FinishedPayout per Entry
1st$1,000
2nd$500
3rd$250
4th$150
5th$100
6th – 7th$75
8th – 10th$50
11th – 15th$40
16th – 20th$30
21st – 30th$25
31st – 50th$20
51st – 75th$15
76th – 100th$10
101st – 200th$8
201st – 400th$6
401st – 675th$5
676th – 1,350th$4

In this case, there would have been $11,903.64 paid in entry fees by the players, and about 84.01% of that was paid out to winning lineups. The other 15.99% was kept by FanDuel. The top 25.18% of lineups entered in this contest won something.

What’s Next?

In the next post we will start discussing how these differences will impact the strategy for entering different types of contests. We will need to keep this in mind as we set up the rules for our optimizer so it picks players that give us the best shot of winning in the specific contest we enter.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: How Scoring Differences in FanDuel vs DraftKings Impact Our Optimizer
Click here for next post: Lineup Strategy Differences in Tournaments vs 50/50s
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

How Scoring Differences in FanDuel vs DraftKings Impact Our Optimizer

Now that we have talked about the differences between FanDuel vs DraftKings scoring, we need to touch on how this will actually impact our strategy. Since we will be creating a mathematical model eventually, this can be easily adjusted. We will be able to account for these differences in our projected points automatically.

However, it will be helpful to take a moment to think about what we expect to change before jumping into it. I generally recommend this for any math problem or application of math concepts. It is very helpful to think about what result you expect ahead of time so you will have some idea at the end if something went horribly wrong and your answer is not even reasonable.

Unfortunately, this happens sometimes. But if you recognize it, you have the chance to fix the error instead of submitting several paid DFS lineups based on a flawed system. This would not end well (as you might expect), so it’s best to avoid it.

For reference, here is a breakdown of everything that gets points for an MLB contest on both sites.

FanDuel vs DraftKings Scoring

Differences For Hitters Between FanDuel and DraftKings

Both sites give you +3 points if your player hits a single. However, on FanDuel all extra base hits are worth more than they are on DraftKings. Also, getting a Walk or Hit by Pitch is worth the same as a single in FanDuel, while DraftKings only gives +2 points for those. DraftKings also values an RBI and a Run at +2 points, while they are worth +3.5 and +3.2 points respectively on FanDuel.

This means that relatively speaking, a player getting extra base hits and creating runs for their team through RBI, Runs, Stolen Bases, and getting on base without hits is more valuable on FanDuel than it is on DraftKings. Instead, a player with a lot of singles would have relatively higher value on DraftKings. So, we might expect stats like OBP (On Base Percentage) or SLG (Slugging Percentage) to be more correlated to fantasy points on FanDuel, and a stat like AVE (Batting Average) to be more correlated to fantasy points on DraftKings.

Differences For Pitchers Between FanDuel and DraftKings

The main difference between the two scoring systems here, is what pitchers actually receive points for. In DraftKings, things like walks and hits allowed matter. They directly take fantasy points away from the pitcher. This is not the case in FanDuel. FanDuel really only looks at ER (Earned Runs Allowed), Strike Outs, and IP (Innings Pitched).

Because of these differences, we might expect pitchers with a low ERA (Earned Run Average), who pitch more innings, or who throw a lot of Strike Outs to be more valuable in FanDuel. Similarly, we might expect players with a low WHIP (Walks and Hits allowed per Inning Pitched) to be more valuable in DraftKings.

Final Thoughts on Scoring Differences

I do not want to go into too much detail on why these differences matter yet. I just wanted to get you thinking about them a bit now so you can keep that in mind as we build up to more detail on the topic.

Next, we are going to discuss the different game modes offered by FanDuel and DraftKings. Similar to the scoring differences, we will dive into how the differences in rules between game modes will impact our lineup creating strategy. If you want to be notified via email when these posts go up, just put your information in the form below and I’ll let you know as I post them.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: FanDuel vs DraftKings Scoring for MLB
Click here for next post: DFS Contest Types: Tournaments vs 50/50s
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

FanDuel vs DraftKings Scoring for MLB

We should start by discussing the difference between the scoring systems used for FanDuel vs DraftKings. Their scoring for MLB (baseball) contests are similar, but not exactly the same. We will need to keep these differences in mind as we build our FanDuel lineup optimizer. And you will need to keep them in mind if you plan to adapt the methods I discuss to use them in DraftKings.

FanDuel vs DraftKings Scoring for MLB

FanDuel Scoring for MLB

As of the time of this writing, the table below shows the fantasy points received for each stat a player records.

HittersPitchers
1B (Single) = +3 pointsW (Win) = +6 points
2B (Double) = +6 pointsQuality Start = +4 points
3B (Triple) = +9 pointsER (Earned Run) = -3 points
HR (Home Run) = +12 pointsSO (Strikeout) = +3 points
RBI (Run Batted In)= +3.5 pointsIP (Innings Pitched) = +3 points*
R (Run) = +3.2 points
BB (Walk) = +3 points
SB (Stolen Base) = +6 points
HBP (Hit by Pitch) = +3 points
Source: https://www.fanduel.com/rules

* Fractional scoring per out.
Notes: Quality Start is awarded to a starting pitcher who completes at least six innings and permits no more than three earned runs.

DraftKings Scoring for MLB

HittersPitchers
1B (Single) = +3 pointsW (Win) = +4 points
2B (Double) = +5 pointsER (Earned Run) = -2 points
3B (Triple) = +8 pointsSO (Strikeout) = +2 points
HR (Home Run) = +10 pointsIP (Innings Pitched) = +2.25 points (+0.75 Pts / Out)
RBI (Run Batted In)= +2 pointsHit Against = -0.6 points
R (Run) = +2 pointsBase on Balls Against (Walk) = -0.6 points
BB (Walk) = +2 pointsHit Batsman (HBP Allowed) = -0.6
SB (Stolen Base) = +5 pointsComplete Game = +2.5 points
HBP (Hit by Pitch) = +2 pointsComplete Game Shutout = +2.5 points
No Hitter = +5 points
Source: https://www.draftkings.com/help/rules/mlb

Notes: Hitting statistics for Pitchers will not be counted, and Pitching statistics for Hitters will not be counted.

Which will we use?

For the posts that will follow, we will be using FanDuel scoring. However, feel free to consider how the methods described in these posts can be adapted to the DraftKings scoring. If you are a DraftKings player, or prefer that scoring system, I will do my best to present the topics we use in a way that you can use them yourself.

It is my goal for this series of posts that you will be able to take the methods I use and write about to do your own experiments. This means it should be simple for you to change the points received for each stat category and create your own system for DraftKings or any other Daily Fantasy Sports site.

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here for previous post: Introduction to DFS Picks with Math
Click here for next post: How Scoring Differences in FanDuel vs DrafKings Impact Our Optimizer
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

Introduction to DFS Picks With Math

As a math tutor, people have always asked me: how is calculus used in real life? There are many examples of calculus in the real world, and statistics in the real world too. These applications appear in all kinds of industries, and overlapping with other sciences. However, there is one field that has always interested me most: sports.

I have always been fascinated by people using statistics and math to predict the outcome of sporting events. Or even to evaluate the performance of players, their impact on the outcome of the game, and their value to their team. However, I do not work in the sports world. I do not need to inform decisions about what players Billy Bean wanted to sign. I have no input on how big of a contract the Atlanta Braves should offer their 1st baseman with a career .859 OPS and a .234 strike out rate.

But what I can do is play fantasy sports. I can investigate how to construct the best possible lineup in a Daily Fantasy Sports (DFS) slate on FanDuel, and actually use the knowledge I gain from that investigation. So that’s what I have decided to do.

Mission Statement

We will build the best FanDuel MLB lineup optimizer. Since we will be building it from scratch, we should have the best free DFS lineup optimizer on the internet by the time we’re done with this. I invite you to join me on this journey, and we’ll see what we can learn together. Let’s get started!

Keep in mind, I will be showing you investigative techniques that you could apply to DraftKings as well. Due to slight scoring or lineup differences between FanDuel and DraftKings, you may need to adjust our model a bit. However, the overall ideas should be the same.

My goal with this series of posts is simple. These posts will inspire college algebra and calculus students to learn the basics taught in their required coursework, so that they can build on it with interesting, real-world applications like the ones discussed in this series.

Disclaimer: Nothing in this article, or any other content on this site or my YouTube channel should be interpreted as financial or gambling advise. This content is all created for educational and entertainment purposes. We will be investigating how to evaluate DFS MLB lineups mathematically in order to maximize the chances of winning a large tournament on FanDuel. If you decide to use these methods to create your own lineups and enter them in paid contests, please be smart, be safe, and only play with money you can afford to lose. There are no guarantees here.

Want to Play Along?

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link.

Click here to view next post: FanDuel vs DraftKings Scoring for MLB
Click here to view the Table of Contents for other DFS Picks With Math posts.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

Make Tournament Winning DFS Lineups by Applying Optimization Problems (MLB) – Calculus in the Real World

As a math tutor, people have always asked me: how is calculus used in real life? There are many examples of calculus in the real world, and statistics in the real world too. These applications can be found in all kinds of industries, and overlapping with other sciences. However, there is one field that has always interested me most: sports.

I have always been fascinated by people using statistics and math to predict the outcome of sporting events. Or even to evaluate the performance of players, their impact on the outcome of the game, and their value to their team. However, I do not work in the sports world. I do not need to inform decisions about what players Billy Bean wanted to sign, or how big of a contract the Atlanta Braves should offer their 1st baseman with a career .859 OPS and a .234 strike out rate.

But what I can do is play fantasy sports. I can investigate how to construct the best possible lineup in a Daily Fantasy Sports (DFS) slate on FanDuel, and actually use the knowledge I gain from that investigation. So that’s what I have decided to do.

We will build the best FanDuel MLB lineup optimizer. Since we will be building it from scratch, we should have the best free DFS lineup optimizer on the internet by the time we’re done with this. I invite you to join me on this journey, and we’ll see what we can learn together. Let’s get started!

Keep in mind, I will be showing you investigative techniques that you could apply to DraftKings as well. Due to slight scoring or lineup differences between FanDuel and DraftKings, you may need to adjust our model a bit. However, the overall ideas should be the same.

Disclaimer: Nothing in this article, or any other content on this site or my YouTube channel should be interpreted as financial or gambling advise. This content is all created for educational and entertainment purposes. We will be investigating how to evaluate DFS MLB lineups mathematically in order to maximize the chances of winning a large tournament on FanDuel. If you decide to use these methods to create your own lineups and enter them in paid contests, please be smart, be safe, and only play with money you can afford to lose. There are no guarantees here.

Want to Play Along?

If you want to play along and enter some FanDuel lineups of your own as we conduct this investigation, you can use my FanDuel referral link here to get a deposit bonus. You should just need to deposit at least $15 within 30 days of signing up, and you’ll get a $15 bonus added to your account if you use that link. Can’t complain about some free money, right?

Background Research

Let’s start with the basic strategy we will investigate, and hopefully build on. Perhaps the most popular strategy in large tournaments on DFS is lineup stacking. This is a popular strategy in MLB DFS, but also in other sports. The idea is that we select multiple players from the same team to put in our lineup. If, for example, the New York Yankees blow out the Chicago Cubs by a final score of 8-1, there were likely a few Yankees with exceptional fantasy performances that day. Even better than that, many point producing events throughout the game would have most likely been double counted in your lineup, if you had multiple Yankees.

Sticking with the prior example, let’s say you have Aaron Judge and Giancarlo Stanton batting 3rd and 4th respectively, for the Yankees. You put both of them in your lineup. In the 3rd inning, Aaron Judge hits a double, getting you some points. Then Giancarlo Stanton comes up and hits a 2-run homer. You would get the points for 1 run for Judge scoring, and the HR, 1 run, and 2 RBI for Stanton’s swing of the bat. As you could imagine, this effect is compounded even more if you have 3 or 4 players lined up from the same team. If they start stringing hits together, that’s a lot of double counted points.

What players should you stack? What teams should you pick to stack from?

I found an article that addresses a few of these questions. I’ll summarize the main points I decided to start testing out, but if you want to see the full explanation of these strategies, you can see that article here.

There are 3 main ideas shown in that article that I decided to start building lineups around:

  1. We should target batters matching up against the pitchers with the lowest salaries on FanDuel. Lower salary implies it’s a worse pitcher, and will likely give up more fantasy points to opposing batters.
  2. We should target players batting as close to the top of the lineup as possible. Also when we stack players from the same team, they should be as close to each other in the lineup as possible.
  3. It is common for multiple players on the same team to be in the top 20 of all players in any given slate, and not uncommon at all for multiple teammates to be top 10, or top 5.

You can check out the article linked above for more details, but point #3 essentially just validates that stacking 2-4 players from the same team is a valid strategy. This is especially true when you enter a large tournament where you need your lineup to be in about the top 25th percentile just to finish in the money.

Points #1 and #2 though, tell us a bit about which teams to stack players from, and which players in the lineup we want.

Turning Our Strategy into an Optimization Problem

This is where the calculus comes into play. We won’t be solving any optimization problems here, or doing calculus. However, I do think it helps in the setup if you have at least a basic understanding of how to set up and solve a calculus based optimization problem. If you want a lesson on those, you can find that here.

Otherwise, let’s get into what I started with. When we sit down to set our lineup, we have something like this.

We need to fill our lineup (on the right) with the 9 players we think will score as many points as possible, from the available players shown (on the left). Each of them has a salary associated with them, and the sum of the 9 players’ salaries we choose needs to be below $35,000.

Don’t worry, you don’t have to actually spend 35,000 real dollars to fill your lineup. Think of that as game money. It’s just a way for the players we choose to have some limitation on it. It prevents us from just choosing the best player in each position across the board.

All an optimization problem is, is one equation that we are trying to maximize (or minimize), and one or more restriction equations that limit our variables somehow.

Well, it just so happens that’s all a FanDuel lineup is. Think about it. We have one thing that we are trying to make as big as possible: fantasy points scored.

And we have several restrictions addressing what our lineup is allowed to be:

  • We need 9 exactly players in total.
  • Total team salary less than or equal to $35,000.
  • Exactly 1 Pitcher (P).
  • At least 1 Catcher or 1st Baseman (C/1B).
  • At least 1 2nd Baseman (2B).
  • At least 1 3rd Baseman (3B).
  • At least 1 Short Stop (SS).
  • At least 3 Outfielders (OF).

This means, we need a lineup consisting of: P, C/1B, 2B, 3B, SS, OF, OF, OF, and UTIL. “UTIL” stands for utility and this position can be a C, 1B, 2B, 3B, SS, or OF. Basically, anything except a second Pitcher.

If we create a several variable optimization problem from this, using the one equation to optimize (sum of projected fantasy points), and the several restriction equations, we would at least be able to create legal lineups that we expect to do as well as possible.

However, we want to do better than that. Keep in mind there is always going to be variations in how many points players actually get. And sometimes, it’s not very close to their projected points. So, we want to use some of the stacking strategies I mentioned earlier to take advantage of those variations and give us a decent chance at having our lineup in the top 25th percentile. And it’s even better if we can be in the top 10%, 5%, 1%, or even the top lineup in our contest.

If we don’t take advantage of the stacking strategies, it’s less likely for many players in our lineup to do really well, or really poorly, on the same day. We want to create a boom or bust situation. This is because one big “boom” lineup can cover the cost of several “bust” lineups. Plus, a “middle of the road” lineup is just as useful as a bust.

It’s not…

They’re both worth $0.00.

Here Is Why

I’m sure by now, you are wondering why I have assumed that a “boom or bust” strategy is our best option. Let me elaborate.

Below is an image showing the results of a large tournament style contest. The gray and green bar represents all 3,217 lineups that were entered into the tournament. The green section shows the lineups that finished “in the money” and the gray is all the people that lost their $2.22 buy in. The blue figure shows where this lineup finished in there, 1,776th place of the 3,217 entries.

This lineup actually finished in the top half of this tournament, slightly better than “middle of the road.” But not high enough. The $2.22 entry fee was lost because we needed a bit more “boom” in the lineup. Might as well have been a “bust.” This is what we need to shoot for when only the top 23.3% of lineups win anything. I know it’s not shown in the image, but the top 750 lineups got money back in this tournament, and the 750th place finish got $5 from their $2.22 entry fee.

The top 10 lineups collectively won $1,295 of the total $6,000 in prizes for the whole contest. And the top 1 lineup won $500.

Hopefully this convinces you of the “boom or bust” strategy we will be adopting. One 1st place finish would pay for 225 losses of the $2.22 entry (in this specific contest structure). If we can really create a strategy with serious “boom or bust” potential, we would break even if we got 1st place 1 time, and finished “out of the money” 225 times.

This boom or bust approach likely would not be the best option for other contest types on FanDuel, like 50/50 or head to head contests. But for tournament style, the payout structure is always top heavy like the example above. Since we are starting with an investigation of winning tournament style contests, the boom or bust approach is a good starting place.

How do you optimize your lineup for stacking strategies?

Well, it’s quite simple to do when you’re treating your lineup like one big optimization problem. I should let you know, we don’t need to be able to solve this optimization problem. We have a computer for that. I’ll explain how we can have a computer solve this problem for us shortly, but for now we need to think about how to add in these extra considerations.

All we need to do, is add additional restriction equations to our optimization problem. Don’t worry about how these look mathematically for now. Let’s just think about the logic of what we want in our lineup.

Based on the 3 main takeaways I listed above, let’s start by applying the following restrictions to our lineup and see what happens. We can worry about fine tuning this later.

  • Stack players opposing the lowest salary pitchers. On FanDuel, you can only use up to 4 players on the same team in one lineup, so let’s start there. This may be 3 batters and the pitcher, or 4 batters on this targeted team. I figure the opposing pitcher is more likely to have run support and get the win, so he should still benefit from going up against a bad starting pitcher.
  • We will only use players in the starting lineup batting 1-5. This will guarantee that our stacked players are near each other in the lineup, and will help ensure that all of our batters are going to be getting a decent number of plate appearances (PA).
  • It will also be a good idea to add in one more thing. Let’s make sure we aren’t selecting any batters on the team opposing our pitcher. It is extremely difficult for our pitcher to have a good game and a batter on the opposing team to have a good game at the same time. One of them scoring points basically takes points away from the other, so not putting this in will lead to a “middle of the road” lineup. Again, useless in a big tournament.

Tools Used to Set up the Optimization Problem

In order to get this problem set up, I used a couple different tools. First, I used RotoWire projections for projected points for each player. This was the value that I wanted to maximize in this problem.

I used PuLP, which is a free Python package that is essentially made to create and solve optimization problems like this. You can check out the documentation on PuLP here. It can be used to solve the kinds of optimization problems you would need to solve in a calculus class, but it’s very helpful when you are trying to solve more complex problems like this. It would take an unreasonable amount of time to solve a problem like this by hand.

There was some setup I had to do to get all of the data from the RotoWire projections .csv file and decide which team would be targeted to stack 4 players from, but here is the portion of the code that basically creates our optimization problem. You will likely have to do some clean up or restructuring of variables here if you want to use this code yourself, but I wanted to give you a glimpse of how we can actually set up an optimization problem for a computer to solve for us.

import pulp

x = pulp.LpVariable.dict("player", range(0, len(all_player_list)), 0, 1, \
                         cat=pulp.LpInteger)
prob = pulp.LpProblem("Lineup", pulp.LpMaximize)
prob += pulp.lpSum(float(all_player_list[i][8]) * x[i] for i in range(0, \
                   len(all_player_list)))
prob += sum(x[i] for i in range(0, len(all_player_list))) ==  9 # 9 total players
prob += sum(x[i] for i in range(0, len(all_player_list)) if 'P' in \
            all_player_list[i][3]) == 1 # 1 P
prob += sum(x[i] for i in range(0, len(all_player_list)) if 'C' in \
            all_player_list[i][3] or '1B' in all_player_list[i][3]) >= 1 # 1 C/1B
prob += sum(x[i] for i in range(0, len(all_player_list)) if '2B' in \
            all_player_list[i][3]) >= 1 # 1 2B
prob += sum(x[i] for i in range(0, len(all_player_list)) if '3B' in \
            all_player_list[i][3]) >= 1 # 1 3B
prob += sum(x[i] for i in range(0, len(all_player_list)) if 'SS' in \
            all_player_list[i][3]) >= 1 # 1 SS
prob += sum(x[i] for i in range(0, len(all_player_list)) if 'OF' in \
            all_player_list[i][3]) >= 3 # 3 OF
prob += sum(x[i] * int(all_player_list[i][7]) for i in range(0, \
            len(all_player_list))) <= 35000 # total salary


# Used to make sure there is at least x players stacked from same team
support_min_hires = pulp.LpVariable.dicts('team hires', teams, cat='Binary') 


# Makes sure that the targeted team has at least the desired stack.
for team in teams: 
    prob += pulp.lpSum(x[i] for i in range(0, len(all_player_list)) if \
                       all_player_list[i][4] == stacked_team) >= \
                       support_min_hires[team] * 4
prob += pulp.lpSum(support_min_hires[team]) >= 1


# Prevent lineups from having pitchers and batters going against each other.
for p in range(0, len(all_player_list)): 
    if 'P' in all_player_list[p][3]:
        prob += pulp.lpSum([x[i] for i in range(0, len(all_player_list)) if \
        all_player_list[i][4] == ''.join(filter(str.isalnum, \
        all_player_list[p][5]))] + [8 * x[p]]) <= 8


# Makes sure we don't select two of the same player in two different positions.
# This was needed because I created multiple player objects for the same
# player if they could be used in 2 positions.
for player in players: 
    prob += pulp.lpSum(x[i] for i in range(0, len(all_player_list)) if \
                       all_player_list[i][0] == player) <= 1

What does this do?

To start, I ran this problem solver a few times. I started with creating a restriction equation that would force our lineup to stack 4 players from the team opposing the cheapest pitcher on the slate. This created the top lineup – “LINEUP #1.”

Then I repeated the process, this time forcing a 4 player stack opposing the second cheapest pitcher of the slate. Then the third cheapest, fourth cheapest, etc. Until I was left with 10 lineups for the given slate of players. For example, running this on the main slate for Friday, September 2, 2022 left us with this:


Stack number: 4 – Stacked Team: SEA
[‘Cody Morris’, ‘R’, ‘P’, ‘P’, ‘CLE’, ‘SEA’, ‘Yes’, ‘5500’]
=== LINEUP #1 ===
Solution status: Optimal
Charlie Morton with projected 35.56 points. He is P, cost 9800
Carson Kelly with projected 12.13 points. He is C, cost 2300
Jose Altuve with projected 14.26 points. He is 2B, cost 4000
Eugenio Suarez with projected 11.20 points. He is 3B, cost 3700
Carlos Correa with projected 13.94 points. He is SS, cost 3300
Max Kepler with projected 13.70 points. He is OF, cost 2600
Julio Rodriguez with projected 12.73 points. He is OF, cost 3600
Mitch Haniger with projected 11.71 points. He is OF, cost 3300
Jesse Winker with projected 11.58 points. He is OF, cost 2300
Total cost: 34900, Total Projected Points: 136.81

Stack number: 4 – Stacked Team: BOS
[‘Dallas Keuchel’, ‘L’, ‘P’, ‘P’, ‘TEX’, ‘@BOS’, ‘Yes’, ‘5500’]
=== LINEUP #2 ===
Solution status: Optimal
Charlie Morton with projected 35.56 points. He is P, cost 9800
Carson Kelly with projected 12.13 points. He is C, cost 2300
Javier Baez with projected 12.51 points. He is 2B, cost 2800
Alex Bregman with projected 13.25 points. He is 3B, cost 3600
Xander Bogaerts with projected 13.15 points. He is SS, cost 3800
Max Kepler with projected 13.70 points. He is OF, cost 2600
Tommy Pham with projected 13.57 points. He is OF, cost 3500
J.D. Martinez with projected 13.08 points. He is OF, cost 3200
Alex Verdugo with projected 11.10 points. He is OF, cost 3300
Total cost: 34900, Total Projected Points: 138.05

Stack number: 4 – Stacked Team: MIN
[‘Joe Kelly’, ‘R’, ‘P’, ‘P’, ‘CWS’, ‘MIN’, ‘Yes’, ‘5500’]
=== LINEUP #3 ===
Solution status: Optimal
Charlie Morton with projected 35.56 points. He is P, cost 9800
Carson Kelly with projected 12.13 points. He is C, cost 2300
Jose Altuve with projected 14.26 points. He is 2B, cost 4000
Jose Miranda with projected 10.82 points. He is 3B, cost 2900
Corey Seager with projected 14.41 points. He is SS, cost 4100
Max Kepler with projected 13.70 points. He is OF, cost 2600
Tyler O’Neill with projected 13.61 points. He is OF, cost 3300
Nick Gordon with projected 11.66 points. He is OF, cost 2500
Carlos Correa with projected 13.94 points. He is SS, cost 3300
Total cost: 34800, Total Projected Points: 140.09


You can see above each lineup, the team we are stacking 4 players from, and the opposing pitcher listed that we are trying to target. This is just the first 3 lineups created, but there were 7 more like them. You could easily loop through all the pitchers and create any number of lineups. Maybe you just want the top one, or maybe you want all available options. In theory, this should give us a list of 10 lineups with decent “boom or bust” potential.

What this creates for us is a list of optimized lineups that we can choose from on any given day, any given slate. And a system that we can use to create lineups for historical contests and slates and see how they would have done, as well as future contests to speed up our lineup creating process when we want to play.

Limitations

This is a great start as this should be a list of mathematically optimized lineups. The fact that we treated it as an optimization problem, means that we selected the 9 players with the highest number of projected points as possible, while making sure it’s still a legal lineup.

In theory, we should get the maximum bang for our buck with these players in terms of the points they score based on the salary they cost. But this does rely on one very big assumption: the projected points provided by RotoWire are good projections.

Are they?

If so, then this system would certainly provide optimal lineups with great opportunity to “boom” and get us to the top of a tournament. This is thanks to the fact that we used the stacking strategies discussed earlier.

But if the projections are not very good, then we might as well have just picked random players, or assumed average points based on their position in the lineup, or some other (likely not very useful) method for projecting individual player performance.

Essentially what we have here, is a great system for creating lineups with a high potential for a maximized team score, as long as we can reasonably predict the individual players’ performance.

How well does this system work?

This method seems to give us a good shot at winning a top heavy payout structured tournament. Or at least placing “in the money.” But how well does it actually work? Would it be profitable, break even, or lose us money long term?

Those are important questions to answer, and those will be questions that we attempt to answer in the next section of our investigation. Without doing some testing and confirming the performance of this strategy in actual FanDuel tournaments, we can’t say that it’s a good strategy with any confidence.

Next we will create a system for back testing this strategy throughout the 2022 MLB season, as well as using some statistical analysis to evaluate how confidently we can expect these results to be repeated. Or extended into a larger sample of contests. This will allow us to confirm how much money we would have won or lost in paid games on FanDuel throughout the season, up to this point. And if we can confidently enter lineups from this system with a reasonable expectation of winning some of them in the future.

This does give us a great starting place for creating lineups of our own though. So, until then, I think I’ll enter some of these lineups myself and see what happens. Have a little fun with it. That is what this is all about after all. Then we take this investigation a bit further.

If you’d like to join me, you can go get signed up on FanDuel right here.

Some links in this article may be affiliate links or referral links, meaning I would get a small commission for your purchase at no additional cost to you.

How to Create an Euler’s Method Differential Equations Calculator

Euler’s method is a useful tool for estimating a solution to a differential equation initial value problem at a specific point. In this post, I’m going to show you how to apply Euler’s method both on a piece of paper doing calculations by hand, and in an Excel spreadsheet.

Before we jump into the first example I just want to mention that this uses one of the formulas on my Calculus 2 Study Guide (Integral Calculus Cheat Sheet). It’s available for instant download so you can start using it today. You can learn more about that cheat sheet and buy your copy today by clicking here.

How to Apply Euler’s Method With Differential Equations

We will go ahead and start with this first example here. Use Euler’s method with a step size of 0.2 to estimate y(1), where y(x) is the solution of the initial-value problem y'=xy-x^2, \ y(0)=1. If you’d prefer to see this example in video form you can watch it here.

I like to solve these problems using a table. I think that’s the easiest way to keep everything you’re doing organized. And then we’re going to use the formula on my study guide to fill in the table row by row until we get to our answer. So let’s just go ahead and start with the formula that’s on my study guide first, and then I’ll show you what I mean by setting up the table.

This is just the information that we would need to be given. We know that we have some initial value problem, where we have y' = F(x,y). And then we have the initial condition. So, we know that if we plug in x=0, into the solution to the initial value problem, we would get out y=1. Since we know that in this example, we have y' = xy \ - x^2, that tells us right there that we’re going to have

$$F(x, y) = xy \ – x^2$$

To apply this Euler’s method formula, what we need to do is set this up in a table. And you can kind of think of this table like an Euler’s method differential equation calculator. I will show you how to use a computer to make this easier. But it is important to know how it works so that you can do it manually too.

How to Set Up the Euler’s Method Table

We’re going to need a few different columns in our table to keep track of all the calculations. We’re going to start with a column where we keep track of what n we’re on. We also need columns for our x_{n-1}, and our y_{n-1}.

Then we also want to calculate what we get when we plug into, our F(x_{n-1}, y_{n-1}) based on the F(x,y) we figured out already. Finally we are going to use all these pieces to figure out our y_n based on the formula discussed earlier from my study guide.

It really is just up to personal preference. If you don’t like keeping of all these columns, you don’t really have to. I like to break it down into the smallest possible pieces, and keep track of each individual piece so that you don’t get lost. I do this and recommend this for you because it’s really easy to get lost when you’re trying to keep track of all these different things.

I like to break it down into, at the smallest possible elements of this formula, and keep track of all those, so that when we put it all together, it’s a lot easier to figure out what’s going on. Doing this will give us the following columns to fill in.

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n

First we want to figure out what you need in the n column. The point that we’re given that we start at is, x=0. So we’re starting at y(0). And what we’re trying to estimate is y(1). That tells us using the given step size of 0.2, we’re going to start with x=0 and use Euler’s method to first estimate, what the y value is of this solution when x=0.2. Then we’re going estimate what the y value is when x=0.4, then 0.6, then 0.8, and finally when x=1.

To put it in a more formulaic approach, we would take our ending x value minus the starting x value and divide by the step size.

$$n=\frac{x_n – x_0}{step \ size}=\frac{1-0}{0.2}= 5$$

Well, doing this, is going tell us that we need five steps to get from our starting point to our end. So our n column will have one, two, three, four, and five, because that would represent the five, individual steps that we have to take to get up to x=1 from x=0.

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
1
2
3
4
5

How to Apply Euler’s Method

Now that we have set up our table, we can start applying Euler’s Method to fill the table out. First of all, we need to start with the x and y value that you’re given. We know when x=0, y=1. So you’re just going to start with those in the n=1 row and the x_{n-1} and y_{n-1} columns.

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
101
2
3
4
5

Then what you can do, is plug these two numbers, x=0 and y=1 into the function that we figured out earlier.

$$F(x, y) = xy \ – x^2$$

$$F(0, 1) = (0)(1) \ – (0)^2 = 0$$

And this will go in the F(x_{n-1}, y_{n-1}) column.

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
1010
2
3
4
5

Now with this final column here, y_n, what we can do is use this formula that we have here, which is on my calculus two study guide. This will use the previous columns along with our given step size of 0.2, which is denoted by h.

$$y_n = y_{n-1}+hF(x_{n-1},y_{n-1})$$

$$y_1 = 1+(0.2)(0) = 1$$

And then we can put this in our final column of this first row.

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
10101
2
3
4
5

Now that we figured out this, we can just carry this piece down into the next column. Whatever your previous y_n was, is just gonna be your y_{n-1} in the next column.

To figure out your next x_{n-1}, all you have to do is take your previous x_{n-1} and just add whatever your step size is. In this case, our step size is 0.2. We’re just going get 0.2 for x_{n-1} in the second row of our table. Doing both of these will give us:

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
10101
20.21
3
4
5

Now Repeat This Process a Few Times

Once you fill out your entire first row, then get the x_{n-1} and y_{n-1} in your second row, the only thing to do is repeat this process. You will now plug in these two x and y values into the F(x_{n-1}, y_{n-1}) to get the value in the third column. Then plug those into the formula for y_n to get the forth column. Then figure out the x_{n-1} and y_{n-1} in your third row and continue repeating until your table is full and all 5 rows are filled out. Doing this should leave you with this:

nx_{n-1}y_{n-1}F(x_{n-1}, y_{n-1})y_n
10101
20.210.161.032
30.41.0320.25281.08256
40.61.082560.2895361.140467
50.81.1404670.2723741.194942

So, after we iterate through this process, all the way up to n=5, we end up getting in 1.194942 in our y_n column. And that should be the answer that they wanted us to find because that should estimate y(1).

How to Apply Euler’s Method in Excel

Turns out, you can also do these Euler’s method problems using Excel or any other spreadsheet software. And it’s a lot easier and faster than doing it by hand. Watch the videos below to see how you can do this yourself to create an Euler’s method calculator to apply Euler’s method in Excel. And don’t forget to get yourself a copy of my integral calculus cheat sheet to help make the rest of your homework and exams easier and smoother!