Test statistic

When testing the value of a probability, π, the obvious statistic to use from our random sample is the corresponding sample proportion, p.

It is however more convenient to use the number of successes, x, rather than p since we know that X has a binomial distribution with parameters n (the sample size) and π.

X  ~  binomial (n , π)

When we know the distribution of the test statistic (at least after the null hypothesis has fixed the value of the parameters of interest), it becomes much easier to obtain the p-value for the test.

P-value

As in all other tests, the p-value is the probability of getting such an 'extreme' set of data if the null hypothesis is true. Depending on the null and alternative hypotheses, the p-value is therefore the probability that X is as big (or sometimes as small) as the recorded value.

Since we know the binomial distribution of X when the null hypothesis holds, the p-value can therefore be obtained by adding binomial probabilities.

The p-value is a sum of binomial probabilities

Note that the p-value can be obtained exactly without need for simulations or randomisation.

Weapon detection at LAX

FAA agents tried to carry 100 weapons onto planes at LA International Airport, and 72 of these were detected by security guards. Is this consistent with the national probability of detection, 0.80?

H0:   π = 0.80

HA:   π < 0.80

In the diagram below, click Accumulate then hold down Simulate until about 100 samples of 100 values have been generated. The proportion of these simulated samples in which 72 or fewer weapons are detected is an approximation to the p-value for the test.

Since we know that the number detected has a binomial (100, 0.80) distribution when the null hypothesis holds, the simulation is unnecessary. Select Binomial distribution from the pop-up menu. This binomial distribution is displayed, and the probability of 72 or fewer detected weapons is shown to be 0.0342 — the p-value for the test.

Since the p-value is so small, there would have been very little chance of the observed data arising if LAX had probability 0.80 of detection. We can therefore conclude that there is strong evidence that the probability of detection is lower than this. Note that this can be done without any simulations.