Discussion 9

Tom Detzel

3/27/2018


Grimstead, p. 338


2. Let S200 be the number of heads that turn up in 200 tosses of a fair coin. Estimate:

(a) P(S200 = 100) = 0.0563

These probabilities will be very low because we’re asking about an exact outcome. We plot the distribution and then show the probability for X=k with a horizontal rule.

n = 200 # number of trials 
p = 0.50 # probability of success
x = 0:200 # vector of possible successes from 0 to 200

px = dbinom(x,n,p)

plot.new()
plot(x, px, type='h', xlab="Number of trials",
     ylab="Probability P(X=k)", col='blue', lwd=2)
abline(v=n*p, col='red', lwd=3)
abline(h=dbinom(100,200,0.5), col='gray', lty=2, lwd=2)
text(50, 0.053, paste('P(X=100) = ', round(dbinom(100,200,0.5),4)), font=3)


(b) P(S200 = 90) = 0.0208

n = 200 # number of trials 
p = 0.50 # probability of success
x = 0:200 # vector of possible successes from 0 to 200

px = dbinom(x,n,p)

plot.new()
plot(x, px, type='h', xlab="Number of trials",
     ylab="Probability P(X=k)", col='blue', lwd=2)
abline(v=n*p, col='red', lwd=3)
abline(h=dbinom(90,200,0.5), col='gray', lty=2, lwd=2)
abline(v=90, col='gray', lty=2, lwd=2)
text(50, 0.023, paste('P(X=90) = ', round(dbinom(90,200,0.5),4)), font=3)


(c) P(S200 = 80) = 0.001

n = 200 # number of trials 
p = 0.50 # probability of success
x = 0:200 # vector of possible successes from 0 to 200

px = dbinom(x,n,p)

plot.new()
plot(x, px, type='h', xlab="Number of trials",
     ylab="Probability P(X=k)", col='blue', lwd=2)
abline(v=n*p, col='red', lwd=3)
abline(h=dbinom(80,200,0.5), col='gray', lty=2, lwd=2)
abline(v=80, col='gray', lty=2, lwd=2)
text(50, 0.005, paste('P(X=80) = ', round(dbinom(80,200,0.5),4)), font=3)


Just for fun. Hat tip to dataanalysisclassroom.com.

```