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 events (http://psych.cornell.edu/sites/default/files/Gilo.Vallone.Tversky.pdf). 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 R, and (3) to compare a simulation to actual data in order to determine if the hot hand phenomenon appears to be real.

Our 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. Let’s load some data from those games and look at the first several rows.

load("more/kobe.RData")
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

In this data frame, every row records a shot taken by Kobe Bryant. If he hit the shot (made a basket), a hit, H, is recorded in the column named basket, otherwise a miss, M, is recorded.

Just looking at the string of hits and misses, it can be difficult to gauge whether or not it seems like Kobe was shooting with a hot hand. One way we can approach this is by considering the belief that hot hand shooters tend to go on shooting streaks. For this lab, we define the length of a shooting streak to be the number of consecutive baskets made until a miss occurs.

For example, in Game 1 Kobe had the following sequence of hits and misses from his nine shot attempts in the first quarter:

kobe$basket[1:9]
## [1] "H" "M" "M" "H" "H" "M" "M" "M" "M"

Within the nine shot attempts, there are six streaks, which are separated by a “|” above. Their lengths are one, zero, two, zero, zero, zero (in order of occurrence).

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?

A streak of length 1 means that he made only 1 shot in the streak and then missed the next shot. A streak of length 0 would be a miss only with no shots made.

Calculate the lengths of all shooting streaks and then look at the distribution:

kobe_streak <- calc_streak(kobe$basket)
barplot(table(kobe_streak))

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?

The distribution is right skewed with the majority of his shot streaks being misses followed by just one shot made and missing the next. Therefore the typical streak length is 0 and the longest streak was 4 shots before missing.

Compared to What?

We’ve shown that Kobe had some long shooting streaks, but are they long enough to support the belief that he had hot hands? What can we compare them to?

To answer these questions, let’s return to the idea of independence. Two processes are independent if the outcome of one process doesn’t effect the outcome of the second. If each shot that a player takes is an independent process, having made or missed your first shot will not affect the probability that you will make or miss your second shot.

A shooter with a hot hand will have shots that are not independent of one another. Specifically, if the shooter makes his first shot, the hot hand model says he will have a higher probability of making his second shot.

Let’s suppose for a moment that the hot hand model is valid for Kobe. During his career, the percentage of time Kobe makes a basket (i.e. his shooting percentage) is about 45%, or in probability notation,

\[ P(\textrm{shot 1 = H}) = 0.45 \]

If he makes the first shot and has a hot hand (not independent shots), then the probability that he makes his second shot would go up to, let’s say, 60%,

\[ P(\textrm{shot 2 = H} \, | \, \textrm{shot 1 = H}) = 0.60 \]

As a result of these increased probabilites, you’d expect Kobe to have longer streaks. Compare this to the skeptical perspective where Kobe does not have a hot hand, where each shot is independent of the next. If he hit his first shot, the probability that he makes the second is still 0.45.

\[ P(\textrm{shot 2 = H} \, | \, \textrm{shot 1 = H}) = 0.45 \]

In other words, making the first shot did nothing to effect the probability that he’d make his second shot. If Kobe’s shots are independent, then he’d have the same probability of hitting every shot regardless of his past shots: 45%.

Now that we’ve phrased the situation in terms of independent shots, let’s return to the question: how do we tell if Kobe’s shooting streaks are long enough to indicate that he has hot hands? We can compare his streak lengths to someone without hot hands: an independent shooter.

Simulations in R

If you wanted to simulate flipping a fair coin 100 times, you could either run the function 100 times or, more simply, adjust the size argument, which governs how many samples to draw (the replace = TRUE argument indicates we put the slip of paper back in the hat before drawing again).

outcomes <- c("heads", "tails")
sample(outcomes, size = 1, replace = TRUE)
## [1] "tails"
sim_fair_coin <- sample(outcomes, size = 100, replace = TRUE)
sim_fair_coin
##   [1] "heads" "heads" "heads" "tails" "tails" "tails" "tails" "tails"
##   [9] "tails" "heads" "tails" "tails" "tails" "heads" "tails" "tails"
##  [17] "tails" "tails" "heads" "tails" "heads" "tails" "tails" "tails"
##  [25] "tails" "heads" "tails" "tails" "heads" "heads" "tails" "heads"
##  [33] "tails" "heads" "tails" "heads" "tails" "tails" "tails" "heads"
##  [41] "heads" "tails" "tails" "heads" "heads" "tails" "heads" "heads"
##  [49] "heads" "tails" "heads" "tails" "tails" "tails" "tails" "tails"
##  [57] "heads" "heads" "tails" "heads" "tails" "tails" "heads" "heads"
##  [65] "tails" "heads" "heads" "heads" "tails" "heads" "tails" "tails"
##  [73] "heads" "tails" "tails" "tails" "heads" "heads" "heads" "heads"
##  [81] "heads" "heads" "heads" "tails" "heads" "heads" "heads" "heads"
##  [89] "heads" "tails" "heads" "heads" "tails" "tails" "tails" "tails"
##  [97] "tails" "tails" "heads" "heads"
table(sim_fair_coin)
## sim_fair_coin
## heads tails 
##    47    53

Since there are only two elements in outcomes, the probability that we “flip” a coin and it lands heads is 0.5. Say we’re trying to simulate an unfair coin that we know only lands heads 20% of the time. We can adjust for this by adding an argument called prob, which provides a vector of two probability weights.

sim_unfair_coin <- sample(outcomes, size = 100, replace = TRUE, prob = c(0.2, 0.8))

prob=c(0.2, 0.8) indicates that for the two elements in the outcomes vector, we want to select the first one, heads, with probability 0.2 and the second one, tails with probability 0.8. Another way of thinking about this is to think of the outcome space as a bag of 10 chips, where 2 chips are labeled “head” and 8 chips “tail”. Therefore at each draw, the probability of drawing a chip that says “head”" is 20%, and “tail” is 80%.

Exercise 3.  In your simulation of flipping the unfair coin 100 times, how many flips 
came up heads?
sum(sim_unfair_coin == "heads")
## [1] 11

In a sense, we’ve shrunken the size of the slip of paper that says “heads”, making it less likely to be drawn and we’ve increased the size of the slip of paper saying “tails”, making it more likely to be drawn. When we simulated the fair coin, both slips of paper were the same size.

Simulating the Independent Shooter

Simulating a basketball player who has independent shots uses the same mechanism that we use to simulate a coin flip. To simulate a single shot from an independent shooter with a shooting percentage of 50% we type,

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

To make a valid comparison between Kobe and our simulated independent shooter, we need to align both their shooting percentage and the number of attempted shots.

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`.
sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(.45, .55))
table(sim_basket)
## sim_basket
##  H  M 
## 57 76

Note that we’ve named the new vector sim_basket, the same name that we gave to the previous vector reflecting a shooting percentage of 50%.

With the results of the simulation saved as sim_basket, we have the data necessary to compare Kobe to our independent shooter. We can look at Kobe’s data alongside our simulated data.

kobe$basket
##   [1] "H" "M" "M" "H" "H" "M" "M" "M" "M" "H" "H" "H" "M" "H" "H" "M" "M"
##  [18] "H" "H" "H" "M" "M" "H" "M" "H" "H" "H" "M" "M" "M" "M" "M" "M" "H"
##  [35] "M" "H" "M" "M" "H" "H" "H" "H" "M" "H" "M" "M" "H" "M" "M" "H" "M"
##  [52] "M" "H" "M" "H" "H" "M" "M" "H" "M" "H" "H" "M" "H" "M" "M" "M" "H"
##  [69] "M" "M" "M" "M" "H" "M" "H" "M" "M" "H" "M" "M" "H" "H" "M" "M" "M"
##  [86] "M" "H" "H" "H" "M" "M" "H" "M" "M" "H" "M" "H" "H" "M" "H" "M" "M"
## [103] "H" "M" "M" "M" "H" "M" "H" "H" "H" "M" "H" "H" "H" "M" "H" "M" "H"
## [120] "M" "M" "M" "M" "M" "M" "H" "M" "H" "M" "M" "M" "M" "H"
sim_basket
##   [1] "H" "M" "M" "M" "M" "M" "M" "M" "H" "M" "M" "M" "M" "H" "M" "M" "H"
##  [18] "M" "H" "M" "M" "H" "M" "M" "M" "H" "M" "M" "H" "M" "H" "H" "M" "M"
##  [35] "H" "H" "M" "M" "H" "H" "M" "M" "H" "M" "M" "M" "H" "M" "M" "H" "M"
##  [52] "H" "H" "H" "M" "M" "M" "M" "H" "H" "M" "H" "H" "H" "M" "H" "H" "H"
##  [69] "H" "H" "H" "H" "H" "M" "H" "H" "M" "M" "H" "H" "M" "H" "M" "M" "M"
##  [86] "M" "M" "H" "M" "M" "M" "H" "H" "M" "H" "M" "M" "M" "H" "M" "M" "M"
## [103] "M" "H" "M" "H" "H" "M" "M" "H" "H" "M" "H" "M" "H" "H" "M" "M" "H"
## [120] "H" "H" "M" "M" "M" "M" "M" "M" "M" "M" "H" "M" "H" "H"

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.


On your own

Comparing Kobe Bryant to the Independent Shooter

Using calc_streak, compute the streak lengths of sim_basket.

IndependentShooter_streak <- calc_streak(sim_basket)
barplot(table(IndependentShooter_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?

The distribution looks very similar to Kobe’s streak barplot with the majority of shots being misses or streaks of 0 followed by streaks of 1 shot. The longest streak changes whenever a new simulation is run but for this simulation the longest streak is 8.

  • 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.
sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(.45, .55))
IndependentShooter_streak <- calc_streak(sim_basket)
barplot(table(IndependentShooter_streak))

I would expect the new simulation to be somewhat similar but not exactly the same as the first distribution because the parameters for the simulation are the same but each new simulation will have a different result. The longest streak for this new simulation is 5.

  • 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.

Let’s look again at Kobe’s streak lengths:

barplot(table(kobe_streak))

The Independent Shooter streak distribution is almost identical to Kobe’s streak distribution. Both shooters have far more streaks of length 0 and the next longest streak is 1 for both. The similarity of the distributions clearly shows that Kobe is no more likely to have longer shooting streaks than the Independent Shooter. If Kobe’s distribution fit the hot hands model then his streaks would be longer than the Independent Shooter’s but the barplots clearly show that this is not the case. Therefore the Hot Hands hypothesis is rejected.