Test statistic
A test about a probability, π, could be based on the corresponding sample proportion, p, but it is more convenient to use the number of successes, x, rather than p since we know its distribution,
X ~ binomial (n , π)
P-value
The p-value is the probability of getting such an 'extreme' set of data if the null hypothesis is true. Since we know the binomial distribution of X when the null hypothesis holds,
The p-value is a sum of binomial probabilities
Note that the p-value can be obtained exactly without need for simulations or randomisation.
Example
In 100 values from a categorical population, 72 successes were observed. Is this consistent with probability π = 0.80 of success, or is the probability of success lower?
H0: π = 0.80
HA: π < 0.80
If the null hypothesis is true, we know the distribution of the number of successes, X,
The p-value for the test is the probability of observing 72 or fewer successes, assuming that the null hypothesis holds. Since this is 0.0342, we conclude that there would be little chance of seeing as low a number of successes if π = 0.80, so
There is moderately strong evidence that π < 0.80