- Goal: Estimate and compare catch rates for different Pokemon.
- I will use confidence intervals for a proportion.
- Example Pokemon: Pikachu, Caterpie, and Onix
2025-11-17
We simulate catch attempts for three Pokemon: - Pikachu: 112 catches out of 200 attempts - Caterpie: 155 catches out of 200 attempts - Onix: 70 catches out of 200 attempts
## pokemon caught attempts p_hat se z lower upper ## 1 Pikachu 112 200 0.560 0.03509986 1.96 0.4912043 0.6287957 ## 2 Caterpie 155 200 0.775 0.02952753 1.96 0.7171260 0.8328740 ## 3 Onix 70 200 0.350 0.03372684 1.96 0.2838954 0.4161046
# Create Pokémon catch data
pokemon <- data.frame(
pokemon = c("Pikachu", "Caterpie", "Onix"),
caught = c(112, 155, 70),
attempts = c(200, 200, 200)
)
pokemon <- pokemon %>%
mutate(
p_hat = caught / attempts,
se = sqrt(p_hat * (1 - p_hat) / attempts),
z = 1.96,
lower = p_hat - z * se,
upper = p_hat + z * se
)
ggplot(pokemon, aes(x = pokemon, y = p_hat)) +
geom_col() +
ylim(0, 1) +
labs(
title = "Estimated Catch Rates by Pokémon",
x = "Pokémon",
y = "Estimated Catch Probability"
)
ggplot(pokemon, aes(x = pokemon, y = p_hat)) +
geom_point(size = 4) +
geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.15) +
coord_cartesian(ylim = c(0, 1)) +
labs(
title = "Estimated Catch Rates with 95% Confidence Intervals",
x = "Pokémon",
y = "Catch Probability"
)