Using a simulation to test a proportion
In the exercise below, the question involves the proportion of 'successes', π. The observed number of 'successes' has a binomial distribution, so the test can be performed by simulating from a binomial distribution.
Repeat this exercise a few times until you have mastered the ideas — the concepts introduced here will help you to understand other types of hypothesis test.