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 <- replicate(n_seasons, mean(rbinom(n_at_bats, 1, 0.3)))
# Calculate the proportion of seasons where the batting average is less than 0.267
low_average_prop <- mean(batting_averages < 0.268)
# Output the result
print(low_average_prop)
## [1] 0.1114