Hypothesis Testing
Hypothesis Testing
Example 2:
It is known that approximately 15% of the students on a college
are regular smokers. An anti-smokers campaign is launched
island-wide to make students aware of the negative effects of
smoking on health. A month after the campaign, a survey of 72
students showed that 15 smoked regularly. Does it indicate that
the campaign was successful in reducing the percentage of
smokers?
WHAT IS HYPOTHESIS TESTING?
Hypothesistesting is a procedure whereby we decide,
on the basis of information taken from a sample,
whether to accept or reject a hypothesis.
- NULL HYPOTHESIS : 𝑯𝟎
-ALTERNATIVE HYPOTHESIS : 𝑯𝟏
THE NULL HYPOTHESIS & ALTERNATIVE HYPOTHESIS
Null Hypothesis
Hypothesis to be test.
In general, the complement of the conclusion that
the researcher is seeking to reach becomes the
statement of null hypothesis.
Notation : H0
Alternative Hypothesis
What we suppose or what will happen if null
hypothesis is not correct
Notation : H1
RULES FOR STATING STATISTICAL HYPOTHESES
Ex
H0 : = 1000 vs. H1 : ≠ 1000
H0 : ≥ 1000 vs. H1 : < 1000
H0 : ≤ 1000 vs. H1 : > 1000
IDENTIFICATION OF THE TEST STATISTICS
The test statistic may assume many possible values which
depends on the particular sample drawn.
The test statistic acts as a decision-maker.
For example, When we want to test about population mean
when population variance is known,
H0 : = 0 vs H 1 : ≠ 0
The probability of type I error () is called the level of the test or
significance level.
SIGNIFICANCE LEVEL
Significance level
The maximum probability of committing type I error,
which we specified in a test. (denoted by )
It specifies the area under the curve of the distribution.
If =0.05
There is 95% confidence in accepting a hypothesis or
it could be wrong 5%.
/2
/2
(Significance
level)
ONE TAILED
Weperform one tailed test, when the alternative
hypothesis is of the form “greater than ” or “Less than”.
Non-rejection Region
1-
When hypothesis is
H0 : ≤ 0 Vs H1 : > 0
Non-rejection Region Rejection
(Right tailed test) 1- Region
TWO TAILED TEST
When the alternative hypothesis is of the form “not equal
to”, we perform two tailed test,
When hypothesis is H0 : = 0 Vs H1 : ≠ 0
Significance level
Significance
level
-3 -2 -1 0 1
1 22 3
3
z
-3 -2 -1 0 1 z 2 3
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
ii. H0 : ≥ 0 vs H1 : < 0
iii. H0 : = 0 vs H1 : ≠ 0
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Case I : Data from normal population with known
variance
Corresponding estimator for population mean is,
sample mean .
Test statistic :
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Case II : Data from normal population with unknown
variance and Sample size is large
Corresponding estimator for population mean is,
sample mean .
Test statistic :
ഥ − 𝝁𝟎
𝒙
~𝑵(𝟎, 𝟏)
𝑺ൗ
𝒏
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Case III : Data from normal population with unknown
variance and sample size is small
When σ is Unknown, 𝜎ො = 𝑆. Corresponding estimator
for population mean is, sample mean .
Test statistic :
ഥ − 𝝁𝟎
𝒙
~𝒕(𝒏−𝟏)
𝑺ൗ
𝒏
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Example:
1. A study was done on voltage measurements for a sample of
66 industrial networks in Canada. The sample mean voltage
was 231.7V and voltage has population standard deviation of
2.19V. Assume that the rated voltage for these networks is at
most 232V. Perform the hypothesis testing at 5% significance
level (𝛼 = 0.05) .
𝜇0 = 232
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Step 2: Calculate the test statistics
Since n is large and 𝜎 is known
ഥ−𝝁𝟎
𝒙 𝟐𝟑𝟏.𝟕−𝟐𝟑𝟐
Test Statistic = 𝝈 = 𝟐.𝟏𝟗
ൗ 𝒏 ൗ 𝟔𝟔
−𝟎.𝟑
= = −1.1132
𝟎.𝟐𝟔𝟗𝟓
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Step 3: Find the critical value (here use standard normal
table)
𝐻1 : 𝜇 > 232 𝛼 =0.05
-1.1132 1.645
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Test statistic is not in the rejection region. It is less than
the critical value.
Therefore 𝑯𝟎 cannot be rejected at 5% significance
level. There is no enough evidence to conclude that the
mean voltage for these networks is greater than 232V.
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
2. 100 measurements of a known quantity ; 𝑛 = 100
The sample mean error was 25μm; 𝑥ҧ = 25μm
Sample standard deviation of 60μm; s =60μm.
𝜇0 = 0
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Since n is large and 𝜎 is unknown.
ഥ−𝝁𝟎
𝒙 𝟐𝟓−𝟎
Test Statistic = 𝒔 = 𝟔𝟎
ൗ 𝒏 ൗ 𝟏𝟎𝟎
𝟐𝟓
= = 4.1667
𝟔
−𝑧𝛼/2 0 𝑧𝛼/2
𝒛𝜶/𝟐 = 1.96 and −𝒛𝜶/𝟐 = −𝟏. 𝟗𝟔 (Using standard normal
table)
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Non-Rejection
Region
Rejection Rejection
Region Region
−1.96 0 1.96
4.1667
test whether the mean of sick days are below 5.4 days.
𝐻0 : 𝜇 ≥ 5.4 𝑉𝑠 𝐻1 : 𝜇 < 5.4
𝜇0 = 5.4
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Since n is small and 𝜎 is unknown,
ഥ−𝝁𝟎
𝒙 𝟒.𝟓−𝟓.𝟒
Test Statistic = 𝒔 = 𝟐.𝟕
ൗ 𝒏 ൗ 𝟐𝟓
−𝟎.𝟗
= = −1.667
𝟎.𝟓𝟒
𝐻1 : 𝜇 < 5.4
n-1 = 24 and 𝛼 =0.01
𝛼 =0.01 using t-table,
Critical value = −𝒕𝟐𝟒,𝟎.𝟎𝟏 = −𝟐. 𝟒𝟗𝟐
−𝑡𝛼 0
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
Non-Rejection
Rejection Region
Region
-2.492 0
-1.667
ii. H0 : p ≥ p0 vs H1 : p < p0
iii. H0 : p = p0 vs H1 : p ≠ p0
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION
Case IV :
Corresponding estimator for population proportion p is,
sample proportion 𝑝ෝ .
Test statistic :
𝒑ෝ − 𝒑𝟎
~𝑵(𝟎, 𝟏)
𝒑𝟎 (𝟏 − 𝒑𝟎 )
𝒏
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION
Example:
1. In a survey of 500 residents in a certain town, 274 said they
were opposed to constructing a new shopping mall. Can you
conclude that more than half of the residents in this town are
opposed to constructing a new shopping mall at 2.5%
significance level?
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION
Answer:
3. 𝑛 = 500
Number of residents who were opposed to the
decision = 274; 𝑥 = 274
𝑥 274
𝑝Ƹ = = = 0.548
𝑛 500
𝑝0 = 0.5
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION
Answer:
𝒑ෝ −𝒑𝟎 𝟎.𝟓𝟒𝟖−𝟎.𝟓𝟎𝟎
Test Statistic = = 𝟎.𝟓 (𝟏−𝟎.𝟓)
𝒑𝟎 (𝟏−𝒑𝟎 )
𝒏 𝟓𝟎𝟎
𝟎.𝟎𝟒𝟖
= = 2.1429
𝟎.𝟎𝟐𝟐𝟒
𝐻1 : 𝑝 > 0.5
0.025 𝛼 =0.025
using standardized normal table,
Critical value = 𝒛𝟎.𝟎𝟐𝟓 = 𝟏. 𝟗𝟔
0 𝑧𝛼
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION
Answer:
Non-Rejection Rejection
Region Region
0 1.96
2.149
H0 : μx ≥ μy vs H1 : μx < μy or
H0 : μx – μy ≥ 0 vs H1 : μx – μy < 0
H0 : μx = μy vs H1 : μx ≠ μy or
H0 : μx – μy = 0 vs H1 : μx – μy ≠ 0
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Case V : Data from two independent samples with
known variances
Corresponding estimator for population mean x is,
sample mean and population mean y is, sample mean
𝑦.
ത
Test statistic :
(ഥ ഥ) − (𝝁𝒙 − 𝝁𝒚 )
𝒙−𝒚
~𝑵(𝟎, 𝟏)
𝟐
𝝈𝟐𝒙 𝝈𝒚
+
𝒏𝒙 𝒏𝒚
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Case VI : Data from two independent samples with
unknown variances and both samples sizes are large
Corresponding estimator for population mean x is,
sample mean and population mean y is, sample mean
𝑦.
ത
Test statistic :
(ഥ ഥ) − (𝝁𝒙 − 𝝁𝒚 )
𝒙−𝒚
~𝑵(𝟎, 𝟏)
𝟐
𝒔𝟐𝒙 𝒔𝒚
+
𝒏𝒙 𝒏𝒚
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Case VII : Data from two independent samples with
unknown variances(but equal) and at least one samples
size is small
Corresponding estimator for population mean x is,
sample mean and population mean y is, sample mean
𝑦.
ത
Test statistic : (ഥ ഥ) − (𝝁𝒙 − 𝝁𝒚 )
𝒙−𝒚
~𝒕(𝒏𝒙+𝒏𝒚 −𝟐, 𝜶/𝟐)
𝟏 𝟏
𝒔𝒑 +
𝒏𝒙 𝒏𝒚
−𝟎.𝟗
= = −1.7351
𝟎.𝟓𝟏𝟖𝟕
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
𝐻1 : μx < μy 𝑜𝑟 𝐻1 : μx − μy < 0
𝛼 =0.05
𝛼 =0.05 using standardized normal table,
Critical value = −𝒛𝟎.𝟎𝟓 = −𝟏. 𝟔𝟒𝟓
−𝑧𝛼 0
Non-Rejection
Rejection Region
Region
-1.645 0
-1.7351
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
Test statistic is in the rejection region. It is less than the
critical value.
Therefore 𝑯𝟎 can be rejected at 5% significance
level. There is enough evidence to conclude that
mean checkout time is less for people who use
self-service checkout lane.
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Example:
2. Fifty specimens of a new computer chip were tested for
speed in a certain application, along with 50 specimens of
chips with the old design. The average speed, in MHz, for
the new chips was 495.6, and the standard deviation was
19.4. The average speed for the old chips was 481.2, and
the standard deviation was 14.3. Can you conclude that the
mean speed for the new chips is greater than that of the
old chips at 2.5% significance level?
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Example:
3. In an experiment to test the effectiveness of a new sleeping
aid, a sample of 12 patients took the new drug, and a sample
of 14 patients took a commonly used drug. Of the patients
taking the new drug, the average time to fall asleep was 27.3
minutes with a standard deviation of 5.2 minutes, and for the
patients taking the commonly used drug the average time
was 32.7 minutes with a standard deviation of 4.1 minutes.
Can you conclude that the mean time to sleep is less for the
new drug at 2.5% significance level?
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
3. Let X = time to fall sleep of the patients taking the new
drug
Y = time to fall sleep of the patients taking the commonly
used drug
𝑥ҧ = 27.3𝑚𝑖𝑛 , 𝑛𝑥 = 12 , 𝜎𝑥 = 5.2𝑚𝑖𝑛
𝑦ത = 32.7𝑚𝑖𝑛, 𝑛𝑦 = 14, 𝜎𝑦 = 4.1min
test whether the mean time to sleep is less for the new
drug.
H0 : μx ≥ μy vs H1 : μx < μy
𝜇𝑥 − 𝜇𝑦 = 0
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
Since both sample sizes are small and population
variances are unknown,
ഥ −𝒚
(𝒙 ഥ)−(𝝁𝒙 −𝝁𝒚 )
Test Statistic =
𝟏 𝟏
𝒔𝒑 +
𝒏𝒙 𝒏𝒚
515.97
𝑠𝑝 = = 4.6367
24
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
(𝟐𝟕.𝟑−𝟑𝟐.𝟕)−𝟎
Test Statistic =
𝟏 𝟏
𝟒.𝟔𝟑𝟔𝟕 +
𝟏𝟐 𝟏𝟒
−𝟓.𝟒
= = −2.9605
𝟏.𝟖𝟐𝟒
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
𝐻1 : μx < μy 𝑜𝑟 𝐻1 : μx − μy < 0
𝛼 =0.025 and 𝑛𝑥 + 𝑛𝑦 − 2 = 14 + 12 − 2 = 24
𝛼 =0.025 using t-table,
Critical value = −𝒕𝟐𝟒,𝟎.𝟎𝟐𝟓 = −2.064
−𝑡𝛼 0
Non-Rejection
Rejection Region
Region
-2.064 0
-2.9605
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
Test statistic is in the rejection region. It is less than the
critical value.
Therefore 𝑯𝟎 can be rejected at 5% significance
level. There is enough evidence to conclude that
mean time to sleep is less for the new drug.
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
(𝑑 − ത
𝑑) 2 σ𝑛
𝑖=1 𝑑𝑖
𝑤ℎ𝑒𝑟𝑒 𝑠𝑑2 = σ𝑛𝑖=1 𝑖
𝑎𝑛𝑑 𝑥ҧ𝑑 = 𝑑ҧ =
(𝑛−1) 𝑛
TESTING HYPOTHESIS CONCERNING POPULATION MEAN
COMPARISON
Example:
1. Two microprocessors are compared on a sample of six
benchmark codes to determine whether there is a difference
in speed. The times (in seconds) used by each processor on
each code are given in the following table. Can you conclude
that the mean speeds of the two processors differ at 5%
significance level?
Code 1 2 3 4 5 6
Processor A 27.2 18.1 27.2 19.7 24.5 22.1
Processor B 24.1 19.3 26.8 20.1 27.6 29.8
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
1. Test whether the mean speeds of the two processors
differ
H0 : μd = 0 vs H1 : μd ≠ 0
𝜇0 = 0
Since sample are paired,
(ഥ
𝒙𝑫 −𝝁𝟎 )
Test Statistic = 𝒔𝒅
ൗ 𝒏
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
Code A B Difference(𝑑𝑖 ) (𝑑𝑖 −𝑑)ҧ 2
1 27.2 24.1 27.2 - 24.1 = 3.1 (𝑑𝑖 −𝑑)ҧ 2 = (3.1 − (−1.483))2
(3.1 + 1.483))2 = 21.0039
2 18.1 19.3 18.1 – 19.3 = -1.2 0.0801
3 27.2 26.8 27.2 - 26.8 = 0.4 3.5456
4 19.7 20.1 19.7 - 20.1 = -0.4 1.1729
5 24.5 27.6 24.5 – 27.6 = -3.1 2.6147
6 22.1 29.8 22.1 – 29.8 = -7.7 38.6511
Total = -8.9 Total = 67.0683
σ𝑛
𝑖=1 𝑑𝑖 8.9
𝑥ҧ𝑑 = 𝑑ҧ = = −
𝑛 6
𝑑ҧ = −1.483
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
ത 2
(𝑑𝑖 −𝑑)
𝑠𝑑2 = σ𝑛𝑖=1 (𝑛−1) = 67.0683/5
𝑠𝑑2 = 13.4136
𝑠𝑑 = 13.4136 = 3.6625
(−1.483−0)
Test Statistic = 3.6625
ൗ 6
−1.483
= = −0.9918
1.4952
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
𝐻1 : μd ≠ 0
𝛼 =0.025 and n − 1 =5 (using
𝛼/2 =0.025 𝛼/2 =0.025
t-table),
Critical value
−𝒕𝟓,𝟎.𝟎𝟐𝟓 = − 2.571 and
−𝑡𝛼/2 0 𝑡𝛼/2
𝒕𝟓,𝟎.𝟎𝟐𝟓 =2.571
Non-Rejection
Region
Rejection Rejection
Region Region
−2.571 0 2.571
-0.9918
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN COMPARISON
Answer:
Test statistic is not in the rejection region.
Therefore 𝑯𝟎 cannot be rejected at 5% significance
level. There is no enough evidence to conclude that
the mean speeds of the two processors differ.
TESTING HYPOTHESIS CONCERNING POPULATION PROPORTION
COMPARISON
𝑥 𝑦 𝑥+𝑦
𝑤ℎ𝑒𝑟𝑒 𝑝Ƹ𝑥 = , 𝑝Ƹ𝑦 = 𝑎𝑛𝑑 𝑝Ƹ =
𝑛𝑥 𝑛𝑦 𝑛𝑥 + 𝑛𝑦
TESTING HYPOTHESIS CONCERNING POPULATION PROPORTION
COMPARISON
Example:
1. To test the effectiveness of protective packaging, a firm
shipped out 1200 orders in regular light packaging and 1500
orders in heavy-duty packaging. Of the orders shipped in light
packaging, 20 arrived in damaged condition, while of the
orders shipped in heavy duty packaging, 15 arrived in
damaged condition. Can you conclude that heavy-duty
packaging reduces the proportion of damaged shipments at
2.5% significance level?
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION COMPARISON
Answer:
1. Let X = damaged orders shipped in light packaging
Y = damaged orders shipped in heavy-duty packaging
20
𝑥 = 20 , 𝑛𝑥 = 1200 , 𝑝𝑥 =
1200
15
𝑦 = 15, 𝑛𝑦 = 1500, 𝑝𝑦 =
1500
𝑥+𝑦 20+15 35
𝑝Ƹ = = =
𝑛𝑥 +𝑛𝑦 1200+1500 2700
20 15
−
1200 1500
=
35 35 1 1
1− +
2700 2700 1200 1500
0.0067
= = 1.5220
0.0044
TESTING HYPOTHESIS CONCERNING POPULATION
MEAN
Answer:
𝛼 =0.025
0.025 using standardized normal table,
Critical value = 𝒛𝟎.𝟎𝟐𝟓 = 𝟏. 𝟗𝟔
0 𝑧𝛼
Non-Rejection Rejection
Region Region
0 1.96
1.5220
TESTING HYPOTHESIS CONCERNING POPULATION
PROPORTION COMPARISON
Answer:
Test statistic is not in the rejection region. It is less than the
critical value.
Therefore 𝑯𝟎 cannot be rejected at 2.5%
significance level. There is no enough evidence to
conclude that the heavy-duty packaging reduces
the proportion of damaged shipments.