Probability

Hazal Gunduz

Hot Hands

Basketball players who make several baskets in succession are described as having a “hot hand.” Fans and players have long believed in the hot hand phenomenon, which refutes the assumption that each shot is independent of the next. However, a 1985 paper by Gilovich, Vallone, and Tversky collected evidence that contradicted this belief and showed that successive shots are independent events1. This paper started a great controversy that continues to this day, as you can see by Googling “hot hand basketball.” We do not expect to resolve this controversy today. However, in this lab we’ll apply one approach to answering questions like this. The goals for this lab are to (1) think about the effects of independent and dependent events, (2) learn how to simulate shooting streaks in SAS, and (3) compare a simulation to actual data in order to determine whether the hot hand phenomenon appears to be real.

Load packages

In this lab, we will explore and visualize the data using the tidyverse suite of packages. The data can be found in the companion package for OpenIntro labs, openintro. Let’s load the packages.

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.4     ✓ dplyr   1.0.7
## ✓ tidyr   1.1.3     ✓ stringr 1.4.0
## ✓ readr   2.0.1     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata

Data

Your investigation will focus on the performance of one player: Kobe Bryant of the Los Angeles Lakers. His performance against the Orlando Magic in the 2009 NBA Finals earned him the title Most Valuable Player and many spectators commented on how he appeared to show a hot hand. The data file we’ll use is called kobe_basket.

glimpse(kobe_basket)
## Rows: 133
## Columns: 6
## $ vs          <fct> ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL…
## $ game        <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ quarter     <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3…
## $ time        <fct> 9:47, 9:07, 8:11, 7:41, 7:03, 6:01, 4:07, 0:52, 0:00, 6:35…
## $ description <fct> Kobe Bryant makes 4-foot two point shot, Kobe Bryant misse…
## $ shot        <chr> "H", "M", "M", "H", "H", "M", "M", "M", "M", "H", "H", "H"…
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?

kobe_streak <- calc_streak(kobe_basket$shot)
qplot(data = kobe_streak, x = length, geom = "bar")

Exercise 2. Describe the distribution of Kobe’s streak lengths from the 2009 NBA finals. What was his typical streak length? How long was his longest streak of baskets? Make sure to include the accompanying plot in your answer.

=> The istribution is skewed right. The most common streak length is 0. The longest streak was 4 baskets.

Exercise 3. In your simulation of flipping the unfair coin 100 times, how many flips came up heads? Include the code for sampling the unfair coin in your response. Since the markdown file will run the code, and generate a new sample each time you Knit it, you should also “set a seed” before you sample. Read more about setting a seed below.

set.seed(3746)
?sample

=> 16 coins came up heads.

Exercise 4. What change needs to be made to the sample function so that it reflects a shooting percentage of 45%? Make this adjustment, then run a simulation to sample 133 shots. Assign the output of this simulation to a new object called sim_basket.

outcomes <- c("H", "M")
sim_basket <- sample(outcomes, size = 1, replace = TRUE)

=> We should add the “prob” that our “sample” function and increase the size to 133.

sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(0.45, 0.55))
kobe_basket$shot
##   [1] "H" "M" "M" "H" "H" "M" "M" "M" "M" "H" "H" "H" "M" "H" "H" "M" "M" "H"
##  [19] "H" "H" "M" "M" "H" "M" "H" "H" "H" "M" "M" "M" "M" "M" "M" "H" "M" "H"
##  [37] "M" "M" "H" "H" "H" "H" "M" "H" "M" "M" "H" "M" "M" "H" "M" "M" "H" "M"
##  [55] "H" "H" "M" "M" "H" "M" "H" "H" "M" "H" "M" "M" "M" "H" "M" "M" "M" "M"
##  [73] "H" "M" "H" "M" "M" "H" "M" "M" "H" "H" "M" "M" "M" "M" "H" "H" "H" "M"
##  [91] "M" "H" "M" "M" "H" "M" "H" "H" "M" "H" "M" "M" "H" "M" "M" "M" "H" "M"
## [109] "H" "H" "H" "M" "H" "H" "H" "M" "H" "M" "H" "M" "M" "M" "M" "M" "M" "H"
## [127] "M" "H" "M" "M" "M" "M" "H"
sim_basket
##   [1] "H" "H" "M" "H" "M" "H" "M" "M" "M" "H" "M" "H" "M" "H" "H" "H" "M" "H"
##  [19] "H" "M" "H" "H" "M" "H" "M" "H" "M" "M" "M" "H" "H" "M" "M" "M" "M" "M"
##  [37] "M" "H" "M" "H" "M" "M" "M" "H" "M" "M" "H" "M" "M" "M" "M" "M" "M" "M"
##  [55] "H" "H" "M" "H" "H" "M" "H" "H" "H" "M" "M" "M" "M" "M" "M" "M" "M" "H"
##  [73] "M" "M" "H" "M" "H" "H" "H" "M" "H" "M" "M" "M" "M" "H" "M" "H" "H" "M"
##  [91] "M" "M" "H" "H" "H" "M" "M" "M" "H" "M" "H" "M" "H" "H" "H" "H" "H" "M"
## [109] "H" "M" "H" "M" "H" "H" "H" "H" "M" "H" "H" "M" "H" "M" "M" "M" "M" "M"
## [127] "M" "M" "H" "M" "H" "M" "M"

Both data sets represent the results of 133 shot attempts, each with the same shooting percentage of 45%. We know that our simulated data is from a shooter that has independent shots. That is, we know the simulated shooter does not have a hot hand.

Exercise 5. Using calc_streak, compute the streak lengths of sim_basket, and save the results in a data frame called sim_streak.

sim_streak <- calc_streak(sim_basket)
barplot(table(sim_streak))

Exercise 6. Describe the distribution of streak lengths. What is the typical streak length for this simulated independent shooter with a 45% shooting percentage? How long is the player’s longest streak of baskets in 133 shots? Make sure to include a plot in your answer.

=> The distribution is skewed right. The typical streak length is 0. The longest streak of basket is 4.

Exercise 7. If you were to run the simulation of the independent shooter a second time, how would you expect its streak distribution to compare to the distribution from the question above? Exactly the same? Somewhat similar? Totally different? Explain your reasoning.

=> If I ran a second simulation with the same parameters I expect the results to be similar but not identical. It will be fit the same description but the quantity of each streak length will not be identical. The sample size is fairly small, so that will cause a little bit of variance between the two overall but it will still be very similar.

Exercise 8. How does Kobe Bryant’s distribution of streak lengths compare to the distribution of streak lengths for the simulated shooter? Using this comparison, do you have evidence that the hot hand model fits Kobe’s shooting patterns? Explain.

=> Kobe Bryant’s distribution of streak length is very similar to the simulated distribtion we created. It is the same shape, it has the same typical streak length and the same longest streak length. Overall distribution was very similar and the typical streak and shape remained consistantly. We can conclude that hot hand model doesn’t fit Kobe’s shooting pattern. His pattern is similar to our simulated distribution which is independent.