Exercise

Simulating the Independent Shooter

Simulating a basketball player who has independent shots uses the same mechanism that we used to simulate a coin flip. To simulate a single shot from an independent shooter with a shooting percentage of 50% we type, outcomes <- c("H", "M") sim_basket <- sample(outcomes, size = 1, replace = TRUE)

To make a valid comparison between Kobe and our simulated independent shooter, we need to align both their shooting percentages and their numbers of attempted shots.

Instructions

100 XP
  • Run a simulation to sample 133 shots (the number of shots of Kobe in this data set) with a shooting percentage of 45%. Assign the output of this simulation to a new object called sim_basket.
  • Inspect your simulation with table().