## Rows: 133
## Columns: 6
## $ vs <fct> ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL, ORL…
## $ game <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ quarter <fct> 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3…
## $ time <fct> 9:47, 9:07, 8:11, 7:41, 7:03, 6:01, 4:07, 0:52, 0:00, 6:35…
## $ description <fct> Kobe Bryant makes 4-foot two point shot, Kobe Bryant misse…
## $ shot <chr> "H", "M", "M", "H", "H", "M", "M", "M", "M", "H", "H", "H"…
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: A streak length of 1 means that Kobe shot one hit but missed the next few shots. A streak length of 0 means that Kobe made zero hits and kept making misses.
*Answer: The distribution is skewed to the right as there is a tail on the right side. His typical streak length is 0 as it had the most counts. The longest streak length is 4 with less than 5 occurrences.
## Simulations In R
``` r
coin_outcomes <- c("heads", "tails")
sample(coin_outcomes, size = 1, replace = TRUE)
```
```
## [1] "heads"
```
### 100 times coin flips
``` r
sim_fair_coin <- sample(coin_outcomes, size = 100, replace = TRUE)
```
## [1] "tails" "heads" "tails" "heads" "heads" "tails" "tails" "heads" "tails"
## [10] "tails" "heads" "heads" "heads" "heads" "tails" "heads" "tails" "tails"
## [19] "heads" "tails" "heads" "heads" "heads" "heads" "heads" "heads" "heads"
## [28] "tails" "tails" "heads" "tails" "tails" "heads" "heads" "tails" "tails"
## [37] "heads" "tails" "tails" "heads" "tails" "heads" "tails" "tails" "heads"
## [46] "heads" "heads" "tails" "heads" "tails" "heads" "tails" "tails" "tails"
## [55] "heads" "heads" "heads" "heads" "tails" "tails" "tails" "tails" "tails"
## [64] "tails" "heads" "tails" "tails" "heads" "heads" "heads" "heads" "tails"
## [73] "tails" "heads" "heads" "tails" "heads" "heads" "tails" "heads" "tails"
## [82] "tails" "heads" "tails" "tails" "tails" "tails" "tails" "heads" "tails"
## [91] "tails" "tails" "heads" "heads" "tails" "tails" "tails" "heads" "heads"
## [100] "heads"
## sim_fair_coin
## heads tails
## 49 51
*Answer: In my simulation, I got 14 heads and 86 tails.
shot_outcomes <- c("H", "M")
sim_basket <- sample(shot_outcomes, size = 133, replace = TRUE, prob = c(0.46,0.65))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.*Answer: For the code above of the sample function to represent 45% it was easy. All I had to do was change the prob to 0.46 and .65. Then to sample 133 shots I changed the size = to 133.
Using calc_streak, compute the streak lengths of
sim_basket, and save the results in a data frame called
sim_streak.
*Answer: The distribution is yet again skewed to the right with the most at 0 streaks. The longest streak here is also four hits before any misses.
``` r
ggplot(data=sim_streak2,aes(x=length))+
geom_bar()
```
<img src="Kobe-project_files/figure-html/unnamed-chunk-10-1.png" width="672" />
*Answer: If I were to run this code for a second time the results would be super similar as it would follow a skewed right distribution. There may be more 0 hits because it has a huge lean towards misses than hits. The probability stays the same so the data will be similar if we change the probability then we will see a difference.
*Answer: Kobe distribution and the independent distribution share the same skewed right distribution. There was more misses than hits and both models followed that the next big group was 1 hit. I will say that Kobe didn’t have hot hands because the graphs show that his hits didn’t always result in the next shot going in but most of the time ending the streaks. His most impressive streak is 4 and both models don’t go past that. He was a good player but never had the hot-hand theory due to the data in my eyes.