Comparing the distributions of the normal and binomial for low n
When we flip a lot of coins, it looks like the normal distribution is a pretty close approximation. What about when we flip only 10 coins, each still having a 20% chance of coming up heads? Is the normal still a good approximation?
This exercise is part of the course
Foundations of Probability in R
Exercise instructions
- Generate 100,000 draws from the Binomial(10, .2) distribution. Save this as
binom_sample
. - Generate 100,000 draws from the normal distribution that approximates this binomial distribution, using the
rnorm()
function. Save this asnormal_sample
. - Compare the two distributions with the
compare_histograms()
function. (Remember that this takes two arguments: the two samples that are to be compared).
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Draw a random sample of 100,000 from the Binomial(10, .2) distribution
binom_sample <-
# Draw a random sample of 100,000 from the normal approximation
normal_sample <-
# Compare the two distributions with the compare_histograms function