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.
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.3 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.0
✔ 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
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?
** A note on setting a seed: Setting a seed will cause R to select the same sample each time you knit your document. This will make sure your results don’t change each time you knit, and it will also ensure reproducibility of your work (by setting the same seed it will be possible to reproduce your results). You can set a seed like this:
In your simulation of flipping the unfair coin 100 times, how many flips came up heads?
Answer: 26
Simulating the Independent Shooter
Simulating a basketball player who has independent shots uses the same mechanism that you used to simulate a coin flip. To simulate a single shot from an independent shooter with a shooting percentage of 50% you can type.
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.
Answer : It seems that Kobe’s results are similar to the simulated shooter without the hot hand.
More Practice
Comparing Kobe Bryant to the Independent Shooter
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_basket2)
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.
Answer: The typical streak length is 0. The longest streak of baskets was 6, but that was only 1 time
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.
Answer: I would expect the distribution to be somewhat similar rather than identical. The number of misses will always be higher than the number of hits due to the shooting percentage being below 50%. The probability of making successive shots or hits will always be very low in relation to the probability of missing a single shot (e.g. P(streak of 2) = P(.45 and .45) = .2025 < P(streak of 1) = P(.45 and .55) = .2475 < P(streak of 0) = .55). In other words, the longer the streak, the lower the probability or frequency of occurences. Thus, the shape will essentially always be the same. What will vary is basically the extremity of outliers as a function of the fact that this is a random simulation. Another simulation might yield outliers of just 4 and 15, for example.
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.
Answer: The distribution of streaks for the simulated independent shooter are similar to that of Kobe. If we were to run it multiple times, we will likely find similar results each time. Just like the distribution of Kobe’s streak lengths, the distribution of the simulated shooter’s streak lengths is highly skewed to the right and the majority of streaks are clumped between 0 and 1. Therefore, the hot-hands theory seems to be false.
The question of whether shots are dependent of one another still seems to be difficult to confirm. The real question then seems to be: are the streaks of hits merely the effect of random, independent shots or do they demonstrate that shots are dependent upon prior shots?