A balanced coin is flipped 400 times. Determine the number x such that the probability that the number of heads is between 200 ??? x and 200 + x is approximately .80.
Solution:
P(200 - x < X < 200 + x | pi =.5) = 0.8
We need to calculate 10th percentile on both sides
times <- 400
approx_p <- .8
pi <- .5
percentile <- (1 - approx_p)/2
t <- qbinom(percentile, times, pi)
x <- (200 - t)
x
## [1] 13