True 2019 NBA Lottery Odds

Every year the NBA draft lottery takes place in May and every year websites race to get up probabilities of which team has the probability to get a certain spot within the lottery. Many times, unfortunately, these sites forget about trades and instead of conveying the probabilities to the truth, the trades are instead wasted away in series of notes, effectively telling the reader to “figure it out, dummy.” So, how do we figure out the true probabilities of a team obtaining a particular pick?

Two years ago, I posted a basic algorithm that counts every probability of every pick without any trades. This algorithm is able to easily recreate the table we find in Wikipedia, and other sites, when it comes to finding a probability matrix for teams:

Screen Shot 2019-04-30 at 11.45.54 AM

NBA Draft lottery odds from Wikipedia (April 30th, 2019).

Using our aforementioned post, I was able to reconstruct the entire draft lottery algorithm and produce this table within five minutes. Sweet! The code still works! However, these are not the true probabilities for each team thanks to trades made over the previous years. Therefore, other tables that we find on sites like ESPN, HoopsRumors, and even Wikipedia post the incorrect probabilities:

In all cases the trades were either hyperlinked or stuffed within text, forcing the reader to search for context. This season, the trades are rather tame as there are no “pick swap” trades: trades where a team gets the “better” of two picks, contained within the lottery. The closest we get is the Sacramento to Philadelphia/Boston pick swap. Due to this tameness, teams effectively trade probabilities. So we can give a pass to the Sacramento Kings having a 1% chance of obtaining the first pick. In reality, it’s zero as Philadelphia owns their number one pick.

This is okay, but it requires the reader to search.

But what about Atlanta? Atlanta actually has a 47.02% chance of obtaining the 9th overall pick. That’s thanks to the Trae Young – Luka Doncic draft night deal. And while Dallas has asterisks next to their odds, it’s Atlanta that doesn’t have any indication.

Similarly, Boston has two trades lingering in the draft. They have interesting probabilities floating about the table as well. But that’s not readily apparent either. So let’s incorporate the trades and then update this table. Thanks to Real GM, we are able to turn these trades into code.

Trade #1: Atlanta Gains 6-14 From Dallas

From the draft night trade in the 2018 Draft, the Atlanta Hawks managed to move down in the draft in order to allow Dallas to guarantee the rights to Luka Doncic. In order to complete this trade and incentivize Atlanta moving down in the lottery, Atlanta gained a pick-protected lottery pick for this season. That is, if Dallas falls between the 6th and 14th picks, Atlanta gains the Mavericks’ lottery pick. We can represent this code (using the variables from our previous lottery odds post) as:

Screen Shot 2019-04-30 at 12.16.36 PM

Atlanta is listed as 5th in the lottery and Dallas is listed as 9th per the NBA. Therefore, under Python indices, they are 4th and 8th, respectively.

As a reminder: remainingProbs is a fixed-draw double array that simply aligns the teams that were not selected in the first four picks. There are a total of ten of these positions: picks 5 through 14. Since pick 5 is protected, we count the last nine spots.

Trade #2: Boston Gains 9-14 From Memphis

On January 12, 2015 a three-team trade involving five players and three draft picks took place between the Boston Celtics, Memphis Grizzlies, and New Orleans Pelicans. In this trade, Memphis sent Tayshaun Prince to Boston and Quincy Pondexter to New Orleans. In return, New Orleans sent Russ Smith and a traded player exception to Memphis and Boston sent Jeff Green (the centerpiece of the deal) to Memphis. In the process, Boston also obtained Austin Rivers from New Orleans.

To soften the loss of Green, Memphis included a protected future first round pick to Boston. Similarly, to help address the loss of Rivers from New Orleans Memphis included a second round pick to the Pelicans. This season, that first round pick comes into play as Memphis is slotted as the 8 team; with highest probability of keeping their pick. Despite this, Boston still has a significant chance of nabbing the Memphis pick, provided Memphis hits that unlucky 42.6% chance of getting the 9th, 10th, or 11th pick in the draft.

Due to the straightforward nature of the trade, we can easily code this as:

Screen Shot 2019-04-30 at 12.17.25 PM

Memphis is listed as 8th in the lottery per the NBA. Therefore, under Python indices, they are 7th. Boston is not in the lottery, they are the first new team: 14.


Trade #3: Philadelphia Gains Future First From Sacramento

Known as the “Stauskas Trade” back on July 9, 2015, the Sacramento Kings shipped Nik Stauskas, Carl Landry, Jason Thompson, and two future first round picks for the rights to Arturas Gudaitis and Luka Mitrovic. The move for the Kings was essentially to clear cap space for the 2015-16 NBA season in an attempt to Rajon Rondo, Marco Belinelli, and Kosta Koufos.  For the future first round draft picks, a series of pick protections were placed on the 2017 and 2018 draft picks. If those protections were satisfied for Sacramento, then Sacramento’s 2019 first round draft pick went to Philadelphia.

In those years, theKings managed to keep their picks.

Despite this…

Trade #4: Boston Gains Sacramento’s 2-14 Pick From Philadelphia

…on June 19th, 2017 the Philadelphia 76ers traded their rights to Sacramento’s 2019 first round pick to the Boston Celtics when they made the move from 3rd in the 2017 draft to 1st. It was part of a conditional trade where Boston gained the 2019 Sacramento pick as long as the Los Angeles Lakers’ 2018 Draft pick landed between 2nd and 5th. That draft pick landed 10th and Boston become owner of Sacramento’s 2019 Draft Pick, protected as number one.

To this end, we code this trade as:

Screen Shot 2019-04-30 at 12.32.23 PM.png

Combined both trades into one and set Philadelphia as Team 15.


Resulting Probabilities

Applying these trades as a Python script, we are able to generate the probabilities for every team in the draft of obtaining a lottery pick:

Screen Shot 2019-04-30 at 12.34.02 PM.png

Here, we see Sacramento is completely wiped off the map. Here we also see the updated probabilities for Atlanta as well as the illustrated potential of Memphis possibly losing their pick.

This year is a relatively straightforward year when it comes to lottery trades. But at least know how to handle them within our code, as we can visually see everyone’s probabilities. Come May 14th, you now know the true probabilities for your team.


Disclaimer: Please be Cool

Over the recent year or so, I’ve been touched upon by two NBA Analytics team Directors about this particular problem: constructing NBA lottery probabilities. The reason is this: Both teams used this problem as an applicant test problem to better understand the applicant’s thought process and coding capabilities. In both instances, reviewers noticed an all-too eery duplication in vastly different applicants. The reason? Code was copied here and passed off as their own. Both times I was given evidence. Not cool.

The purpose of this site is to introduce concepts and some basic coding principles to help folks learn the basics. Posts with code are meant for folks with remedial-or-beginner capabilities in coding to give them a nudge in testing out ideas on their own. Posts without code are for the more sophisticated readers to understand the thought process and theory; even to just open a small discussion.

However, if this trend continues, the amount of code that appears on the site or becomes available by other means will start to disappear rapidly. So, for benefit of the people that enjoy this site, just be cool and do it on your own.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.