Noori Selina

Discussion 9 Response

set.seed(1125)
# Set parameters
n_at_bats <- 300  # Number of times at bat
n_seasons <- 10000  # Number of seasons to simulate

# Simulate batting average over multiple seasons
batting_averages <- rbinom(n_seasons, n_at_bats, 0.3) / n_at_bats

# Calculate the proportion of seasons where the batting average is less than or equal to 0.267
low_average_prop <- mean(batting_averages <= 0.267)

# Output the result
print(low_average_prop)
## [1] 0.1147