Hot Hands Lab

Author

R Saidi

Hot Hands Lab

Load libraries

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.0     ✔ stringr   1.5.1
✔ ggplot2   3.5.1     ✔ tibble    3.2.1
✔ lubridate 1.9.3     ✔ tidyr     1.3.1
✔ purrr     1.0.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(openintro)
Loading required package: airports
Loading required package: cherryblossom
Loading required package: usdata

Data

data(kobe_basket)
head(kobe_basket)
# A tibble: 6 × 6
  vs     game quarter time  description                                    shot 
  <fct> <int> <fct>   <fct> <fct>                                          <chr>
1 ORL       1 1       9:47  Kobe Bryant makes 4-foot two point shot        H    
2 ORL       1 1       9:07  Kobe Bryant misses jumper                      M    
3 ORL       1 1       8:11  Kobe Bryant misses 7-foot jumper               M    
4 ORL       1 1       7:41  Kobe Bryant makes 16-foot jumper (Derek Fishe… H    
5 ORL       1 1       7:03  Kobe Bryant makes driving layup                H    
6 ORL       1 1       6:01  Kobe Bryant misses jumper                      M    

Exercise 1

What does a streak length of 1 mean, i.e. how many hits and misses are in a streak of 1? What about a streak length of 0?

Option1 answer:

# A streak length of 1 means ....

Option2 answer:

Answer: my answer…..

kobe_streak <- calc_streak(kobe_basket$shot)
summary(kobe_streak)
     length      
 Min.   :0.0000  
 1st Qu.:0.0000  
 Median :0.0000  
 Mean   :0.7632  
 3rd Qu.:1.0000  
 Max.   :4.0000  

Create a bar graph

ggplot(data = kobe_streak, aes(x = length)) +
  geom_bar()