In this project, we will delve into the NBA 2022/23 data set to uncover insights into player performance trends. The data set includes a range of Variables that offer a thorough understanding of player statistics. These variables include points, rebounds, assists, field goal percentage and more. The data was collected from official NBA statistic repositories. Basketball is apart of my life daily by either playing, watching or having conversations about it, so picking this topic was very easy.
We are doing a graph of a point guards assists to turnovers
# Perform linear regressionmodel <-lm(AST ~ TOV, data = AnT_only)# Summarize the regression modelsummary(model)
Call:
lm(formula = AST ~ TOV, data = AnT_only)
Residuals:
Min 1Q Median 3Q Max
-2.9960 -0.7026 -0.1100 0.4048 4.7982
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.6100 0.3871 1.576 0.124
TOV 1.9918 0.1930 10.321 3.68e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.501 on 35 degrees of freedom
Multiple R-squared: 0.7527, Adjusted R-squared: 0.7456
F-statistic: 106.5 on 1 and 35 DF, p-value: 3.684e-12
ggplot(AnT_only, aes(x = AST , y = TOV)) +geom_point() +geom_smooth(method ="lm", se =FALSE) +labs(x ="AST", y ="TOV", title =" NBA Point Guard's Assists to Turnovers")
`geom_smooth()` using formula = 'y ~ x'
Model
Equation
The equation for the relationship between assists (AST) and turnovers (TOV) of NBA point guards can be expressed as:
TOV = 0.6100 + 1.9918×AST.
P-Value
The p-value is very small (3.68e-12)
Adjusted R squared
The adjusted R-squared value is 0.7456
Analysis
The coefficient for assists is highly significant, suggesting that for each unit increase in assists, turnovers increase by approximately 1.9918 units on average. The adjusted R-squared value explains a significant portion of the variability in turnovers. The small p-value indicates that the overall model is statistically significant.
filtering data
# filtering for the average field goal percentage for each teamFGP <- nba.stats %>%group_by(Tm) %>%summarize(average_Value =mean(FG., na.rm =TRUE))view(FGP)
Who was the most efficient team during the Playoffs
library(plotly)
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
# making a color set# Generate random colors for each barcolors <-rainbow(nrow(FGP))
# Create interactive bar chart with Plotlyplot_ly(FGP, x =~Tm, y =~average_Value, type ="bar", marker =list(color = colors, line =list(color ="black", width =1))) %>%layout(title ="Teams Efficiency During the Playoffs",xaxis =list(title ="Team"),yaxis =list(title ="Percentage"),legend =list(title ="Teams", orientation ="h", x =0.5, y =-0.2))
This is an interactive bar chart where each bar represents a team that made it to the playoffs. Each team was assigned a random color from the rainbow. The bar chart describes each teams’ efficiency. As a result we can see that the Boston Celtics were the most efficient team during the playoffs.
Who were the best offensive players during the playoffs
# filtering for players who average over 25 points and 6 assistsBOP <- PnA %>%filter(AST >6, PTS >25)
# creating an interactive scatterplotplot_ly(data = BOP, x =~PTS, y =~AST, text =~paste("Player:", Player, "<br>Team:", Tm),color =~Player, mode ="markers", showlegend =TRUE) %>%layout(title ="Best Offensive Players",xaxis =list(title ="Points"),yaxis =list(title ="Assists"),legend =list(title ="Players"),annotations =list(x =1, y =0,xref ="paper", yref ="paper",text ="Data Source: Basketball Reference",showarrow =FALSE ))
No trace type specified:
Based on info supplied, a 'scatter' trace seems appropriate.
Read more about this trace type -> https://plotly.com/r/reference/#scatter
This is a scatter plot of points vs assists. In basketball, points and assists are used to judge how good a player is offensively. In The NBA if you average more than 25 points you are considered an elite scorer. At the same time if you average more the 6 assists you are considered a great passer. As you can see above, only six players fell under the category of averaging more than 25 points and 6 assists simultaneously.
What Position played the best defense during the playoffs
# grouping by position and finding the average block and steals for each positionaverages <- SnB %>%group_by(Pos) %>%summarize(avg_blocks =mean(BLK),avg_steals =mean(STL))
# Create the interactive area plotplot <-plot_ly(data = averages, x =~avg_steals, y =~avg_blocks, type ='scatter', mode ='markers',color =~Pos, colors ='Set1', marker =list(size =10),hoverinfo ='text',text =~paste("Steals: ", avg_steals, "<br>Blocks: ", avg_blocks, "<br>Position: ", Pos)) %>%layout(title ="Steals vs Blocks by Position",xaxis =list(title ="Steals"),yaxis =list(title ="Blocks"),legend =list(orientation ="h",x =1,y =1.05,bgcolor ="rgba(255, 255, 255, 0)",bordercolor ="rgba(255, 255, 255, 0)" ))# Display the plotplot
This is an area plot of steals vs blocks by position. Steals and blocks are the metrics used to judge a player defensively. For this plot I decided to group the players by their position.
Conclusion
Within the dynamic world of professional basketball, the NBA is a shining example of skill, thrill, and rivalry. The NBA season of 2022–2023 was no different, with players showing off their skills every night and teams fighting for the championship. This short essay delves into the world of NBA statistics, examining insights obtained from player performance data visualizations from the 2022–2023 season.
The NBA playoffs data set for 2022–2023 was subjected to statistical analysis by the basketball analytics website FiveThirtyEight, which identified important trends and insights. Their research indicated that teams with excellent defensive measures had a considerable edge in postseason success, such as defensive rating and opponent field goal %. Further highlighting the significance of individual contributions to overall success was the effect that player efficiency measurements, such as effective shooting percentage (eFG%), had on team performance (“FiveThirtyEight’s NBA Predictions” - FiveThirtyEight, May 2023).
Even while the assist and turnover visualization provides insightful information, there are still certain areas that might be improved or investigated more. For example, adding more contextual data on opponent strength or game circumstances (home vs. away, key moments) could help to better understand the dynamics of player performance. To conclude, this was by far the most fun I have had doing the project as basketball is my favorite sport.