Chapter 5, Problem 14:

On the average, only 1 person in 1000 has a particular rare blood type.

  1. Find the probability that, in a city of 10,000 people, no one has this blood type.
  2. How many people would have to be tested to give a probability greater than 1/2 of finding at least one person with this blood type?

Solution:

Part a

Using the Poisson Distribution:

p <- 1 / 1000  
n_a <- 10000  
lambda_a <- n_a * p

P_a <- dpois(0, lambda_a)

P_a
## [1] 4.539993e-05

Part b

Using the binomial distribution:

n_upper_bound <- 2000 # it's unlikely to be more than a few thousands for the given probability

# sequence of potential n values
n_values <- seq(1, n_upper_bound)

# cumulative p of NOT finding a person with the rate blood type (P of 0 successes in n trials)
cumulative_probs <- pbinom(0, size = n_values, prob = p)

# finding first n for the required p (first n for cumulative P of 0 successes is less than 1/2)
n_required <- which(cumulative_probs < 0.5)[1]

n_required
## [1] 693