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
streak = calc_streak(kobe$basket)
barplot(table(streak),col='green')Streak length of 1 means Kobe made exactly one basket, before missing the following basket. Streak length of 0 occurs when a miss follows another miss, the second miss is the 0 length streak.
Kobe’s typical streak length was around 0-1. The mean of the all the streaks is .76, while his majority streak lenght is 0. So, we usually can expect a shot to be made rather than to me missed. Kobe’s longest streak was 4.
outcomes <- c("heads", "tails")
sample(outcomes, size = 1, replace = TRUE)## [1] "heads"
sim_unfair_coin <- sample(outcomes, size = 100, replace = TRUE, prob = c(0.2, 0.8))
table(sim_unfair_coin)## sim_unfair_coin
## heads tails
## 23 77
13 flips became heads.
outcomes <-c("H", "M")
sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = (c(0.45, 0.55)))
sim_basket## [1] "M" "M" "M" "M" "M" "M" "H" "M" "H" "H" "M" "M" "M" "M" "H" "M" "M"
## [18] "M" "M" "M" "H" "H" "H" "M" "M" "H" "H" "M" "M" "M" "M" "H" "H" "H"
## [35] "H" "H" "M" "M" "M" "M" "H" "M" "M" "M" "M" "M" "M" "M" "H" "M" "M"
## [52] "M" "H" "H" "H" "M" "M" "H" "M" "H" "H" "H" "M" "H" "M" "H" "H" "M"
## [69] "M" "M" "H" "H" "H" "M" "H" "H" "M" "M" "H" "H" "H" "M" "M" "M" "M"
## [86] "M" "H" "M" "H" "M" "M" "H" "M" "M" "H" "H" "H" "H" "M" "M" "M" "M"
## [103] "H" "M" "H" "H" "H" "H" "H" "H" "H" "M" "M" "H" "H" "H" "M" "H" "M"
## [120] "M" "M" "M" "M" "M" "H" "H" "H" "H" "M" "H" "M" "M" "M"
table(sim_basket)## sim_basket
## H M
## 58 75
outcomes <-c("H", "M")
sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = (c(0.45, 0.55)))
streak_sim = calc_streak(sim_basket)
barplot(table(streak_sim),col='orange') The distribution of streak lengths if right skewed. The typical streak length is similar to kobes: 0-1. The longest streak in this sample is:
cat("Shooter's longest streak is:", max(streak_sim))## Shooter's longest streak is: 5
If I were to run the simulation of the independent shooter a second time, I would expect somewhat similar streak distribution to compare to the distribution from question above. The lenght of the longest streak might be higher or lower comparing to the question above, but I believe the typical streak lenght would be 0-1 as before.
outcomes <-c("H", "M")
new_sim_basket <- sample(outcomes, size = 133, replace = TRUE, prob = (c(0.45, 0.55)))
new_streak_sim = calc_streak(new_sim_basket)
barplot(table(new_streak_sim),col='blue') After running the simulation again, it concludes somewhat same streak distribution - typical streaks lenght were around 0-1, with a few high streaks.
There is not enough evidence to say the hot hand model fits Kobe’s shooting patters. Because, Kobe Bryant’s distrubution of streak lengths compares to the simulated shooter. They both on average have mostly 0-1 hits for their streak with a few high streaks even though simulater shooter has a shooting percentile of 45%.