Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In part I of this post series on NBA game dynamics, I explored the average score differential that teams faced over the course of games. 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 lead propensity, which measures the proportion of time during which a team is in the lead. More formally, this is defined as:

where $T$ is the total number of seconds played during NBA game, $D$ is the score difference defined as $D = S_{t} - O_{t}$, with $S_{t}$ and $O_{t}$ being the scores at time $t$ for the home and away team, respectively, and where $\mathbf{1}_0(D)$ is the indicator function such that:

Using the definition above, I looked at lead propensity scores for teams playing at home and away over the course of 2001 to 2014. The heatmap below, generated using the newly-released (and awesome) d3heatmap R library, shows the percentage of time during which each was in the lead when playing at home. Again, we see that the Antonio Spurs is the most consistent team between 2001-2014. It is also interesting to observe how the amount of time in a game that teams spend in the lead is directly related to how well they performed during the season. Most teams with lead propensity scores at home ended doing very long runs in the playoffs during that year.

#### Lead propensity scores for teams playing at home

The same observation holds for lead propensity scores of teams playing away. Again, San Anotnio remains a consistently excellent team, and strong lead propensity scores when playing away is synonymous with deep playoff runs during that given season.

#### Lead propensity scores teams playing away

Finally, we can look at the differences in lead propensity scores when playing at home and away.