ONLY DO WHAT ONLY YOU CAN DO

こけたら立ちなはれ 立ったら歩きなはれ

R で ヒストグラム 箱ひげ図 ~少年サッカー データ分析~

得失点と、やや相関のみられた項目について、勝敗別のヒストグラム、箱ひげ図 を書いてみる

g <- ggplot(d4)
g <- g + geom_histogram(aes(x=d4$"TOUCH比",fill=d4$"勝敗"),   binwidth=2, alpha=0.2, position="identity")
g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff"))
g <- g + xlab("自チームのタッチ数 / 自チームのタッチ数 + 相手チームのタッチ数")
g <- g + ylab("試合数")
print(g)

f:id:fornext1119:20180126124311p:plain

gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"TOUCH比",color=d4$"勝敗",fill=d4$"勝敗"))
gbox <- gbox + geom_boxplot(color="black")
gbox <- gbox + xlab("勝敗")
gbox <- gbox + ylab("自チームのタッチ数 / 自チームのタッチ数 + 相手チームのタッチ数")
plot(gbox)

f:id:fornext1119:20180126125639p:plain

g <- ggplot(d4)
g <- g + geom_histogram(aes(x=d4$"KEEP比",fill=d4$"勝敗"),   binwidth=2, alpha=0.2, position="identity")
g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff"))
g <- g + xlab("自チームのキープ数 / 自チームのキープ数 + 相手チームのキープ数")
g <- g + ylab("試合数")
print(g)

f:id:fornext1119:20180126124432p:plain

gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"KEEP比",color=d4$"勝敗",fill=d4$"勝敗"))
gbox <- gbox + geom_boxplot(color="black")
gbox <- gbox + xlab("勝敗")
gbox <- gbox + ylab("自チームのキープ数 / 自チームのキープ数 + 相手チームのキープ数")
plot(gbox)

f:id:fornext1119:20180126125739p:plain

g <- ggplot(d4)
g <- g + geom_histogram(aes(x=d4$"奪取",fill=d4$"勝敗"),   binwidth=1, alpha=0.2, position="identity")
g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff"))
g <- g + xlab("奪取")
g <- g + ylab("試合数")
print(g)

f:id:fornext1119:20180126124600p:plain

gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"奪取",color=d4$"勝敗",fill=d4$"勝敗"))
gbox <- gbox + geom_boxplot(color="black")
gbox <- gbox + xlab("勝敗")
gbox <- gbox + ylab("奪取")
plot(gbox)

f:id:fornext1119:20180126125500p:plain


意外と相関のみられなかった項目

g <- ggplot(d4)
g <- g + geom_histogram(aes(x=d4$"パス",fill=d4$"勝敗"),   binwidth=1, alpha=0.2, position="identity")
g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff"))
g <- g + xlab("パス")
g <- g + ylab("試合数")
print(g)
ggsave("パス.png")

f:id:fornext1119:20180126124742p:plain

gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"パス",color=d4$"勝敗",fill=d4$"勝敗"))
gbox <- gbox + geom_boxplot(color="black")
gbox <- gbox + xlab("勝敗")
gbox <- gbox + ylab("パス")
plot(gbox)

f:id:fornext1119:20180126130002p:plain


負の相関があると思ったのに、やや正の相関がある項目

g <- ggplot(d4)
g <- g + geom_histogram(aes(x=d4$"保持の標準偏差",fill=d4$"勝敗"),   binwidth=0.5, alpha=0.2, position="identity")
g <- g + scale_fill_manual(values = c("#00cc88", "#0000ff", "#ff00ff"))
g <- g + xlab("ボール保持の偏り")
g <- g + ylab("試合数")
print(g)
ggsave("保持の標準偏差.png")

f:id:fornext1119:20180126125007p:plain

gbox <- ggplot(d4,aes(x=d4$"勝敗",y=d4$"保持の標準偏差",color=d4$"勝敗",fill=d4$"勝敗"))
gbox <- gbox + geom_boxplot(color="black")
gbox <- gbox + xlab("勝敗")
gbox <- gbox + ylab("ボール保持の偏り")
plot(gbox)

f:id:fornext1119:20180126130107p:plain