With the NBA season about to restart, someone wrote in an online discussion that it feels like it’s always the same teams reaching the postseason every year. With few exceptions, I haven’t followed many seasons closely since the late 1990s, but I did share that feeling. This somehow led me to try and work out how often teams are reaching the postseason in consecutive years using readily available data.
To address this, I transcribed playoff series data from 1992-2020 from the Basketball Reference website, and tried out some set intersects.
This post walks through applying intersects across consecutive pairs of list elements, using the 16 teams (8 per conference) that reach the NBA playoffs each season in relation to the year prior. The following code should be fully reproducible.
First we load the necessary libraries, read the data, pivot from wide to long, and clean up the loose ends.
Resulting in a tidy, long format dataset with seasons, conference, and teams:
Now, we can use dplyr::group_split to split the grouped data into a list of vectors.
A quick intersect (Reduce(intersect, allTeamsSeasons)) of all the list elements shows us that no single team has made the playoffs in all the years considered (some of the franchises haven’t even existed for that long).
Because the set of 16 teams that make the playoffs can vary each year, I used a pivoting approach to get all combinations of seasons and teams, including NA values when a team didn’t qualify.
With this long-format tibble we can already draw a faceted bubble chart to track how individual teams are doing across the whole study period, and this should correspond to what we get when intersecting consecutive list elements.
Looks good, even with minimal customization.
Now, we can split the grouped data for each conference into lists.
… and then apply an intersect over consecutive pairs of list elements with a nifty mapply approach that relies on indices.
We can now count which teams in a given season also played in the previous years’ postseason.
The resulting long-format tibble is also ready for plotting.
We and plot these data as line chart with an EKG feel to it using splines from ggalt.
This output checks out with the bubble chart.
At first glance:
Lots of playoff appearances by the Spurs.
More teams in the West reappearing in consecutive seasons.
Long gaps without playoffs for several franchises.
Same eight teams in the East played in 2011 and 2012.
I’ll try to update the post for 2020 once the seeds are defined.