Finding the p-value for a one-tailed test

The Australia Post hypothesis test involved a random sample of size n from a population with probability π of success (delivery on time). The data collected were x successes, and we tested the hypotheses...

H0 :   π  =  π0
HA :   π  <  π0

where π0 was the constant of interest (e.g. 0.80 in this example). The following steps were followed to obtain the p-value for the test.

  1. The sample proportion of successes, p, was identified as the most informative summary statistic about π.
  2. The number of successes, x = np has a standard binomial distribution with no unknown parameters when H0 holds, so it is a better test statistic.
  3. The p-value is a sum of tail probabilities for this binomial distribution.

The diagram below illustrates these steps

The telepathy example was similar, but the alternative hypothesis involved high values of π and the p-value was found by counting upper tail probabilities.

Finding the p-value for a two-tailed test

The appropriate tail probability to use depends on the alternative hypothesis. If the alternative hypothesis allows either high or low values of x, the test is called a two-tailed test,

H0 :   π  =  π0
HA :   π  ≠  π0

The p-value is then double the smaller tail probability since values of x in both tails of the binomial distribution would provide evidence for HA.

Ethics codes in companies

In 1999, The Conference Board surveyed 124 companies and found that 97 had their own ethics codes ("Business Bulletin", Wall Street Journal, Aug 19, 1999). In 1997, it was believed that 72% of companies had ethics codes, so is there any evidence that the proportion has changed?

This question is equivalent to asking whether a sample proportion of 97 out of 124 is consistent with sampling from a population with π = 0.72. This can be expressed as the hypotheses

H0 :   π  =  0.72
HA :   π  ≠  0.72

We would expect about (0.72 x 124) = 89 of the companies to have ethics codes. A sample count that is either much greater than 89 or much less than 89 would suggest that the probability had changed. Use the slider below to obtain the p-value.

The probability of getting as many as 97 is 0.0718. Since this is a 2-tailed test, we must also take account of the probability of getting a count that is as unusually low, so the p-value is twice this, 0.1436. Getting 97 companies with ethics codes is therefore not unlikely, so we conclude that there is no evidence from these data of a change in the proportion of companies with ethics codes since 1997.