Lap Report

Author

M Vollbrecht

library(tidyverse) library(openintro)

glimpse(kobe_basket)

#excercise one: a streak length of 1 means that 1 basket was made. So there would be one miss (or nothing), one hit, and then a miss. A streak length of 0 means that the shot was a miss.

kobe_streak <- calc_streak(kobe_basket$shot)

ggplot(data=kobe_streak, aes(x = length))+ geom_bar()

#Excercise two: Kobe’s typical streak length was 0, as there were more streak lenths of 0 than any other. His longest streak was 4 baskets.

coin_outcomes <- c(“heads”, “tails”) sample(coin_outcomes, size = 1, replace = TRUE)

sim_fair_coin <- sample(coin_outcomes, size = 100, replace = TRUE) sim_fair_coin table(sim_fair_coin)

set.seed(666555)

sim_unfair_coin <- sample(coin_outcomes, size = 100, replace = TRUE, prob = c(0.2, 0.8)) sim_unfair_coin table(sim_unfair_coin) table(sim_unfair_coin)

#Excercise 3: Heads came up 20 times and tails came up #sim_unfair_coin #table(sim_unfair_coin)

#Excercise 4 shot_outcomes <- c(“H”, “M”) sim_basket <- sample(shot_outcomes, size = 1, replace = TRUE)

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

#Excercise 5 sim_streak <- calc_streak(sim_basket) sim_streak ggplot(data = sim_streak, aes(x = length)) + geom_bar()

#Excercise 6: Typical streak length is also one, similar to Kobe. the longest streak is 5 baskets.

#Excercise 7: I would expect it to be somewhat similar with the data being right skewed, as it is in the data here.

#Excercise 8: It looks pretty similar to Kobe’s shooting patterns, with the right leaning pattern.