Load the data
load("more/kobe.RData")
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?
The streak length of 1 means 1 hit and 1 miss. The streak length of 0 means 0 hit and 1 miss.
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?
kobe_streak <- calc_streak(kobe$basket)
summary(kobe_streak)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000 0.0000 0.0000 0.7632 1.0000 4.0000
The distribution is unimodel and right skewed. The summary statistic shows that the median is 0 streak, meaning that half of the time, Kobe was missing shots. So his typical streak length is 0. His mean streak is 0.76. His longest streak is 4, and only happened once.
3. In your simulation of flipping the unfair coin 100 times, how many flips came up heads?
outcomes <- c("heads", "tails")
sim_unfair_coin <- sample(outcomes, size = 100, replace = TRUE, prob = c(0.2,0.8))
table(sim_unfair_coin)
## sim_unfair_coin
## heads tails
## 18 82
The heads came up 18 times.
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.
outcomes <- c("H", "M")
sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = c(0.45, 0.55))
Using calc_streak, compute the streak lengths of sim_basket.
sim_streak <- calc_streak(sim_basket)
barplot(table(sim_streak))
summary(sim_streak)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00 0.00 1.00 1.03 2.00 4.00
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 is unimodel and right skewed. The summary statistic shows that the median is 1 streak. So the typical streak length is 0. The mean streak is 1.030303. The longest streak is 4.
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.
The second run of the simulation would produce a similar but slightly different distribution compare to the last one. This is because a simulation is run to simulate the act of random sampling. It is natural that the random drawing results will be different. However, it will follow the underlaying probability. In plain words, if the item is harder to get drawn than others, it will get drawn less. As the size of sample increase, this will become apparent, and each simulation will become more similar to other.
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.
barplot(table(kobe_streak))
barplot(table(sim_streak))
Kobe Bryant’s distrubtion of streak lengths is very similar to the distribution of streak lengths for the simulated shotter. They are both unimodel and skewed to the right. Both with median of 0 streak, and similar mean. This suggests that hot hand theory is not valid, meaning that each shot’s chance of hit or miss is independent to the previous or next shot.