Team turnover measures year-over-year movement among the NBA’s strongest teams. In this analysis, churn counts teams entering the top eight in regular-season wins after missing that group the previous season. section 18.5 section 18.5.2
Prepare the churn dataset by deriving comparable team-season indicators:
- Copy the records data into churn and remove postseason asterisks from Team names with gsub(). section 18.5.1
- Group by Season and rank teams by descending regular-season wins, assigning tied win totals the same average rank. section 18.5.1
- Mark ranks 1 through 8 with topTeam = 1 and all lower-ranked teams with topTeam = 0. section 18.5.1
- Arrange each team’s seasons from newest to oldest and use lead() to create topTeam2, representing its prior-season status. section 18.5.1
- Count records where topTeam exceeds topTeam2, then retain the TRUE counts as annual turnover. section 18.5.2
Reading a turnover count
If a season records three teams with topTeam = 1 and topTeam2 = 0, three new teams entered the top eight compared with the preceding season. A line chart can compare these counts before and after the salary cap introduced before 1984–85. section 18.5.2
p7 <- ggplot(churn_tbl, aes(x = Season, y = n, group = 1)) +
geom_line(aes(y = n), color = "black", size = .5) +
geom_point(size = 5, color = "orange") +
labs(title = "Year-over-Year Churn in the NBA's Top 8",
subtitle = "1971-98",
x = "Season",
y = "Number of New Top 8 Teams from Prior Season",
caption = "salary cap was introduced prior to the 1984-85 season") +
ylim(0, 6) +
theme(plot.title = element_text(face = "bold")) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
geom_smooth(method = lm, color = "red", se = FALSE,
data = churn_tbl[as.character(churn_tbl$Season) <
"1984-85",]) +
geom_smooth(method = lm, color = "red", se = FALSE,
data = churn_tbl[as.character(churn_tbl$Season) >
"1983-84",]) +
annotate("rect", xmin = "1971-72", xmax = "1983-84",
ymin = 0, ymax = 6, alpha = 0.1, fill = "blue") +
annotate("rect", xmin = "1984-85", xmax = "1997-98",
ymin = 0, ymax = 6, alpha = 0.1, fill = "green")
print(p7)
Inspect the ggplot2 construction for the year-over-year top-eight churn chart, including pre- and post-salary-cap trend lines. section 18.5.2
