Let \(S_{100}\) be the number of heads that turn up in 100 tosses of a fair coin. Use the Central Limit Theorem to estimate
# number of tosses
n <- 100
# probability of heads
p <- .5
z <- function(x, n, p) {
q <- 1 - p
np <- n * p
sq_npq <- sqrt(n*p*q)
return((x - np) / sq_npq)
}
\((a) P(S_{100} ≤ 45).\)
qa <- z(45, n, p)
qa
## [1] -1
pnorm(qa)
## [1] 0.1586553
\((b) P(45 < S_{100} < 55).\)
qb1 <- z(44.5, n, p)
qb2 <- z(54.5, n, p)
cat(qb1, 'to', qb2)
## -1.1 to 0.9
2 * (pnorm(1) - pnorm(0))
## [1] 0.6826895
\((c) P(S_{100} > 63).\)
qc <- z(63.5, n, p)
qc
## [1] 2.7
1 - pnorm(qc)
## [1] 0.003466974
\((d) P(S_{100} < 57).\)
qd <- z(56.5, n, p)
qd
## [1] 1.3
pnorm(qd)
## [1] 0.9031995