What you'll learn
- How to write null and alternative hypotheses for an unknown proportion.
- How to choose between a lower-tailed, upper-tailed and two-tailed test.
- How to calculate exact probabilities using a binomial distribution.
- How to make and interpret a conclusion in the context of the question.
The setting: testing a proportion
A population proportion, denoted by ppp, is the unknown probability that a randomly selected member of a population has a particular property.
For example, ppp might represent:
- the proportion of customers who prefer a new product;
- the probability that a manufactured component is defective;
- the proportion of voters supporting a proposal.
You collect a random sample of size nnn and count the number of successes. This count is represented by the random variable XXX.
If the trials are independent and each has the same probability of success, then:
X∼B(n,p)X\sim\operatorname{B}(n,p)X∼B(n,p)where B(n,p)\operatorname{B}(n,p)B(n,p) is the binomial distribution.
Test statistic
The test statistic is the numerical result used to carry out the test. For a binomial proportion test, it is usually XXX, the number of successes in the sample.
Statistical hypotheses
A statistical hypothesis is a statement about an unknown population parameter. Here, the parameter is the population proportion ppp.
Every test begins with two competing hypotheses.
Null and alternative hypotheses
- The null hypothesis, written H0H_0H0, is the claim being tested. It normally states that the population proportion has a specified value: H0:p=p0H_0:p=p_0H0:p=p0.
- The alternative hypothesis, written H1H_1H1, describes the change or difference for which you are looking.
The value p0p_0p0 is the claimed proportion under the null hypothesis. It gives the binomial distribution used to calculate probabilities:
X∼B(n,p0)X\sim\operatorname{B}(n,p_0)X∼B(n,p0)Writing hypotheses
A company claims that 30% of its customers choose an annual subscription. A researcher believes that the true proportion is greater than 30%.
-
Let ppp be the population proportion of customers who choose an annual subscription.
-
The company's claim provides the null hypothesis:
H0:p=0.30H_0:p=0.30H0:p=0.30 -
The researcher is looking specifically for an increase, so the alternative hypothesis is:
H1:p>0.30H_1:p>0.30H1:p>0.30
Hypotheses about the sample
Write hypotheses about the population proportion ppp, not about the observed sample proportion. The sample result is evidence used to test the hypotheses.
Choosing the correct tail
The alternative hypothesis determines which results count as evidence against H0H_0H0.
Upper-tailed test
Use an upper-tailed test when you are investigating whether the proportion has increased:
H1:p>p0H_1:p>p_0H1:p>p0Unusually large values of XXX support this alternative.
Lower-tailed test
Use a lower-tailed test when you are investigating whether the proportion has decreased:
H1:p<p0H_1:p<p_0H1:p<p0Unusually small values of XXX support this alternative.
Two-tailed test
Use a two-tailed test when you are investigating whether the proportion has changed in either direction:
H1:p≠p0H_1:p\neq p_0H1:p=p0Both unusually small and unusually large values of XXX provide evidence against H0H_0H0.
The alternative chooses the tail
The wording of the investigation determines H1H_1H1, and H1H_1H1 determines which tail probability you calculate. Do not choose the tail after seeing the sample result.
Choosing the direction of a test
A machine is expected to produce 4% defective components.
- To investigate whether the defect rate has fallen, use H1:p<0.04H_1:p<0.04H1:p<0.04, so the test is lower-tailed.
- To investigate whether the defect rate has risen, use H1:p>0.04H_1:p>0.04H1:p>0.04, so the test is upper-tailed.
- To investigate whether the defect rate has changed, use H1:p≠0.04H_1:p\neq0.04H1:p=0.04, so the test is two-tailed.
Significance level and critical regions
The significance level, denoted by α\alphaα, is the maximum probability you are willing to allow for rejecting H0H_0H0 when it is actually true.
A test at the 5% significance level uses α=0.05\alpha=0.05α=0.05.
Critical region
The critical region is the set of test-statistic values that cause you to reject H0H_0H0. Its probability under H0H_0H0 must be no greater than the significance level.
For an upper-tailed test, the critical region usually has the form X≥cX\ge cX≥c. Choose the smallest integer ccc for which:
P(X≥c)≤αP(X\ge c)\le\alphaP(X≥c)≤αFor a lower-tailed test, it usually has the form X≤cX\le cX≤c. Choose the largest integer ccc for which:
P(X≤c)≤αP(X\le c)\le\alphaP(X≤c)≤αBecause the binomial distribution is discrete, the actual probability of the critical region is often less than α\alphaα.
Finding an upper critical region
Suppose X∼B(20,0.2)X\sim\operatorname{B}(20,0.2)X∼B(20,0.2) under H0H_0H0. Find the upper critical region for a 5% test.
-
Search for the smallest boundary ccc such that P(X≥c)≤0.05P(X\ge c)\le0.05P(X≥c)≤0.05.
-
A calculator gives:
P(X≥7)≈0.0867P(X\ge7)\approx0.0867P(X≥7)≈0.0867This is greater than 0.05, so X≥7X\ge7X≥7 would reject H0H_0H0 too frequently.
-
The next possible boundary gives:
P(X≥8)≈0.0321P(X\ge8)\approx0.0321P(X≥8)≈0.0321This is no greater than 0.05.
-
Therefore, the critical region is:
X≥8X\ge8X≥8Its actual significance level is approximately 3.21%.
For a two-tailed test at significance level α\alphaα, the significance is usually shared between the two tails. Each tail is chosen to have probability no greater than α2\frac{\alpha}{2}2α.
Finding a two-tailed critical region
Let X∼B(20,0.5)X\sim\operatorname{B}(20,0.5)X∼B(20,0.5) under H0H_0H0. Find a two-tailed critical region at the 5% significance level.
-
Allocate at most 2.5% to each tail:
α2=0.025\frac{\alpha}{2}=0.0252α=0.025 -
In the lower tail:
P(X≤5)≈0.0207,P(X≤6)≈0.0577P(X\le5)\approx0.0207,\qquad P(X\le6)\approx0.0577P(X≤5)≈0.0207,P(X≤6)≈0.0577Therefore the lower critical region is X≤5X\le5X≤5.
-
By symmetry:
P(X≥15)≈0.0207P(X\ge15)\approx0.0207P(X≥15)≈0.0207Therefore the upper critical region is X≥15X\ge15X≥15.
-
The complete critical region is:
X≤5orX≥15X\le5\quad\text{or}\quad X\ge15X≤5orX≥15Its total probability is approximately 0.0207+0.0207=0.04140.0207+0.0207=0.04140.0207+0.0207=0.0414, which is below 0.05.
The probability-value method
A probability value, often called a p-value, measures how likely it would be to obtain a result at least as extreme as the observed one, assuming H0H_0H0 is true.
For an observed value xxx:
- upper-tailed test: calculate P(X≥x)P(X\ge x)P(X≥x);
- lower-tailed test: calculate P(X≤x)P(X\le x)P(X≤x);
- two-tailed test: account for extreme results in both tails.
The decision rule is:
p-value≤α⇒reject H0,p-value>α⇒do not reject H0.\begin{aligned} \text{p-value}\le\alpha &\Rightarrow \text{reject }H_0,\\ \text{p-value}>\alpha &\Rightarrow \text{do not reject }H_0. \end{aligned}p-value≤αp-value>α⇒reject H0,⇒do not reject H0.Include the observed result
For an upper-tail calculation use P(X≥x)P(X\ge x)P(X≥x), not P(X>x)P(X>x)P(X>x). For a lower-tail calculation use P(X≤x)P(X\le x)P(X≤x), not P(X<x)P(X<x)P(X<x).
Conducting a complete test
A fair coin should land heads with probability 0.5. The coin is tossed 20 times and lands heads 16 times. Test at the 5% significance level whether the coin is biased towards heads.
Testing whether a coin favours heads
-
Let ppp be the probability that the coin lands heads. The hypotheses are:
H0:p=0.5,H1:p>0.5H_0:p=0.5,\qquad H_1:p>0.5H0:p=0.5,H1:p>0.5 -
Under H0H_0H0, the number of heads has distribution:
X∼B(20,0.5)X\sim\operatorname{B}(20,0.5)X∼B(20,0.5) -
Since H1:p>0.5H_1:p>0.5H1:p>0.5, calculate the upper-tail probability:
P(X≥16)=∑r=1620(20r)(0.5)r(0.5)20−r≈0.00591P(X\ge16)=\sum_{r=16}^{20}\binom{20}{r}(0.5)^r(0.5)^{20-r} \approx0.00591P(X≥16)=r=16∑20(r20)(0.5)r(0.5)20−r≈0.00591 -
Compare this with the significance level:
0.00591<0.050.00591<0.050.00591<0.05Therefore, reject H0H_0H0.
-
There is sufficient evidence at the 5% significance level to suggest that the coin is biased towards heads.
Accepting the null hypothesis
If the result is not significant, say there is insufficient evidence to reject H0H_0H0. Do not say that H0H_0H0 has been proved or accepted: the sample may simply be too small to detect a real difference.
Interpreting the conclusion
Your conclusion must contain three parts:
- the decision about H0H_0H0;
- the strength of evidence at the stated significance level;
- the conclusion in the original context.
A statistically significant result does not automatically mean that the difference is large or practically important. It means that the observed result would be sufficiently unlikely under H0H_0H0.
Evidence, not proof
A hypothesis test measures the strength of sample evidence. Rejecting H0H_0H0 does not prove H1H_1H1, and failing to reject H0H_0H0 does not prove that H0H_0H0 is true.
In the exam
- Define ppp in context and write both hypotheses using ppp, including equality in H0H_0H0.
- Use H1H_1H1 to select the correct tail before calculating any probability.
- State the distribution under H0H_0H0, including both parameters.
- Include the observed value in the tail probability and compare the result explicitly with α\alphaα.
- Finish with “sufficient evidence” or “insufficient evidence” and refer directly to the claim in the question.
Check yourself
- When would you use H1:p≠p0H_1:p\neq p_0H1:p=p0 rather than a one-tailed alternative?
- If P(X≥x)=0.073P(X\ge x)=0.073P(X≥x)=0.073 in a 5% upper-tailed test, what decision should you make?
- Why can the actual significance level of an exact binomial test be less than the stated significance level?