Varying the number of trials

In the last exercise you tried flipping ten coins with a 30% probability of heads to find the probability at least five are heads. You found that the exact answer was 1 - pbinom(4, 10, .3) = 0.1502683, then confirmed with 10,000 simulated trials.

Did you need all 10,000 trials to get an accurate answer? Would your answer have been more accurate with more trials?

This exercise is part of the course

Foundations of Probability in R

View Course

Exercise instructions

  • Try answering this question with simulations of 100, 1,000, 10,000, 100,000 trials.
  • Which is the closest to the exact answer?

Hands-on interactive exercise

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

# Here is how you computed the answer in the last problem
mean(rbinom(10000, 10, .3) >= 5)

# Try now with 100, 1000, 10,000, and 100,000 trials