2025-11-17

Introduction

  • Goal: Estimate and compare catch rates for different Pokemon.
  • I will use confidence intervals for a proportion.
  • Example Pokemon: Pikachu, Caterpie, and Onix

Setup Data

  • For each Pokemon we observe multiple catch attempts.
  • For each one, we record
    • Number of attempts
    • Number of successful cathces
  • Then we estimate the catch rate (porportion of successes).

Data in R (Pokemon Catches)

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

ggplot: Estimated Catch Rates

ggplot: Catch Rates with 95% Confidence Intervals

plotly: CI Width vs. Sample Size and Catch Probability

R Code Summary (Part 1 — Data Setup)

# Create Pokémon catch data
pokemon <- data.frame(
  pokemon  = c("Pikachu", "Caterpie", "Onix"),
  caught   = c(112, 155, 70),
  attempts = c(200, 200, 200)
)

R Code Summary (Part 2 — CI Computation)

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
  )

R Code Summary (Part 3 — Bar Plot)

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"
  )

R Code Summary (Part 4 — Confidence Interval Plot)

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"
  )