※ 当サイトは、アフィリエイト広告を利用しています。

データで見るサンアントニオ・スパーズの特徴と傾向【NBA2015-16 レギュラー・シーズン】

記事内に広告が含まれています。
スポンサーリンク

※参考<統計ソフトRに入力するコマンド>

 統計ソフトRのインストール手順をまとめた記事も作成していますので、よろしければご参考ください。

library(BasketballAnalyzeR)
library(gridExtra)
library(dplyr)
Pbox1516 <- read.csv(file="Pbox_1516.csv")
dts.PbP.1516 <- read.csv(file="PbP_1516.csv")
PbP1516 <- PbPmanipulation(dts.PbP.1516)

# Bubble plot of the players
Pbox1516b <- subset(Pbox1516, MIN>=500)
data1516b <- subset(Pbox1516b, Team=="San Antonio Spurs")
attach(data1516b)
X2 <- data.frame(P=Player, P2M=P2M/GP, P3M=P3M/GP, FTp, AS=(P2A+P3A+FTA)/GP)
detach(data1516b)
labs1 <- c("2-point shots made per Game", "3-point shots made per Game", "free throws (% made)", "Total shots attempted per Game")
bubbleplot(X2, id="P", x="P2M", y="P3M", col="FTp", size="AS", labels=labs1, title="Bubble plot of San Antonio Spurs' players: Shooting stats and shots attempted (NBA 2015 - 2016 Regular season)", text.size=3.5, mx = mean(Pbox1516b$P2M/Pbox1516b$GP), my = mean(Pbox1516b$P3M/Pbox1516b$GP))

attach(data1516b)
Y2 <- data.frame(P=Player, DREB=DREB/GP, STL=STL/GP, BLK=BLK/GP, PM=PM/GP)
detach(data1516b)
labs2 <- c("Defensive Rebounds per Game", "Blocks per Game", "Plus-Minus per Game", "Steals per Game")
bubbleplot(Y2, id="P", x="DREB", y="BLK", col="PM", size="STL", labels=labs2, title="Bubble plot of San Antonio Spurs' players: Defensive stats and Plus-Minus (NBA 2015 - 2016 Regular season)", text.size=3.5, mx = mean(Pbox1516b$DREB/Pbox1516b$GP), my = mean(Pbox1516b$BLK/Pbox1516b$GP))

# Radar chart of the players
Pbox1516r <- subset(Pbox1516, MIN>=500)
attach(Pbox1516r)
T <- data.frame(P2M,P3M, FTM, REB=OREB+DREB, AST, STL, BLK)/MIN
detach(Pbox1516r)
T2 <- data.frame(Team=Pbox1516r$Team, Player=Pbox1516r$Player, T)
listplots <- radialprofile(data=T2[3:9], title=T2$Player, std=TRUE)
listplotsT <- listplots[T2$Team=="San Antonio Spurs"]
grid.arrange(grobs=listplotsT[1:15], ncol=5)

# Variability diagram of the traditional stats
Pbox1516v <- subset(Pbox1516, Team=="San Antonio Spurs" & MIN>=500)
vrb <- variability(data=Pbox1516v, data.var=c("P2M", "P3M", "FTM", "OREB", "DREB","AST","STL","BLK","TOV"), size.var=c("MIN"))
plot(vrb, title="Variability diagram of the traditional stats, San Antonio Spurs' players (NBA 2015 - 2016 Regular season)")

# Shot chart of the team
PbP1516sc <- subset(PbP1516, data_set!="2015-16 Playoffs" & team=="SAS")
PbP1516sc$xx <- PbP1516sc$original_x/-10
PbP1516sc$yy <- PbP1516sc$original_y/10-41.75
shotchart(data=PbP1516sc, x="xx", y="yy", z="playlength", num.sect=5, type="sectors", scatter=FALSE, result="result")
shotchart(data=PbP1516sc, x="xx", y="yy", type="density-hexbin", nbins=50, palette="bwr")

# Density estimation of the field shots
data1516d <- subset(PbP1516, data_set!="2015-16 Playoffs" & result!="" & shot_distance!="" & team=="SAS")
densityplot(data=data1516d, shot.type="field", var="shot_distance", best.score=TRUE, title="Density estimation of the field shots of San Antonio Spurs, with respect to shot distance (NBA 2015 - 2016 Regular Season)")
densityplot(data=data1516d, shot.type="field", var="totalTime", best.score=TRUE, title="Density estimation of the field shots of San Antonio Spurs, with respect to total time (NBA 2015 - 2016 Regular Season)")
densityplot(data=data1516d, shot.type="field", var="playlength", best.score=TRUE, title="Density estimation of the field shots of San Antonio Spurs, with respect to play length (NBA 2015 - 2016 Regular Season)")

