|
|
@@ -36,6 +36,21 @@ ggplot(earlyfouls, aes(x=SCOREMARGIN_CORR)) +
|
|
|
geom_histogram(data=allfouls, binwidth=1, fill="green", alpha=0.5)
|
|
|
dev.off()
|
|
|
|
|
|
+# look at the distribution of fouls in the final minute
|
|
|
+lastminfouls <- filter(allfouls,
|
|
|
+ (PERIOD == 4 & PCTIMESTRING < "00:01:00"))
|
|
|
+median(lastminfouls$SCOREMARGIN_CORR)
|
|
|
+mean(lastminfouls$SCOREMARGIN_CORR)
|
|
|
+sd(lastminfouls$SCOREMARGIN_CORR)
|
|
|
+png('figures/foul_histogram-regular_finalmin.png')
|
|
|
+ggplot(lastminfouls, aes(x=SCOREMARGIN_CORR)) +
|
|
|
+ geom_histogram(binwidth=1, fill="red", alpha=0.5) +
|
|
|
+ theme_bw() +
|
|
|
+ scale_y_log10() +
|
|
|
+ xlab("Score Margin") + ylab("N Fouls") +
|
|
|
+ geom_histogram(data=allfouls, binwidth=1, fill="green", alpha=0.5)
|
|
|
+dev.off()
|
|
|
+
|
|
|
# overtime fouls
|
|
|
overtimefouls <- filter(allfouls,
|
|
|
PERIOD > 4)
|