Comparing the cumulative density of the binomial

If you flip 1000 coins that each have a 20% chance of being heads, what is the probability you would get 190 heads or fewer?

You'll get similar answers if you solve this with the binomial or its normal approximation. In this exercise, you'll solve it both ways, using both simulation and exact calculation.

This exercise is part of the course

Foundations of Probability in R

View Course

Exercise instructions

  • Use the simulated binom_sample (provided) from the last exercise to estimate the probability of getting 190 or fewer heads.
  • Use the simulated normal_sample to estimate the probability of getting 190 or fewer heads.
  • Calculate the exact probability of the binomial being <= 190 with pbinom().
  • Calculate the exact probability of the normal being <= 190 with pnorm().

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Simulations from the normal and binomial distributions
binom_sample <- rbinom(100000, 1000, .2)
normal_sample <- rnorm(100000, 200, sqrt(160))

# Use binom_sample to estimate the probability of <= 190 heads


# Use normal_sample to estimate the probability of <= 190 heads


# Calculate the probability of <= 190 heads with pbinom


# Calculate the probability of <= 190 heads with pnorm