# Expected points of the teams
data1516t <- subset(PbP1516, data_set!="2015-16 Playoffs" & result!="" & shot_distance!="" & team=="SAS")
data1516o <- subset(PbP1516, data_set!="2015-16 Playoffs" & result!="" & shot_distance!="" & oppTeam=="SAS")
data1516t <- mutate(data1516t, player = "San Antonio Spurs")
data1516o <- mutate(data1516o, player = "Opponent teams")
data1516TO <- bind_rows(data1516t, data1516o)
pl <- c("San Antonio Spurs","Opponent teams")
mypal <- colorRampPalette(c("purple","red","red"))
expectedpts(data1516TO, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="shot_distance", xlab="Shot distance", title="Expected points of San Antonio Spurs and opponent teams, with respect to shot distance (NBA 2015 - 2016 Regular Season)")
expectedpts(data1516TO, bw=1500, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="totalTime", xlab="Total time", title="Expected points of San Antonio Spurs and opponent teams, with respect to total time (NBA 2015 - 2016 Regular Season)")
expectedpts(data1516TO, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="playlength", xlab="Play length", title="Expected points of San Antonio Spurs and opponent teams, with respect to play length (NBA 2015 - 2016 Regular Season)")

# Network of assists
PbP1516an <- subset(PbP1516, data_set!="2015-16 Playoffs" & team=="SAS")
PbP1516AN <- PbP1516an[!(PbP1516an$event_type=="shot" & PbP1516an$result=="missed"),]
netdataAN <- assistnet(PbP1516AN)
plot(netdataAN, layout="circle", edge.thr=20, node.col="FGPTS", node.size="ASTPTS")
TABan <- netdataAN$assistTable
Xan <- netdataAN$nodeStats
names(Xan)[1] <- "Player"
dataAN <- merge(Xan, Pbox1516, by="Player")
dataANsp <- subset(dataAN, Team=="San Antonio Spurs")
mypal <- colorRampPalette(c("blue", "yellow", "red"))
scatterplot(dataANsp, data.var=c("ASTPTS", "FGPTS"), z.var="MIN", labels=dataANsp$Player, palette=mypal, repel_labels=TRUE, title="Scatter plot of San Antonio Spurs' players: ASTPTS and FGPTS (NBA 2015 - 2016 Regular Season)")
selan <- which(dataAN$MIN>1500 & dataAN$Team=="San Antonio Spurs")
tabAN <- TABan[selan, selan]
no.pl <- nrow(tabAN)
pR <- pM <- vector(no.pl, mode="list")
GiniM <- array(NA, no.pl)
GiniR <- array(NA, no.pl)
for (pl in 1:no.pl){
      ineqplM <- inequality(tabAN[pl,], npl=no.pl)
      GiniM[pl] <- ineqplM$Gini
      ineqplR <- inequality(tabAN[,pl], npl=no.pl)
      GiniR[pl] <- ineqplR$Gini
      title <- rownames(tabAN)[pl]
      pM[[pl]] <- plot(ineqplM, title=title)
      pR[[pl]] <- plot(ineqplR, title=title)
      }

grid.arrange(grobs=pM, nrow=2)
grid.arrange(grobs=pR, nrow=2)

# Shot chart of the opponent teams
PbP1516sco <- subset(PbP1516, data_set!="2015-16 Playoffs" & oppTeam=="SAS")
PbP1516sco$xx <- PbP1516sco$original_x/-10
PbP1516sco$yy <- PbP1516sco$original_y/10-41.75
shotchart(data=PbP1516sco, x="xx", y="yy", z="playlength", num.sect=5, type="sectors", scatter=FALSE, result="result")
shotchart(data=PbP1516sco, x="xx", y="yy", type="density-hexbin", nbins=50, palette="bwr")

# Density estimation of the field shots of the opponent teams
data1516do <- subset(PbP1516, data_set!="2015-16 Playoffs" & result!="" & shot_distance!="" & oppTeam=="SAS")
densityplot(data=data1516do, shot.type="field", var="shot_distance", best.score=TRUE, title="Density estimation of field shots of San Antonio Spurs' opponents, with respect to shot distance (NBA 2015 - 2016 Regular Season)")

⇐ 2014-15 |🏀| 2016-17 ⇒

※データ分析を実践する際に参考にしている書籍『Basketball Data Science: With Applications in R』の紹介記事も書いていますので、よろしければ下記よりご確認ください。

タイトルとURLをコピーしました