library(dplyr)
library(ggplot2)NBA Raptor Metric Analysis
Overview
The article chosen for this assignment was Introducing RAPTOR, Our New Metric For The Modern NBA. RAPTOR stands for Robust Algorithm (using) Player Tracking (and) ON/Off Ratings. It is a plus-minus statistic that measures the number of points a player contributes to his team’s offense and defense per 100 possessions relative to a league average player. RAPTOR is based exclusively on publicly available data. The data sets used can be found here. NBA Raptor Datasets.
The dataset that I used is the latest_RAPTOR_by_player.csv. In this assignment I am only interested in the Raptor stats on offense and defense and minutes played by each player, so I created a new data frame with only those columns. I also changed the name of the mp column to minutes_played.
Data Setup
Importing dplyr library and ggplot2
Reading the data from the csv file from Github.
urlfile<-'https://raw.githubusercontent.com/RDLong718/DATA607-Spring24/main/DATA607-Spring2024/Assignments/nba-raptor/latest_RAPTOR_by_player.csv'
latest_Raptor_by_player<-read.csv(url(urlfile))Creating new data frame with only the columns needed
nba_raptor <-
latest_Raptor_by_player %>%
select(player_name, raptor_offense, raptor_defense, raptor_total, mp)Changing mp variable to minutes_played
nba_raptor <- nba_raptor %>% rename(minutes_played = mp)View new column names
colnames(nba_raptor)[1] "player_name" "raptor_offense" "raptor_defense" "raptor_total"
[5] "minutes_played"
Analysis
The top 10 players with the highest Total Raptor Score with over 1000 minutes played. Leading the pack is Nikola Jokic with a total Raptor score of 13.2
nba_raptor %>%
arrange(desc(raptor_offense)) %>%
filter(minutes_played > 1000) %>%
head(10) player_name raptor_offense raptor_defense raptor_total minutes_played
1 Nikola Jokic 9.522496 3.6962402 13.218736 3112
2 Damian Lillard 9.282637 -1.4661401 7.816497 2107
3 Luka Doncic 8.272470 -0.4488619 7.823608 2391
4 Stephen Curry 7.483712 -1.1653177 6.318394 2434
5 Tyrese Haliburton 6.902477 -0.9967542 5.905722 1883
6 Devin Booker 6.044340 -0.4081086 5.636231 2294
7 Donovan Mitchell 5.843209 -1.1340204 4.709188 2639
8 Jalen Brunson 5.733473 -0.9604858 4.772987 2822
9 Kyrie Irving 5.614030 0.3538353 5.967865 2241
10 Jimmy Butler 5.529827 0.6870509 6.216878 3012
The relationship between the Raptor offense and defense metrics is shown in the scatter plot below. The plot shows that there is a positive correlation between the two metrics.
ggplot(nba_raptor, aes(x = raptor_offense, y = raptor_defense)) +
geom_point() +
geom_smooth(method = "lm", formula = y ~ x, se = FALSE) +
labs(title = "Raptor Offense vs Defense",
x = "Raptor Offense",
y = "Raptor Defense")Conclusion
I found it interesting in how the Raptor Metric works. Methodological Explainer. I would love to analyze the relationship between the Raptor Metric and other modern NBA metrics used. This would require reading in additional datasets and merging them together.
One thing I would update is some of the names of the variables. For instance the mp variable should be changed to minutes_played. The poss variable should be changed to possessions. This would make the data more readable and easier to understand.