Problem 1

A fair coin is tossed 100 times. The expected number of heads is 50, and the standard deviation for the number of heads is (100 · 1/2 · 1/2)1/2 = 5. What does Chebyshev’s Inequality tell you about the probability that the number of heads that turn up deviates from the expected number 50 by three or more standard deviations (i.e., by at least 15)?

\(E(Heads) = 50\)

\(\sigma = 5\)

Chebyshev’s Inequality

\(P(|X - \mu| \geq k\sigma) \leq \frac{\sigma^2}{k^2\sigma^2} = \frac{1}{k^2}\)

\(\frac{1}{k^2} = \frac{1}{3^2} = \frac{1}{9} = 0.11\)

There is an 11% probability that the number of heads deviates from the mean by 3 or more standard deviations.

Problem 2

The simulated probablility of the number of heads that deviates from the mean by 3 or more standard deviations is closer to 0%. Red lines on the graph are 3 standard deviations above and below the mean of zero.

#A Case is a simulation of 100 fair coin flips, one flip at a time
#Below is 100 Cases

#1 = heads
#0 = tails

x_range <- seq(1:100)
heads_flips <- c()
i <- 1
count <- 0

while(i <= 100){
  #pass 100 coin flips into the flips variable
  flips <- rbinom(100, size = 1, prob = .5)
  
  #find the sum of all the 1's (heads) and subtract it from the mean (mean = 50)
  sum <- sum(flips)-50
  
  #store the sum variable in the heads_flips vector
  heads_flips <- c(heads_flips, (sum(flips)-50))
  
  #find if the sum is 3 standard deviations (sd = 5) above or below the mean
  if(sum < -15 | sum  > 15){count <- count + 1}
  
  i <- i + 1
}

prob <- count/100
print(paste0("Probability of heads being more than 3 standard deviations from the mean is ", prob, "%"))
## [1] "Probability of heads being more than 3 standard deviations from the mean is 0%"
plot(heads_flips, type = 'l', ylim = c(-30, 30), ylab = "# Heads above/below SD", xlab = "Cases")
abline(h = 15, col = "red")
abline(h = -15, col = "red")