Hypothesis Testing Notes
Hypothesis Testing Notes
STATISTICAL INFERENCE
SIGNIFICANCE TESTING; HYPOTHESIS TESTING
formulate hypotheses
distinguish between a type 1 and a type 2 error
compute probabilities of making type 1 and type 2 errors
apply a hypothesis test in the context of a single observation from a
population which has binomial distribution using either the binomial
distribution or the normal approximation to the binomial distribution
formulate hypotheses and apply a hypothesis test concerning population
mean using a sample drawn from a normal distribution of known variance
using the normal distribution
describe the characteristics of a t distribution
formulate hypotheses
apply a hypothesis test concerning population mean using a small sample
drawn from a normal distribution of unknown variance using a t – test
1
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
DEFINITION OF HYPOTHESIS
TYPES OF HYPOTHESES
FORMULATING HYPOTHESES
ERRORS
Type 1 error
- is the error of rejecting H0 when H0 is actually true.
2
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
Type 2 error
- consists of not rejecting H0 when H0 is false.
The errors can be summarised in the following table
DECISION
ACCEPT H0 REJECT H0
REALITY H0 IS TRUE Correct decision H0 wrongly rejected:
Type I error
H0 IS FALSE H0 wrongly accepted: Correct decision
Type II error
EXAMPLES
1. One rainy day during the summer holidays, a family of four were
playing a simple game of cards. The game was one of chance so the
probability of any particular person winning should have been 0,25.
After playing a number of games, Robert complained that his younger
sister Sarah must have been cheating as she kept winning. Their
parents quickly intervened and decided to carry out a proper
investigation and carefully watched the next 20 games.
a) Find the probability of a Type I error. Given that the critical region
is chosen to be X 9
b) If in fact Sarah was cheating and p = 0.35, find the probability of a
Type II error.
SOLUTION
a) H0 : p = 0,25 H1 : p > 0,25
Critical region X 9
P(Type I error) = P(rejecting H0 when H0 is true)
= P(X 9|X ∼ B(20, 0.25))
=P(X 9) = 1−P(X )
= 1−P(X=0)+P(X=1) + …+P(X=8)
= 20C0(0,25)0(0,75)20 +20C1(0,25) (0,6)19+…+20C20(0,25)20
= 0.0409
3
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
=P(X=0)+P(X=1) +…+P(X=8)
= 0.7624
2. It is known that 60% of the moths of a certain species are red; the rest
are yellow. A biologist finds a new colony of these moths and observes
that more of them seem to be red than she would expect. She designs
an experiment in which she will catch 10 moths at random, observe
their colour and then release them.
a) Given that the critical region is chosen to be X 9 find the
probability of making type 1 error?
b) If the proportion of red moths is 80%, find the probability of type II
error.
SOLUTION
a) H0 : p = 0,6 H1 : p > 0,6
Critical region X 9
P(Type I error) = P(rejecting H0 when H0 is true)
= P(X 9|X ∼ B(10, 0.6))
=P(X 9) = P(X=9) +P(X=10))
= 10C9(0,6)9(0,4) +10C10(0,6)10
= 0.046357401
=0,0464 to 3 s.f
SOLUTION
a) H0 : p = 0,6 H1 : p > 0,6
Critical region X 9
P(Type I error) = P(rejecting H0 when H0 is true)
= P(X 9|X ∼ B(10, 0.45) or P(X 1|X ∼ B(10, 0.45)
4
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
= P(X=9) +P(X=10))+P(X=0)+P(X=1)
= 10C9(0,45)9(0,55) +10C10(0,45)10+10C0(0,55)10+10C1 (0,45)1(0,,55)9
=0,004161743+0,00340506+0,002532951+0,020724149
= 0,027759351
=0,0278 to 3 s.f
FOLLOW UP EXERCISE
1. The random variable X is binomially distributed. A sample of 10 is
taken, and it is desired to test H0 : p = 0.25 against H1 : p >
0.25.The critical region for this test is X .
a) Calculate the probability of a Type I error for this test
b) Given that the true value of p was later found to be 0.30,
calculate the probability of a Type II error.
2. The random variable X is binomially distributed. A sample of 20 is
taken, and it is desired to test H0 : p = 0.30 against H1 : p < 0.30,
and the critical region for this test is
a)Calculate the probability of a Type I error for this test
b)Given that the true probability was later found to be 0.25,
calculate the probability of a Type II error.
- If you are carrying out a hypothesis test for the mean of a normal
distribution, the sample variance for a sample of size n will be .
-When a continuous distribution such as the normal distribution is used then
P(Type I error) is equal to the significance level of the test.
-For type II error you need the critical value in order to get the critical region
5
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
EXAMPLES
SOLUTION
H0 : μ = 150
H1: μ < 150 (i.e. a one-tailed test)
~N
148.02612
H0 is rejected if 148.02612 therefore to accept H0 we need
148.02612 when μ = 147
P( 148.02612) =P
SOLUTION
H0 : μ = 1,00 kg and H1 : μ ≠ 1,00 kg (i.e. a two-tailed test)
~N
The 5% critical region for Z is Z < −1,96 or Z > 1,96 (2,5% on each tail)
6
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
or
or
=P
FOLLOW UP TASK
7
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
SIGNIFICANCE LEVEL
TEST STATISTIC
P-VALUE
CRITICAL REGION
-is the range of values of the test value that indicates that there is a significant
difference and that the null hypothesis should be rejected.
-It is the region of the probability distribution function of the test statistic that
would allow the Null Hypothesis to be rejected.
CRITICAL VALUE
-The critical value separates the critical region from the noncritical region.
-The symbol for critical value is C.V.
8
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
9
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
-If the proportion of successful outcomes in the population is p then the test
statistic X~B(n, p), where n is the number in the sample.
-If the observed value x falls in the critical region, then, for one-tailed tests,
the P(X x) is or the P(X x) is , depending on the alternative
hypothesis and for two tailed test, P(X x) is or the P(X x) is
- Normal approximations to the binomial can be used where n is large np >5,
npq >5 where X~B(n, p) X~N(np; npq)
- When normal approximation is used remember to apply continuity correction
when calculating p value.
SOLUTIONS
Step 1: Let X be the number of successful treatments therefore X~Bin(n;p)
Step 2:H0: p = 0,4 H1: p > 0,4
Step 3: If H0 is true, then X~Bin(20; 0,4)
Step 4: This a right tailed test at = 0,05
Step 5: Reject H0 if P(X 11) 0,05
Step 6: Calculate the p value.
P(X 11) = P(X=11)=P(X=12) + …+P(X=20)
= +20C11(0,4)11(0,6)9 +20C12(0,4)12(0,6)8+…+20C20(0,4)20
= 0,12752016
= 0,1275
Step 7: Since P(X 11)>0,05 we fail to reject H0 and conclude that the
10
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
2. Hester suggested that the die was biased in favour of 4. She threw a die 15
times and obtained a four on 6 occasions. Carry out a test at 5 %
significance level.
SOLUTIONS
Step 1: Let X be the outcome of throwing a die therefore X~Bin(n; )
Step 2:H0: p = H1: p >
Step 3: If H0 is true, then X~Bin(15; )
Step 4: This a right tailed test at = 0,05
Step 5: Reject H0 if P(X 6) 0,05
Step 6: Calculate the p value.
P(X 6) = 1−P(X )=P(X=0) + …+P(X=5)
= 15C0 +15C1 +15C2 +15C3 +15C4
+15C5
= 0,9726
Step 7: Since P(X 6)>0,05 we fail to reject H0 and conclude that the die
is fair
SOLUTIONS
Step 1: Let X be the outcome of tossing a coin therefore X~Bin(n; )
Step 2:H0: p = H1: p
Step 3: If H0 is true, then X~Bin(20; )
Step 4: This a two tailed test at = 0,025
Step 5: Reject H0 if P(X 6) 0,025 or P(X 6) 0,025
Step 6: Calculate the p value.
P(X 6) = P(X=0) + …+P(X=6)
= 20C0 +20C1 +20C2 +20C3 +20C4
+20C5 +20C6
=0,05769
Step 7: Since P(X 6)>0,025 we fail to reject H0 and conclude that the
coin is fair
11
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
4. A manager thinks that his sales staffs make a sale to 45% of customers
entering their shop. He randomly selects 100 customers. Of the 100
customers, 35 were sold something. Using a suitable approximation test, at
the 5% level of significance, whether or not what the manager thinks is
justified.
SOLUTION
Step 1: Let X be the outcome of tossing a coin therefore X~Bin(n; )
Step 2:H0: p =0,45 H1: p 0,45
Step 3: If H0 is true, then X~Bin(100; 0,45)
Since n is large and np > 5 and npq >5, X~N(45; 24,75)
Step 4: This a two tailed test at = 0,025
Step 5: Reject H0 if P(X 35) 0,025 or P(X 35) 0,025
Step 6: Calculate the p value.
P(X 35) = P(X<35,5) apply continuity correction
=P
=P(Z<−1,91)
=1−0,9719
=0,0281
Step 7: Since P(X 35)>0,025 We fail to reject H0 and conclude there is
no evidence that the manager is wrong.
- The distribution of the means of samples from a normal population N(μ, σ2)
is indeed normal; its mean is μ and its standard deviation is .
12
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
EXAMPLES
1. The weights of students enrolling at a college have a standard
deviation of 7,5kg and mean of 70 kg. A random sample of 90 students
from the new entry was weighed and their mean weight was 71,6kg.
a) Assuming that the standard deviation has not changed test, at 5 %
significance level whether there is evidence that the mean is more than
70kg.
b) What is the importance of the central limit theorem in your test?
SOLUTION
a)Step 1: H0: = 70 H1: >70
Step 2: Since = 0.05 and the test is a right-tailed test, the critical
value is zcrit = 1.645. Reject H0 if zcal > 1,645
Step 3:Compute the test value Z
zcal = = = 2,0239
Step 4: Since zcal > 1,645 we reject H0 and conclude that there is
evidence that the mean is more than 70 kg.
b) The Central Limit Theorem is used to assume that (which is the
mean weight of 90 students) is normally distributed.
2. Observations over a long period of time have shown that the mass of
adult males of a type of bat is normally distributed with mean 110 g
and standard deviation 10 g. A scientist has a theory that in one area
these bats are becoming smaller, possibly as an adaptation to changes
in their environment. He plans to trap 20 adult male bats, weigh them
and then release them. The mean mass of the bats has reduced to 108 g
13
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
but the standard deviation has remained unaltered. Use the data to carry
out a suitable hypothesis test at the 5% significance level.
SOLUTION
a)Step 1: H0: = 110 H1: <110
Step 2: Since = 0.05 and the test is a left-tailed test, the critical
value is zcrit = −1.645. Reject H0 if zcal < −1,645
Step 3:Compute the test value Z
zcal = = = −0,8944
Step 4: Since zcal > −1,645 we fail to reject H0 and conclude that there
is no evidence that the mean mass has reduced.
3. A machine produces bolts of diameter D and D is normally distributed
with mean 0,58cm and standard deviation 0,015cm. The machine is
serviced and after the service a random sample of 50 bolts from the
production run is taken to see if the mean diameter of the bolts has
changed from 0,58cm. The distribution of the diameters after the
service is still normal with a standard deviation of 0,015cm. The mean
diameter of the 50 bolts is 0,577cm. Test at 1% whether the mean
diameter of the bolts has changed.
SOLUTION
a)Step 1: H0: = 0,58 H1: ≠ 0,58
Step 2: Since the test is a two-tailed test, = 0.005 and the critical
value is zcrit = −2,576 or 2,576. Reject H0 if zcal < −2,576 or zcal
>2,576
Step 3:Compute the test value Z
zcal = = = −1,414
Step 4: Since zcal > −2,576 we fail to reject H0 and conclude that there
14
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
- When variance is unknown and sample is large the test statistic is given by
where is an estimate.
- = and =
EXAMPLES
1. The packaging on a type of electric light bulb states that the average
lifetime of the bulbs is 1000 hours. A consumer association thinks that
this is an overestimate and tests a random sample of 64 bulbs,
recording the lifetime, x hours, of each bulb. You may assume that the
distribution of the bulbs’ lifetimes is normal. The results are
summarised as follows. n = 64, Σx = 63 910.4, Σx2 = 63 824 061
(i) Calculate unbiased estimates for the population mean and variance.
(ii) Carry out the test, at the 5% significance level, to test whether the
statement on the packaging is overestimating the lifetime of this type
of bulb.
SOLUTION
i) = = =998,6 and
= = 49,77079365
ii) Step 1: H0: = 1000 H1: <1000
Step 2: Since = 0.05 and the test is a left-tailed test, the critical
value is zcrit = −1.645. Reject H0 if zcal < −1,645
Step 3:Compute the test value Z
zcal = = = −1,58757
Step 4: Since zcal > −1,645 we fail to reject H0 and conclude that the
statement on the packaging is not overestimating the lifetime of this
type of bulb.
SOLUTION
15
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
= = =0,6
= = = 3,86
Step 1: H0: = 0 H1: ≠ 0
Step 2: Since the test is a two-tailed test, = 0.025 and the critical
value is zcrit = −1,96 or 1,96. Reject H0 if zcal < −1,96 or zcal >1,96
Step 3:Compute the test value Z
zcal = = = 0,983
Step 4: Since zcal <1,96 we fail to reject H0 and conclude that the mean
of the distribution is zero.
T DISTRIBUTION
of .
-There are a family of t distributions distinguished by degrees of freedom
where = n− 1.
CHARACTERISTICS OF A T DISTRIBUTION
16
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
-The distribution is symmetric about 0 so for 0,05 use the values under 1−0,05
= 0,95
EXAMPLES
Find the critical values for a) b)
SOLUTION
a) v = 4 and p = 1−0,01 =0,99 then 4 and 0,99 intersect at 3,747
b) v = 2 and p = 1−0,05 =0,95then 2 and 0,95 intersect at 2,920
- When the population standard deviation is unknown and sample size n small
(ie n < 30); the z test is not normally used for testing hypotheses involving
means. A different test, called the t test, is used.
- The test statistic T = with = n−1
-The stages for hypothesis testing are the same as for Z tests
EXAMPLES
17
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
SOLUTIONS
Step 1: H0: = 14,3 H1: ≠ 14,3
Step 2: Since the test is a two-tailed test, = 0.025 = 9 and the
critical value is = −2,262 or 2,262. Reject H0 if tcal < −2,262 or tcal
>2,262
Step 3: Compute the test value T
tcal = = = 2,76
Step 4: Since tcal >2,262 we reject H0 and conclude that the average
number of infections is not 14,3
2. An athlete finds that her times for running a race are normally
distributed with mean 10,6 seconds. She trains intensively for a week
and then records her time in the next 5 races. Her times, in seconds, are
10.70 ; 10.65; 10.75; 10.80 ;10.60; Is there evidence at 5 % level that
training intensively has improved her times
SOLUTIONS
= = = 10,7
= = = 0,079
Step 1: H0: = 10,6 H1: < 10,6
Step 2: Since the test is a one-tailed test, = 0.05 = 4 and the
critical value is = −2,132. Reject H0 if tcal < −2,132
Step 3: Compute the test value T
tcal = = = 2,83
Step 4: Since tcal >-2,132 we fail to reject H0 and conclude that the
race times have not improved.
SOLUTIONS
18
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
= = = 4,56
= = = 0,33
Step 1: H0: = 4,3 H1: > 4,3
Step 2: Since the test is a right-tailed test, = 0.05 = 7 and the
critical value is = 1,895. Reject H0 if tcal < 1,895
Step 3: Compute the test value T
tcal = = = 2,83
Step 4: Since tcal > 1,895 we fail to reject H0 and conclude that the
mean is 4,3.
19
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
8. The credit manager for a department store believes that the average
monthly credit account balances have changed from the historical
average of $5 870. the internal auditor took a random sample of 35
credit account balances and calculated the unbiased estimates of the
mean and variance to be $5 790 and $62 500 respectively.
(a) Explain whether a one-tailed test is appropriate. [2]
(b) Stating the null and alternative hypotheses clearly, test at 5%
significance level whether the sample evidence supports the credit
manager’s belief. [7] [NOV 2004 no 9]
9. The Zimbabwe consumer report (1999) states that the mean retail cost
of Nokia 5110 cellular phone was $600.00. A random sample of 10
stores in Harare, gave the following prices for this model,
593 621 545 561 609 555 588 575 619 599
a) Calculate the mean and standard deviation of the above data. [3]
b) Assuming that the retail costs of these cellular phones are normally
distributed, test at 10% level of significance whether this information
indicates that the population mean of the cost of the cellular phones is
less than $600,00. [6] NOV 2007 no 6
20
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
10. A dairy farmer claims that his milk bottles contain exactly one litre of
milk. A consumer took a random sample of 20 bottles and found that
the average contents to be 0.980 litres with a standard deviation of
0,070 litres. Test the farmer’s claim at 5% significance level. [6]
JUNE 2008 no 4
1. NOV 2009 no 8
HO: p = 0,2 H1: p ≠ 0,2
If Ho is true X Bin(20;0,2) At 5% reject Ho if P(X ≤ x)<0,025 or P(X x)
0,025
when x = 2, find P(X ≤ 2)
=P(X=0) + P(X=1) + P(X=1) + P(X=2)
=20C0 (0,8)20 + 20C1(0,8)19(0,2) + 20C2(0,8)18(0,2)1 + 20C3 (0,8)17(0,2)3
=0,20608
Since 0,20608 > 0,025 we fail to reject Ho and conclude that the claim
is valid.
21
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
=-1,9376
Since -1,9376 < -1,645 reject Ho and conclude it has decreased.
OR
Step 1: If H0 is true, then X~Bin(250;0,60)
X Bin(250;0,6) np =150 and nq =100 so since np> 5 and nq > 5
use Normal approximation X N(150;60)
Step 2: This a left- tailed test at = 0,05
Step 3: Reject H0 if P(X 135) 0,05
Step 4: Calculate the p value.
P(X 135) = P(X<135,5) apply continuity correction
=P
=P(Z<−1,87)
=1−0,9693
=0,0307
Step 5: Since P(X 135)<0,05 We reject H0 and it has decreased
=-2,3574
Since -2,3574 < -1,282 reject Ho and conclude that it commands less
than 60 % of the voters.
OR
Step 1: Let X ~Bin(300;0,6)
Step 2:H0: p = H1: p
Step 3: If H0 is true, then X~Bin(300;0.6)
np =180 , nq =120 and npq=72.
Since np> 5 and nq > 5 use Normal approximation X N(180;72)
Step 4: This a two tailed test at = 0,025
Step 5: Reject H0 if P(X 160) 0,025 or P(X 160) 0,025
22
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
4. [JUNE 2014 no 3]
P=
HO: p = 0,5 H1: p > 0,5
If Ho is true X Bin(5;0,5) At 5% reject Ho if P(X x) 0,025
when x = 4, find P(X 4)
=P(X=4) + P(X=5)
=5C4(0,5)4(0,5)+ 5C5(0,5)5
= 0,1875
Since 0,1875> 0,025 we fail to reject Ho and conclude that the coin is
not biased towards heads if at least 4 heads are obtained.
5. [JUNE 2015 no 7]
a) A 1-tailed test is one which looks for a definite increase or decrease
and uses > or < whilst
a 2-tailed test looks for any change and uses ≠
b) HO: = 12 H1: > 12
Use one tailed test(lupper tail ) at 5%. Zcrit =1,645. Reject Ho if Zcal
>1,645
Zcal = OR
= 5,208 or 5,18
Since Zcal >1,645 we reject Ho and conclude that rural secondary school
pupils travel a distance of more than 12km
6. [NOV 2017 no 6]
HO: = 1000 H1: < 1000
Use one tailed test(lower tail ) at 1%. Zcrit =-2,326. Reject Ho if Zcal <-
2,326
Zcal =
=−2,795
23
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
7. [2018 P1 no 9]
=
= = 0,994
=
= 0,270877
= 0,52
HO: = 1,10 H1: < 1,10
Use one tailed test(lower tail ) at 5%. Zcrit =−1,645. Reject Ho if Zcal
<−1,645
Zcal =
=−1,82
Since Zcal <−1,645 we reject Ho and conclude that the pockets contains
less than 1,10kg of manure
8. [NOV 2004 no 9]
a) Not appropriate because the belief is not specific on whether the
change is an increase or decrease.
b) HO: = 5 870 H1: 5 870
Use two tailed test at 5 %. Zcrit = ±1,960. Reject Ho if Zcal < -1,960 or >
1,960
Zcal =
=-1,893
Since -1,893 > -1,960 we fail to reject Ho and conclude that the
average monthly credit account balances have not changed.
9. NOV 2007 no 6
a) = = = 586,5
=
=25,3978
b)HO: = 600 H1: < 600
Use one tailed T test( lower tail ) at 10%. CV = -1,383 Reject Ho if t <-
1,383
24
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
=
=26,77
T=
=-1,5947 (can also use the biased standard deviation 25,3978 and get-
1,68)
Since Tcal <-1,383 we reject Ho and conclude that the population mean
of the cost of the cellular phones is less than $600,00.
=-1,242
Since tcal > -2,093 we fail reject Ho and conclude that the farmer’s
claim is true at 5% significance level.
= 2,87
Since t > 1,895 we reject Ho and conclude the mean is not 4.32
25
A LEVEL STATISTICS NOTES COMPILED BY MANYUVIRE D CELL 0783235483
and uses ≠
ii) A statistic is a calculation or measure from a sample and a
parameter is a measure from a population.
iii) A population is the entire group under study whilst a sample is part
of a population.
b) =
=
= 4,978
=
=
= 0,0037333
= 0,01932
HO: = 5 H1: ≠ 5
Use two tailed T test at 5%. Degrees of freedom is 9 and CV = ±3,250.
Reject Ho if t < −3,250
or t > 3,250
t=
= −3,6
Since t < −3,250 we reject Ho and conclude at 1% level of significance
that the machine is not in good working order.
26