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

データで見るゴールデンステイト・ウォリアーズの特徴と傾向【NBA2007-08 レギュラー・シーズン】

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

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

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

library(BasketballAnalyzeR)
library(gridExtra)
library(dplyr)
Pbox0708 <- read.csv(file="Pbox_0708.csv")
dts.PbP.0708 <- read.csv(file="PbP_0708.csv")
PbP0708 <- PbPmanipulation(dts.PbP.0708)

# Bubble plot of the players
Pbox0708b <- subset(Pbox0708, MIN>=500)
data0708b <- subset(Pbox0708b, Team=="Golden State Warriors")
attach(data0708b)
X2 <- data.frame(P=Player, P2M=P2M/GP, P3M=P3M/GP, FTp, AS=(P2A+P3A+FTA)/GP)
detach(data0708b)
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 Golden State Warriors' players: Shooting stats and shots attempted (NBA 2007 - 2008 Regular season)", text.size=3.5, mx = mean(Pbox0708b$P2M/Pbox0708b$GP), my = mean(Pbox0708b$P3M/Pbox0708b$GP))

attach(data0708b)
Y2 <- data.frame(P=Player, DREB=DREB/GP, STL=STL/GP, BLK=BLK/GP, PM=PM/GP)
detach(data0708b)
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 Golden State Warriors' players: Defensive stats and Plus-Minus (NBA 2007 - 2008 Regular season)", text.size=3.5, mx = mean(Pbox0708b$DREB/Pbox0708b$GP), my = mean(Pbox0708b$BLK/Pbox0708b$GP))

# Radar chart of the players
Pbox0708r <- subset(Pbox0708, MIN>=500)
attach(Pbox0708r)
T <- data.frame(P2M,P3M, FTM, REB=OREB+DREB, AST, STL, BLK)/MIN
detach(Pbox0708r)
T2 <- data.frame(Team=Pbox0708r$Team, Player=Pbox0708r$Player, T)
listplots <- radialprofile(data=T2[3:9], title=T2$Player, std=TRUE)
listplotsT <- listplots[T2$Team=="Golden State Warriors"]
grid.arrange(grobs=listplotsT[1:12], ncol=4)
grid.arrange(grobs=listplotsT[13:24], ncol=4)

# Variability diagram of the traditional stats
Pbox0708v <- subset(Pbox0708, Team=="Golden State Warriors" & MIN>=500)
vrb <- variability(data=Pbox0708v, 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, Golden State Warriors' players (NBA 2007 - 2008 Regular season)")

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

# Density estimation of the field shots
data0708d <- subset(PbP0708, data_set!="2007-08 Playoffs" & result!="" & shot_distance!="" & team=="GSW")
densityplot(data=data0708d, shot.type="field", var="shot_distance", best.score=TRUE, title="Density estimation of the field shots of Golden State Warriors, with respect to shot distance (NBA 2007 - 2008 Regular Season)")
densityplot(data=data0708d, shot.type="field", var="totalTime", best.score=TRUE, title="Density estimation of the field shots of Golden State Warriors, with respect to total time (NBA 2007 - 2008 Regular Season)")
densityplot(data=data0708d, shot.type="field", var="playlength", best.score=TRUE, title="Density estimation of the field shots of Golden State Warriors, with respect to play length (NBA 2007 - 2008 Regular Season)")

# Expected points of the teams
data0708t <- subset(PbP0708, data_set!="2007-08 Playoffs" & result!="" & shot_distance!="" & team=="GSW")
data0708o <- subset(PbP0708, data_set!="2007-08 Playoffs" & result!="" & shot_distance!="" & oppTeam=="GSW")
data0708t <- mutate(data0708t, player = "Golden State Warriors")
data0708o <- mutate(data0708o, player = "Opponent teams")
data0708TO <- bind_rows(data0708t, data0708o)
pl <- c("Golden State Warriors","Opponent teams")
mypal <- colorRampPalette(c("red","blue"))
expectedpts(data0708TO, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="shot_distance", xlab="Shot distance", title="Expected points of Golden State Warriors and opponent teams, with respect to shot distance (NBA 2007 - 2008 Regular Season)")
expectedpts(data0708TO, bw=1500, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="totalTime", xlab="Total time", title="Expected points of Golden State Warriors and opponent teams, with respect to total time (NBA 2007 - 2008 Regular Season)")
expectedpts(data0708TO, players=pl, col.team="gray", palette=mypal, col.hline="transparent", var="playlength", xlab="Play length", title="Expected points of Golden State Warriors and opponent teams, with respect to play length (NBA 2007 - 2008 Regular Season)")

# Network of assists
PbP0708an <- subset(PbP0708, data_set!="2007-08 Playoffs" & team=="GSW")
PbP0708AN <- PbP0708an[!(PbP0708an$event_type=="shot" & PbP0708an$result=="missed"),]
netdataAN <- assistnet(PbP0708AN)
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, Pbox0708, by="Player")
dataANsp <- subset(dataAN, Team=="Golden State Warriors")
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 Golden State Warriors' players: ASTPTS and FGPTS (NBA 2007 - 2008 Regular Season)")
selan <- which(dataAN$MIN>1500 & dataAN$Team=="Golden State Warriors")
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
PbP0708sco <- subset(PbP0708, data_set!="2007-08 Playoffs" & oppTeam=="GSW")
PbP0708sco$xx <- PbP0708sco$original_x/-10
PbP0708sco$yy <- PbP0708sco$original_y/10-41.75
shotchart(data=PbP0708sco, x="xx", y="yy", z="playlength", num.sect=5, type="sectors", scatter=FALSE, result="result")
shotchart(data=PbP0708sco, x="xx", y="yy", type="density-hexbin", nbins=50, palette="bwr")

# Density estimation of the field shots of the opponent teams
data0708do <- subset(PbP0708, data_set!="2007-08 Playoffs" & result!="" & shot_distance!="" & oppTeam=="GSW")
densityplot(data=data0708do, shot.type="field", var="shot_distance", best.score=TRUE, title="Density estimation of the field shots of Golden State Warriors' opponents, with respect to shot distance (NBA 2007 - 2008 Regular Season)")

⇐ 2006-07 |🏀| 2008-09 ⇒

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

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