Load Hot Hand files:

download.file("http://www.openintro.org/stat/data/kobe.RData", destfile = "kobe.RData")
load("kobe.RData")

Exercise 1

A streak of length one means that there was one H then a M. A streak of length zero is a solitary M (directly following another M).

Exercise 2

kobe_streak <- data.frame(length = calc_streak(kobe$basket))
qplot(x = length, data = kobe_streak, geom = "histogram", binwidth = 1)

summary(kobe_streak$length)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.7632  1.0000  4.0000

The distribution of Kobe’s streak is right-skewed, with a max streak of 4. His median streak length was zero. You may also have decided to use the “bar” geometry instead of the “histogram” so that it is clearer which bar belows to which number.

Exercise 3

coin_outcomes <- c("heads", "tails")
set.seed(302)
sim_unfair_coin <- sample(coin_outcomes, size = 100, replace = TRUE, 
                          prob = c(0.2, 0.8))
table(sim_unfair_coin)
## sim_unfair_coin
## heads tails 
##    18    82

Heads came up 82 times.

Exercise 4

shot_outcomes <- c("H", "M")
sim_basket <- sample(shot_outcomes, size = 133, replace = TRUE,
                     prob = c(0.45, 0.55))

On your own:

1:

sim_streak <- data.frame(length = calc_streak(sim_basket))

2:

qplot(x = length, data = sim_streak, geom = "histogram", binwidth = 1)

summary(sim_streak$length)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.0000  0.0000  0.0000  0.7867  1.0000  6.0000

The distribution of streak lengths for the simulated no-hot hands shooter is right-skewed with a typical (median) length of 0 and a maximum of 6. Its spread is best measured by the IQR, which is 1.

3:

I would expect the distribution to be similar in shape, spread, and center (e.g. still right-skewed), however there will be some variation since we have conducted the simulation afresh and each shot makes a basket probabilistically.

4:

Results may vary, but on average: Kobe’s streak length distribution is quite similar to that of the independent shooter (If anything, the independent shooter has slightly longer streak lengths). This suggests that Kobe’s performance is difficult to distinguish for a player with no-hand-hands going on. If he have hot hands, we would have expected to see longer streak lengths in Kobe’s data, which we did not.

5:

In the section of probability, we have discussed notions of independence and conditional probability. In chapter 1, we also discussed ways to describe distributions both graphically and numerically. We hadn’t seen simulation as a technique yet, but now we’re seeing it in Ch. 2. The comparison of data to a model (in this case the independent shooter model) is in spirit the same thing that we’ve discussed with our model of the shoebill bird.