There’s a hole in the draft lottery coverage that’s been bothering me. You’ll often see a chart like the one here or here, which shows the odds each team has of winning a certain pick.[1] These charts don’t account for any trades or pick swaps, though, and this year that makes a big difference. There are several trades that have yet to pan out, with not just picks that are completely owned by a new team, but also conditional moves, which only happen if a pick is above a certain threshold, or swap rights that are only exercised if one team’s pick is better than the other’s. The published tables out there do a good job of showing the odds of each team ending in each spot before all these swaps shake out, but to my knowledge nobody has published odds that account for these swaps.[*]

Here’s a list of the trades that may affect lottery picks in the 2016 lottery, in roughly increasing order of how messy it is to apply them:

Boston has Brooklyn’s pick.

Toronto has New York’s pick.

Phoenix has Washington’s pick, if that pick ends up outside of the top 3.

Chicago has Sacramento’s pick, if it ends up outside of the top 10.

Philadephia has the Lakers’ pick, if it ends up outside of the top 3.

Denver has the right to swap picks with Toronto (for the pick they got from New York).

Philadelphia has the right to swap picks with Sacramento.

Got all that? Some of this is pretty simple to apply directly using the simple chart above. What are the odds Philly ends up with the Lakers’ pick? Just take the probability that L.A. gets 4th or 5th. But some are much harder to figure out. What are the odds that Sacramento gets to keep a top-3 pick after the swap, because both they and Philly won the lottery? What are the odds that Philly gets both the 1st and 4th pick? Since the probability of Philly getting a top-3 pick and LA failing to do so is not independent, this is not straightforward to calculate.

To solve this problem, I wrote a script to calculate the odds of each lottery outcome:

The script works by finding the probability of each three-team order at the top of the lottery. There are 14*13*12, or 2184 different permutations for the top 3 picks, after which the rest of the draft is filled out in order. Of course, not all of these permutations are equally likely: the most likely is PHI-LAL-BOS, which has a probability of 250/1000 for the first pick * 199/ 750 for the second pick, given that the first pick went to Philly * 156 / 551 for the third pick, given that the first two picks went to Philly and LA. Multiply that all together and you get a 1.88% chance of those being the top 3 picks in that order.[**] Repeat this process for all 2184 permutations, and you have a list of draft orders and corresponding probabilities, which sum to 1. For each permutation, I find the resulting final draft order, applying all relevant trades. I then take each team’s draft spot in that case, and add the probability of that permutation occurring to that team’s probability of getting that draft spot. So in the above example, the PHI-LAL-BOS permutation would boost Philly’s chance of the #1 pick by 1.88%, and likewise for the Lakers’ chance at #2 and so on all the way down to #14. Adding these together over every permutation gives the probability for each team of getting each pick.

The output of the program is here:[2]

(static image)

This allows us to see the probability each team gets each spot, after applying pick swaps. Here we can see that Philly actually has a .26.9% chance of getting the first pick, and 67.7% chance of getting a top-3 pick. Denver also gets a boost to its lotto odds, while Toronto and Sacramento have small but non-negligible odds of getting a top-3 pick.

I did want to go a bit further on one case in particular. The 76ers have their eye on not just their own pick but also the Kings’ pick and the Lakers’ pick. While it’s simple enough to calculate the odds they get the Lakers’ pick at #4 or the odds they win the lottery and get the 1st pick, all of these scenarios are connected, as Philly or Sacramento winning the lottery makes it more likely that the Lakers fail to do so. This means those probabilities shouldn’t be assessed entirely separately. It ends up being a bit complex to draw out the likelihood of each possible outcome for the 76ers. (Also, this draft is one of the only things their fans have been looking forward to all season. Might as well get the math right for them.) Here’s a pie chart showing the relative likelihood of each distinct outcome: [3]



This shows that there’s about a 14% chance Philly gets both the first pick *and* the Lakers pick, and about another 11% they get the 2nd pick along with the Lakers pick. On the other hand, there’s a 21.7% chance Philly gets the double-whammy of failing to move up, and not receiving the Lakers’ pick, either, leaving them stuck with only the 4th pick and nothing else. All in all, though, this chart looks like reason for optimism for a fanbase that could certainly use some: they’re more likely to win the 1st pick than end up with only the 4th pick.

Footnotes:

1. For those who are not familiar with how the NBA lottery works: they have a machine with 14 balls, numbered 1 to 14. 4 balls are drawn from the machine, and the order does not matter. The number of possible combinations is then 14 choose 4, or 14!/(10! * 4!) = 14*13*12*11/24 = 14 * 13 * 11 / 2 = 7 * 13 * 11 = 1001 combinations. One of those combinations is thrown out (if it occurs, you re-draw), leaving 1000 combinations to be distributed among the teams. The team with the worst record gets 250 of them, the second-worst 199, and so on in decreasing fashion, with the 14th team only getting 5. In case of a tie in record, teams split their total number of combinations evenly, with a coin flip to decide who gets the one leftover one if the sum is odd.

The NBA draws one combination of 4, and the team who owns that combination receives the 1st pick. They then reshuffle the balls and draw another combination, awarding the team with that combination the second pick. If the team that owns the just-drawn combination had already won a previous pick, they ignore that draw and try again to determine who will receive the 2nd pick. This process repeats until the top 3 picks are determined. After that, the remaining picks are distributed in ascending order of record to the teams that did not get a top-3 pick.

2. Note the difference between .000 and 0. .000 is used for cases that are possible, but the probability of them occurring was less than one in 5,000. 0 is used for cases that literally have no outcomes leading to them.

3. Raw data for the pie chart is here.

* EDIT: u/kramerDSP on r/sixers has pointed out the existence of lotterybucket.com to me. It does have a very similar chart, and some other great functionality. I’ll add it to my list of bookmarks! Keeping this post available in case the source code is useful, and because I think the pie chart of outcomes for Philly is a useful way to look at the data that isn’t available there.

** EDIT 2: A previous version of this post had an incorrect multiplication here. It’s been fixed now. Thanks to Aaron Barzilai for pointing it out.