Questions to answer:

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?

Streak is number of baskets before a miss.
In a streak of 1, there’s 1 hit and 1 miss.
In a streak of 0, there’s just a miss.

head(kobe)
##    vs game quarter time
## 1 ORL    1       1 9:47
## 2 ORL    1       1 9:07
## 3 ORL    1       1 8:11
## 4 ORL    1       1 7:41
## 5 ORL    1       1 7:03
## 6 ORL    1       1 6:01
##                                               description basket
## 1                 Kobe Bryant makes 4-foot two point shot      H
## 2                               Kobe Bryant misses jumper      M
## 3                        Kobe Bryant misses 7-foot jumper      M
## 4 Kobe Bryant makes 16-foot jumper (Derek Fisher assists)      H
## 5                         Kobe Bryant makes driving layup      H
## 6                               Kobe Bryant misses jumper      M

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?

Distribution is right-skewed and bounded at zero on the left.
Typical streak is of length 0. Longest streak is of 4 baskets.

3. In your simulation of flipping the unfair coin 100 times, how many flips came up heads?

## 
##  H  M 
## 22 78

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.

sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(0.45, 0.55))

Using calc_streak, compute the streak lengths of sim_basket.

barplot(table(kobe_streak))

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

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?

Distribution of the simulated streak is right-skewed and bounded at 0 on the left.
Typical streak again is zero.
Longest streak is 5 baskets.

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.

I’d expect the overall shape to remain the same, as it will always be left-bounded at 0, and probability of values to the right are increasingly unlikely

\[ P(\textrm{x hits, hit probability p}) = p^x \]

How does Kobe Bryant’s distribution of streak lengths compare to thedistribution 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.

barplot(prop.table(table(kobe_streak)), main = "Kobe's streak")

barplot(prop.table(table(sim_streak)), main = "Simulated streak")

In this specific comparison, there is wider variation in the simulation (one streak of 5 hits). There happens to be a greater percentage of missed shots. In Kobe’s data, there’s a greater number of 0 or 1 hit “streaks” but I don’t know if 1 hit is really a “hot hand”. I think we’d only be comparing the percentage of > 1 streaks versus streaks that ended at 1. Here, there doesn’t seem to be a greater percentage of such shots. This is only one simulation, though, so we can’t draw conclusions from just this one comparison.

Additionally, I think this question of hot-hand would have to take into account the type of shots that were taken. Maybe if you’re making shots, you’re more likely to try more difficult shots. Even if your percentage of “hits” was the same, you still might legitimately be playing “better” after making prior shots.