Exercise 1

  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?

    Answer

    Streak of length 1 - has a Hit followed by miss

    Streak of length 0 - has miss followed by miss

Exercise 2

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

Answer

The distribution here is right skewed and unimodal

typical <- median(kobe_streak$length)
mx <- max(kobe_streak$length)

paste("Typical streak length is ",typical)

paste("Longest streak length is ",mx)

What was his typical streak length? 0

How long was his longest streak of baskets? 4

coin_outcomes <- c("heads", "tails")

Exercise 3

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

Answer

set.seed(53979)
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

22 78

Exercise 4

  1. 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.
set.seed(53979)
outcomes <- c("H", "M")
sim_basket <- sample(outcomes, size = 133, prob=c(0.45, 0.55), replace = TRUE)

sim_basket

H M

58 75


More Practice

Comparing Kobe Bryant to the Independent Shooter

Exercise 5

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

Answer

sim_streak <- calc_streak(sim_basket)

Exercise 6

  1. 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 distribution is right skewed and unimodal

paste("Typical streak length is ", median(sim_streak$length))
paste("Longest streak of baskets is ", max(sim_streak$length))

What was his typical streak length? 0

How long was his longest streak of baskets? 5

Exercise 7

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

The distribution are somewhat similar here because the shots are independent of each other. The probability of making the shot doesn’t change between the two simulations.

Exercise 8

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

Kobe bryant’s distribution of streak length and Simulated shooter distribution of streak length are similar. So, there is no enough evidence to conclude that hot hand model fits Kobe’s shooting pattern.


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.