Flow and Dynamics in NBA games - Part III

A look from 2001 to now

Posted by Thomas Vincent on June 29, 2015

In part I and II of this post series on NBA game dynamics, I explored both the average score differential and proportion of time spent in the lead for each NBA team. Interestingly, this proved to not be a very reliable proxy for overall performance and number of wins accrued over an entire season. To continue, I decided to look at scoring streaks patterns. Here, I simply extracted and averaged the maximal scoring streaks that teams achieved during the course of a full season. Given that my data was stored in a datatable in the following format:

 
GAME_ID      YEAR HOME    AWAY    QUARTER TIME   SCORE seconds away  home   score
                  TEAM    TEAM                         (in s)  score score  diff
201310290IND 2014 Indiana Orlando 1       11:39.0 0-0   21     0     0      0
201310290IND 2014 Indiana Orlando 1       11:30.0 0-2   30     0     2      2
201310290IND 2014 Indiana Orlando 1       11:15.0 0-2   45     0     2      2
201310290IND 2014 Indiana Orlando 1       11:14.0 0-2   46     0     2      2
201310290IND 2014 Indiana Orlando 1       11:03.0 0-2   57     0     2      2

The actual function that I used to find the longest streak was:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
'find_longest_streak' <- function(vec) {
  streaks <- c()
  current <- 0
  for(i in 2:length(vec)) {
    if(abs(vec[i]) >= abs(vec[i-1])) {
      current <- current + (abs(vec[i]) - abs(vec[i-1]))
    }
    else{
      streaks <- c(streaks, current)
      current <- 0
    }
  }
  return(max(streaks))

Using the above, I looked at scoring streaks for teams playing at home and away over the course of the 2001-2014 seasons. The heatmap below, generated using the d3heatmap R library shows the average maximal scoring streak per game for teams playing at home. This shows that the LA Clippers is the team that goes on the longest scoring streaks. What is most intriguing is that scoring streaks appear to be longer now than they were perhaps 10 years ago.

Average maximal scoring streak per game for teams playing at home

The same observation holds for lead propensity scores of teams playing away: scoring streaks appear to be longer now than they were perhaps 10 years ago.

Average maximal scoring streak per game teams playing away

Finally, we can look at the differential in average maximal scoring streak per game when teams play at home or away.

Difference in maximal scoring streaks per game when playing at home and away