Personal code snippets of @tmasjc

Site powered by Hugo + Blogdown

Image by Mads Schmidt Rasmussen from unsplash.com

Minimal Bootstrap Theme by Zachary Betz

EDA: Curry’s Streaking Hot Hand

Mar 16, 2019 #monte-carlo

Steph Curry averaging .411 in 3-point field goal percentage during the 2016-17 season. On November 7 2016, he made 13 out of 17 3-point attemps. How likely was it to happen?

library(ggplot2)
library(dplyr)
set.seed(123)

# 3-point fg pct
steph_curry = 0.411

# simulation trials
trials = 10000

# simulate shot game in 17 attemps
made <- replicate(trials, sum(rbinom(n = 17, size = 1, prob = steph_curry)))

# plot it out
made %>% 
    as_data_frame() %>% 
    ggplot(aes(made)) +
    geom_histogram(bins = 60) + 
    geom_vline(xintercept = 13, col = "red", lty = 4) +
    scale_x_continuous(breaks = seq(1, 20, 1)) + 
    theme_light(base_family = "Menlo") + 
    labs(title = "Steph Curry's Super Hot Hand", 
         x = "3-point made", 
         y = "Count")
## Warning: `as_data_frame()` is deprecated, use `as_tibble()` (but mind the new semantics).
## This warning is displayed once per session.

Answer: 0%