The Toronto Raptors have, perhaps, their most difficult set of back-to-back games this season: playing at Golden State tonight after playing in Los Angeles against the Clippers on Tuesday to begin a difficult four-game western road trip. (Demolishing the Clippers by 24 points may help tonight in Oakland.)
Playing off the back-to-back theme, here’s how many times NBA teams are playing on back-to-back nights in the 2018-19 season:
Each segment of the bar shows a breakdown of order and location of the back-to-back games: home and home (H+H), home then road (H+R), road then home (R+H) and two on the road (R+R).
In the East:
- Toronto, Philadelphia and Brooklyn don’t have any back-to-backs where both games are at home.
- Miami (R+H) and Atlanta (H+R) are also missing a segment.
- Toronto, Miami and Atlanta also show up as the teams with the fewest back-to-back sets in the East (12).
- Washington, New York and Charlotte have the most (15).
In the West:
- Houston and Dallas don’t have any back-to-backs at home, although Dallas has eight games in which they have to play on the road the day after playing at home.
- Portland has a large number of road back-to-backs (8) but are among the group (with Phoenix, Oklahoma City and Houston) who have the fewest overall back-to-backs (12).
- Utah, Sacramento, the Clippers and Dallas have the most (14).
#Rstats and data science people I read and follow are staunch advocates of reproducible code. At the highest levels, reproducible code allows other scientists to confirm the findings of the original research. Reproducible science is solid science.
At less lofty levels, well-documented, reproducible code allows one to come back to a code file after time away and know exactly how the whole thing worked before.
This exercise turned into a good example of bad code.
In the course of setting up and running a daily simulation of the NBA season, I was interested in how playing on back-to-back nights affected a team’s chances of winning. The hardest part was going to be tagging games in which a team was playing for the second night in a row inside the master NBA schedule.
I was able to do this for the 2018-19 schedule, but other projects took me away from this one before I could run this code on other seasons’ schedules and then analyze the win-loss records of teams playing on back-to-back nights over a decent sample of seasons.
I came back to the code last week to produce the plots above. A recent Toronto Raptors broadcast had noted that the team was in a long period between having to play on consecutive nights, which ends tonight, as noted above.
Writing up this post to accompany the two plots above would have been a good opportunity to publish the code as well, as a record of accomplishment and an opportunity for someone else to look at it, run it, find flaws or offer suggestions on how to do it more efficiently.
Instead, the code, after a few weeks away, is the functional equivalent of a tangled string of Christmas lights. It’s not hopeless, but it’s going to take some time to fiddle with each knot to unlock the whole mess.
Hopefully, when I get it unravelled I can offer a look at the code and some additional insights.
Photo: Dzenina Lukac via Pexels.com