Hypothesis Testing Lect Notes (TR S)
Hypothesis Testing Lect Notes (TR S)
Suppose a college claims that students will score an average of 72 marks for
Mathematics in the Preliminary Examination based on historical data. The
parameter of interest is the mean mark, μ, obtained by students which is
claimed to be 72, i.e. we claim that μ = 72.
A Mathematics teacher who has a class of 25 students suspects that this figure
is too high, and instead claims that < 72. In fact, based on the results of a
recent test, he believes that a better estimate would be = 60. How do we then
decide between the validity of the college’s claim and the teacher’s claim? We
can answer this question using the statistical procedure called hypothesis
testing.
We then use the sample data and our knowledge of statistical theory to decide
whether the sample data supports the alternative hypothesis. If the sample
data supports the alternative hypothesis, then we conclude that there is
evidence to say that the alternative hypothesis is a more reasonable claim than
the null hypothesis. Hence, we will reject the null hypothesis in favour of the
alternative hypothesis. On the other hand, if the sample data does not support
the alternative hypothesis, we will have no evidence to say that the null
hypothesis is false. Hence, we will not reject the null hypothesis, and continue
to believe in the truth of it.
1. Statistical Hypothesis
It is an assumption about the value of a population parameter.
2. Hypothesis Testing
It is the process of testing the validity of the statistical hypothesis based
on observations made from random samples taken from the population.
3. Null Hypothesis, H0
This is a statement about a parameter of the population which is
initially, or conventionally believed to be true. It could be
(i) a value that occurred in the past,
(ii) a value claimed by some person, or
(iii) a (target) value that is supposed to occur.
4. Alternative Hypothesis, H1
This is a statement about the parameter of the population mentioned in
the null hypothesis being different from what is initially, or
conventionally believed to be true. The proposition of an alternative
hypothesis is typically due to a researcher having found evidence from
sample data, or having fresh insights about the situation, that seems to
suggest the null hypothesis may not hold anymore.
Example 2.1
(iv) The principal of a school claims that the mean ‘A’ level points of all its
students is at least 80. Has the principal overstated the mean?
Solution
5. Test Statistic
A sample statistic which is used to make the decision whether or not
to reject H0 is called the test statistic. We select a random sample from
the given population and observe its relevant test statistic with respect
to the parameter of interest.
Example 2.2
2
If H0 is true, then X ~ N 0, .
n
X
So Z 0
~ N(0,1) . (after standardization)
/ n
x
Test Statistic: z 0
/ n
Note: A test that involves calculating and comparing the values of z is called a
z-test.
In hypothesis testing, the null hypothesis may be rejected (or not rejected) not
with certainty but with confidence that the likelihood of error in making the
decision is small. We control the chance of wrongly rejecting the null
hypothesis, that is, reject null hypothesis when it is actually true. This is
known as the significance level of the test.
6. Level of Significance,
For example, if the level of significance is set at 5%, we are saying that
there is a 5% chance (or probability of 0.05) that one chooses to reject
H0 when H0 is actually correct.
This value is typically set low so that the chance of wrongly rejecting
H0 is kept low. Typical significance levels used are 10%, 5% and 1%.
The level of significance determines the set of values of the test statistic
for which H0 will be rejected. This set of values of the test statistic is
called the critical region or the rejection region. The boundaries of
the critical region are called the critical values. If the observed or
calculated value of the test statistic falls within the critical region, we
reject H0, and if it falls outside the critical region, we do not reject H0.
8. The p-value
§3 Types of Tests
There are two types of test, depending on how the alternative hypothesis, H1, is
formulated.
This test looks for any difference or change in the parameter tested.
Suppose we have a sample of size n with sample mean x , taken from a normal
population with variance 2 and it is claimed that the population mean is 100.
0.05
If z falls within this
critical (shaded) region, we
reject H0.
1.96 0 1.96
z 1.96 z 1.96
OR
Step 4(b): Method 2: Using p-value
Using GC, we calculate the p-value
x 100
=P Z z P Z .
/ n
We will reject H0 if our p-value < 0.05.
x 100
p-value = P Z z P Z
/ n
1.96 0 1.96
z z
If z zcritical (or p-value > 0.05), then we do not reject H0, and
conclude that there is insufficient evidence at 5% level of
significance to claim that the population mean is not equal to
100.
Note:
In general, for a two-tailed test, the critical region at 100% level of
significance is z z or z z . We will reject H0 if our test statistic z
2 2
Suppose we have a sample of size n with sample mean x , taken from a normal
population with variance 2 and it is claimed that the population mean is
greater than 50.
X 50
Step 3: Since population is normal, under H0, Z ~ N(0,1) .
/ n
x 50
Test statistic: z .
/ n
EITHER
Step 4(a): Method 1: Using critical region and observed test statistic, z
0.05
If z falls within this
critical (shaded) region, we
reject H0.
0 1.645
z 1.645
OR
Step 4(b): Method 2: Using p-value
Using GC, we calculate the p-value
x 50
=P Z z P Z .
/ n
We reject H0 if the p-value < 0.05.
Critical Region, 0.05 probability
x 50
p-value = P Z z P Z
/ n
0 1.645
z
If z zcritical (or p-value < 0.05), then we reject H0, and conclude
that there is sufficient evidence at 5% level of significance to
claim that the population mean is greater than 50.
If z zcritical (or p-value > 0.05), then we do not reject H0, and
conclude that there is insufficient evidence at 5% level of
significance to claim that the population mean is greater than
50.
Note:
In general, for an upper-tailed test, the critical region at 100% level of
significance is z z(1 ) . We will reject H0 if our observed test statistic z
falls within the critical region, i.e. z z(1 ) or if p-value < .
Suppose we have a sample of size n with sample mean x , taken from a normal
population with variance 2 and it is claimed that the population mean is less
than 15.
EITHER
Step 4(a) Method 1: Using critical region and observed test statistic, z
0.05
If z falls within this
critical (shaded) region,
we reject H0.
1.645 0
z 1.645
OR
Step 4(b): Method 2: Using p-value
Using GC, we calculate the p-value
x 15
=P Z z P Z .
/ n
We reject H0 if the p-value < 0.05.
x 15
p-value = P Z z P Z
/ n
1.645 0
z
If z zcritical (or p-value < 0.05), then we reject H0, and conclude
that there is sufficient evidence at 5% level of significance to
claim that the population mean is less than 15.
If z zcritical (or p-value > 0.05), then we do not reject H0, and
conclude that there is insufficient evidence at 5% level of
significance to claim that the population mean is less than 15.
Note:
In general, for a lower-tailed test, the critical region at 100% level of
significance is z z . We will reject H0 if our test statistic z falls within the
critical region, (i.e. z z ) or if p-value < .
Example 3.1
Experience has shown that the scores obtained in a particular test are normally
distributed with mean score 70 and variance 36. When the test is taken by a
random sample of 36 students, the mean score is 68.5. Is there sufficient
evidence, at 3% level of significance, that these students have not performed as
well as expected?
Solution
Let X be the random variable for the score of the particular test and be its
population mean.
From the sample data, n 36 and x 68.5.
H0: μ = 70
H1: μ < 70
X 70
Since population is normal, under Ho, Z ~ N(0,1)
36
36
x 70
Test Statistic: , z .
/ n
0.03
1.881 0
1.5
Since z 1.5 1.881 lies outside the critical region, we do not reject H0.
Step 1:
“STAT” “TESTS” (on the top menu) Choose the
appropriate test “1 : Z-Test”
Step 2:
Select Input “Data” or “Stats”. If “Data” is selected, then
enter the list in which the data is found. If “Stats” is
selected, then enter the statistics like , x and n.
The next screen will show you the results of the z-test.
The z-value shown is the test statistic, z. The p-value is
also shown.
In our syllabus, we shall focus on tests involving the population mean only.
In this section, we shall discuss the various situations you will encounter in
problems involving testing of population means.
2
4.1 Population Variance, is Known
X
In all cases, under H0, Z 0
~ N(0,1) .
/ n
x 0
Test Statistic: z
/ n
X 0
Under H0, T ~ t v , where v = n – 1 (degrees of freedom),
S n
x 0
Test Statistic: t
s n
Z ~ N 0 ,1
t distribution
t distribution
v 2
v 9
In performing the t-test, we go about effectively the same way as for the Z-test.
Two-Tailed t-test
t 0 t
2 2
Critical Region
p-value
x 0
= P T t P T
s/ n
t 0 t
2 2
t t
One-Tailed t-test
(A) Upper-Tailed
0 t(1 )
Critical Region
p-value
x 0
= P T t P T
s/ n
0 t(1 )
(B) Lower-Tailed
t 0
Critical Region
p-value
x 0
= P T t P T
s/ n
t 0
t
We reject H0 if test statistic, t falls within the critical region ie. t tcritical t
or if p-value < α.
Note: We will treat the term “degree of freedom” merely as a parameter of the
t-distribution. An in-depth understanding of the meaning of the term is
beyond the scope of the syllabus.
X
Under H0, Z 0
~ N(0,1) approximately.
S/ n
x 0
Test statistic: z
s/ n
Note: In both cases, we use the unbiased estimate of the population variance
s2, in place of the true population variance 2 , which is an unknown.
Example 4.1
‘Family’ packs of bacon slices are sold in 1.5 kg packs. A sample of 50 packs
was selected at random and the masses x, measured in kg, are noted. The
following results were obtained :
2
x 0.2 64.2 and x 0.2 85 .
Assuming that the masses of the packs follow a normal distribution with
variance σ2, test at 1% level whether the packs are significantly underweight if
2 2
(a) 0.002 , (b) is unknown.
Solution
2
(a) 0.002
H0: = 1.5
H1: < 1.5
Level of significance: 1% (lower-tailed)
X 1.5
Since population is normal, under H0, Z ~ N(0,1) .
/ n
x 1.5
Test statistic: z
/ 50
p-value = 0.00571
2 2
2 2 1 2 y 1 64.2
s x s y y 85 0.052392
n 1 n 49 50
H0: = 1.5
H1: < 1.5
1.484 1.5
z 0.494
0.052392
50
2.326 0
Since z 0.494 2.326 , we do not 0.494
reject H0.
p-value = 0.311
Example 4.2
Solution
Let X be an observation in the normal distribution.
n
Unbiased estimate of population variance, s 2 x
2
n 1
100 2
14.5 212.373
99
H0: 50
H1: 50
In order to be able to reject H0, we need p-value < α, i.e. α > 0.0372024
Hence, the least value of is 0.0373 (to 3 sig. fig.).
Example 4.3
64 73 71 72 67 74
It was claimed that the mean height of 5-years-old children in Utopia has
increased.
(i) Carry out a suitable hypothesis test on the claim at 5% level of
significance, stating any assumptions made.
(ii) It was found that the standard deviation in height of 5-years-old children
in Utopia was 0.2. Carry out a suitable hypothesis test on the claim at
5% level of significance, stating any assumptions made.
Solution
(i) Let X be the height of a 5-years-old child in Utopia.
H0: 70
H1: 70
X 70
Under H0, T ~ t (5)
S
6
x 70
Test Statistic: t
s
6
p-value = 0.460
Note: We can also use the t-distribution Table (in MF15) to obtain the Critical
Value(s) for t-distribution. Refer to Appendix for the technique required to
find the critical value in Example 4.3.
Step 1:
Select “2nd" “Var” to activate the
“Distr” Options.
Select item 4 “invT(”
Step 2:
Enter the parameters as follows:
area : 0.95
df :5
i.e. entering “invT(0.95, 5)”
In this problem,
0.05
0 2.015
degree of freedom, v = n – 1 = 6 – 1 = 5
Step 1:
Enter the 6 data values into List L1.
Step 2:
“STAT” “TESTS” (on the top menu)
Choose the appropriate test “2 : T-Test”
Step 3:
Select Input “Data” or “Stats”. In this problem,
we select “Data”.
Note:
1. A similar procedure can be used to carry out a z-test when the full sample
data is given.
2. If only summarised data is given to carry out a t-test, refer to the
procedure on Page 12 (but use a t-test instead of a z-test).
(ii)
H0: 70
H1: 70
X 70
Under H0, Z ~ N(0,1)
0.2 / 6
x 70
Test Statistic: z
0.2 / 6
Note:
In the event that a population distribution in a question is not given to be
2
normal, the sample size is small and unknown, we may need to assume that
the population is normal in order to carry out a t-test. Likewise, if sample size
2
is small but known, we also need to assume a normal population for a z-
test to be valid.
Example 4.4
Solution
(i) Let X be the mass of a watermelon in kg.
H0: 2
H1: 2
X 2
Under H0, Z ~ N(0,1)
0.5 / 50
x 2
Test Statistic: z
0.5 / 50
1.645 0 1.645
x 2
1.645 1.645
0.5 / 50
0.1163 x 2 0.1163
1.88 x 2.12
(ii) H0: 3
H1: 3
15 2
Unbiased estimate of population variance, s 2 0.6 0.3857
14
X 3
Under H0, T ~ t (14 )
S
15
x 3
Test Statistic: t
s
15
x 3
t
s
15
x 3
we must have 1.761 x 2.71756
s
15
Remark:
We cannot compute p-value in Example 4.4 since x is unknown.
APPENDIX
P(T t)
degree of freedom
In this problem, we may obtained the critical value by looking for a value of
P(T t ) 0.95 and (6 – 1) = 5 degree of freedom.
(Refer to the next page for the full t-distribution table available in MF15.)
SUMMARY
Sample Size, n
Population Small ( n 30 ) Large ( n 30 )
2
Variance,
X X 0
Z 0
N(0,1) Z N(0,1)
2 n n
known
X must be normally distributed. Otherwise we must assume X X may be normally distributed. If not, we may
is normally distributed. approximate X to a normal distribution by applying
Central Limit Theorem.
X X 0
2 T
0
~ t v ,where v = n – 1 Z N(0,1)
unknown S s
n n
(use of unbiased
estimate for population
variance, s) X must be normally distributed. Otherwise we must assume X X may be normally distributed. If not, we may
is normally distributed. approximate X to a normal distribution by applying
Central Limit Theorem.