Hypothesis Testing Chapter 14
Significance Testing/Hypothesis Testing:
Making a decision about the acceptance or rejection of a statement about the population
parameter on the basis of evidence provided by the sample data called Hypothesis Testing
which is the major area of statistical inferences.
Null Hypothesis(𝐇𝟎 ):
H0 is an hypothesis that is tested for possible rejection under the assumption that it is true.
e.g.
Average life of all students is 65ʺ H0 : μ = 65ʺ
Alternative Hypothesis: (H1 or Ha)
Opposite to null hypothesis Ha is alternative hypothesis. It is rejected when H0 is accepted
and vice versa.
H0 : μ = 65ʺ then,
Ha : μ ≠ 65ʺ μ > 65 or μ < 65
Steps Involve in Procedure of Hypothesis Testing:
• Formulate an appropriate Null Hypothesis (H0) with alternative Hypothesis (H1 or Ha)
𝛼
• Level of significance / Risk Level (α or 2 )
• Test Statistic to be used ( Z-Test or T-Test)
• Calculation of Test Statistic.
• Make the decision.
Note:
• μ ≠ 65 ( Two tail)
• μ > 65 (One tail)
• μ < 65 (One tail)
Shifts to
H0 H1
• No Difference • Difference
• Equality Exist • Equality Does not Exist
• At least • Less than
• At most • Greater than
• Zero • Not zero
Confidence Level 99%
Risk Level 1%
Zα ± 2.33 (For One tail Not divide by 2 just take percentage above 50% that is 49% in this
case and look into Normal Distribution table for the value for 0.490)
M. SHOAIB([Link]) 1
Hypothesis Testing Chapter 14
Zα/2 ± 2.58 (99% divided by 2 becomes 0.4950 look in to table and obtain result)
Confidence Level 95%
Risk Level 5%
Zα ± 1.645
Zα/2 ± 1.96 (Table value / Critical Value)
Types of error:
Type – 1 Error:
Rejecting H0 when it is true is termed as Type – 1 Error.
Type – 2 Error:
Accepting H0 when it is not true or fails to reject H0 that is really Un-true is termed as
Type – 2 Error
Actual State Accept H0 Reject H0
H0 is Correct Correct Decision Type – 1 Error
H0 is not Correct Type – 2 Error Correct Decision
Testing Hypothesis about Population Mean:
x
̅ −μ
• Z= σ (σ is known)
√n
x
̅ −μ
• Z= S (σ is unknown and n ≥ 30)
√n
x
̅ −μ
• T= S (σ is unknown and n < 30)
√n
Question 1:
A manufacturer of detergents claims that the mean weight of a particular box of detergent is
3.25 pounds. A random sample of 64 boxes revealed a sample average of 3.238 pounds with a
standard deviation of 0.117 pounds. Using the 1% level of significance, is there any evidence
that the average weight of the box is different from 3 pounds?
M. SHOAIB([Link]) 2
Hypothesis Testing Chapter 14
Sol.
H0 : μ = 3.25, n = 64 ( Z – Test )
H1 : μ ≠ 3.25, (Two tail), x̅ = 3.238, S = 0.117
Confidence level = 99% = 99%/2 = 0.4950 = ± 2.58
99%
Acceptance Region
-2.58 +2.58
- 0.82
R.R
R.R
Z- Table
Now,
x−μ
̅ 3.238−3.25
𝑍𝐶𝑎𝑙𝑐. = σ = 0.117 = −0.82
√n √64
As -0.82 falls in acceptance region so H0 is accepted
F-21
• Ignore Sign
• Zcalc. < Ztable (H0 is Accepted)
• Zcalc. > Ztable (H0 is Rejected)
M. SHOAIB([Link]) 3
Hypothesis Testing Chapter 14
Question 2:
Suppose that variance of the IQ’s of the high school students in certain city is 225. A random
sample of 36 students has a mean IQ of 106. If the level of significance is 0.05. Should we
conclude that the IQ’s of the high school students are higher than 100?
Sol.
H1 : μ > 100,
H0 : μ ≤ 100, (One tail), 95% 45% 0.450 ±1.64(Z-table)
𝑥̅ = 106, n = 36 ( Z-Test), 𝜎 2 = 225
106−100
Z= 15 = 𝟐. 𝟒 (Z-Calc)
√36
As, ZCalculated > ZTable
So, H0 is rejected
H1 is accepted
Question 3:
The average life of college students is normally distributed with mean 65 inches(μ). An example
of 5 students gave the heights 66, 65, 68, 70 and 71. Test the hypothesis that average height of
the students is atleast 65 inches. (5% risk involves)
Sol.
H0 : μ ≥ 65ʺ
H1 : μ < 65ʺ (One Tail)
n = 5, T – Test
Ttable Tα(n-1) T0.05(4) 2.1319
Now,
66+65+68+70+71
𝑥̅ = = 68
5
𝑥𝜎𝑛−1 (Using calculator), S = 2.55(un-biased)
Now,
x̅−μ 68−65
Tcalculated = S = 2.55 = 2.63
√n √5
As,
TCalc. > Ttable
So,
H0 is rejected.
M. SHOAIB([Link]) 4
Hypothesis Testing Chapter 14
Question 4:
The average distance spent by each person commuting to the office each month in a large city
is asserted to be 460km. A sample of 100 commuters showed a mean of 450 km and has a
standard deviation of 25 km. Does the sample support the assertion about the population at 5%
significance level?
Sol.
H0 : μ = 460
H1 : μ ≠ 460 ( Two Tail)
ZTable at 95% 1.96
Now,
𝑥̅ − 𝜇 450−460
Zcalc. = 𝑆 = 25 =-4 4
√𝑛 √100
As,
Zcalc. > ZTable
H0 is rejected
M. SHOAIB([Link]) 5
Hypothesis Testing Chapter 14
Testing Hypothesis about the difference between two population means:
(x̅1 −x̅2 )
• Z= (σ known)
σ1 2 σ 2 2
√ +n
n1 2
(x̅1 −x̅2 )
• Z= (σ unknown and n > 30)
2 2
√S1 +S2
n1 n 2
Example:
Height of men in two cities is provided in the table below. Test hypothesis for the difference
between population means of both cities at 95% confidence level (1.96)
City Karachi Lahore
Sample 160 196
Mean Height 170 171
Standard Deviation 8 7
Sol.
(x̅1 −x̅2 )
Z= = - 1. 23 (Z calculated) (Ignore –ve sign)
2 2
√S1 +S2
n1 n 2
Zcalc. < ZTable
H0 is accepted
• As H0 is accepted so there is no difference between population means for
Lahore and Karachi
M. SHOAIB([Link]) 6
Hypothesis Testing Chapter 14
Hypothesis Testing for Population Proportions:
Sample Proportion − Population Proportion
Z=
pq
√
n
Example:
An election Candidate claims that 60% of the voters support him. A random sample of 2500
voters showed that 1410 supported him. Test Candidate claim at 95% confidence level.
Sol.
Z at 95% = 1.96 (Z-table)
Sample Proportion = 1410/2500 = 0.564
Population Proportion = 60% = 0.60 p = 0.6 q = 1-0.6 = 0.4
So,
0.564−0.6
Zcalculated = = -3.7 = 3.7 (Z-calculated)
0.6(1−0.6)
√
2500
Zcalc. > ZTable
So, H0 is rejected
Example: Consider the following data based on the data conclude whether to accept or reject the
hypothesis.
i. Proportion p < 0.7
ii. Standard deviation of proportion: 0.0092
iii. Sample proportion: 0.684
iv. Level of significance 5%
v. N is more than 30.
Claim/Hypothesis Accepted
H0 is rejected
M. SHOAIB([Link]) 7
Hypothesis Testing Chapter 14
Hypothesis Test Involving Difference of Population Proportion:
𝐏̂𝟏 −𝐏̂𝟐
➢𝐙= 𝐩 𝐪 𝐩 𝐪
√ 𝟏𝐧 𝟏+ 𝟐𝐧 𝟐
𝟏 𝟐
̂𝟏 and 𝐏
𝐏 ̂𝟐 Sample Proportions.
Example 1: One Tail Evidence
A health official claims that citizens of Peshawar are fitter than citizens of Gujrat. 96 out of 200
(48%) citizens in Peshawar passed a standard fitness test. 84 out 200 (42%) citizens in Gujrat
passed the same test. Test the claim at 95% confidence level.
Sol.
95%( one tailed) 45% 0.450 1.65 (Z-table)
Now,
0.48−0.42
Zcalc. = = 𝟏. 𝟐 (Z-calculated)
0.48×0.52 0.42×0.58
√ + 200
200
As, Zcalc. < ZTable
H0 is accepted
Example 2:
A sample of 300 smokers and 70 non-smokers were taken for a study of likelihood of getting
cancer.
Cancer Non-Cancer Total
Smokers 270 30 300
Non-Smokers 8 62 70
Total 278 92 370
It is asserted that chances for cancer for those who smoke and for those who do not smoke are same.
Test this assertion at 5% significance level. Two Tailed Evidence
Sol.
95%(Two tailed) 1.96 (Z-Table)
270
𝑃1 = 300 = 0.9, 𝑞1 = 0.1, 𝑛1 = 300
8
𝑃2 = = 0.12, 𝑞2 = 0.88, 𝑛2 = 70
70
0.9−0.12
So, Z= 0.9×0.1 0.12×0.88
= 12.38 (Z-Calculated)
√ + 70
300
Zcalc. > ZTable
So, H0 is rejected
There is a difference between likelihood of cancer amongst smokers and non-smokers.
M. SHOAIB([Link]) 8
Hypothesis Testing Chapter 14
Paired Observations (Usually Small) n < 30:
𝐬𝐚𝐦𝐩𝐥𝐞 𝐦𝐞𝐚𝐧 𝐝𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞( 𝐝̅ )−𝐚𝐬𝐬𝐮𝐦𝐞𝐝 𝐩𝐩𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐦𝐞𝐚𝐧 𝐝𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞
𝐭 𝐜𝐚𝐥𝐜 = 𝐒
√𝐧
Example:
An investigator suspects that there is a difference between two ways of assessing IQ. He
designed an experiment where 5 volunteers each take both tests and achieve following scores.
Does the score support his suspicion at 95% confidence level?
Test A Test B
Volunteer 1 135 125
Volunteer 2 103 102
Volunteer 3 129 117
Volunteer 4 96 94
Volunteer 5 121 121
Sol.
H0 Tests are likely to same
H1 There is difference between two tests.
(Test A < Test B) (as above data shows Test A > Test B)
Evidence of One Tail
ttable 5% (One tail) 𝒕𝜶(𝒏−𝟏) 𝒕𝟎.𝟎𝟓(𝟓−𝟏) 2.139
Now,
Test A Test B d ̅
d-𝒅 ̅ )𝟐
(𝐝 − 𝒅
135 125 135-125=10 10 – 5=5 25
103 102 103-102=1 1 – 5 = -4 16
129 117 129-117=12 12 – 5=7 49
96 94 96-94=2 2 – 5 = -3 9
121 121 121-121=0 0 – 5 =-5 25
Σd = 25 ̅
𝜮(𝐝 − 𝒅)𝟐 = 𝟏𝟐𝟒
∑d 25
d̅ = = =5
n 5
̅
∑(d−d)2
S=√ = 5.57
n−1
M. SHOAIB([Link]) 9
Hypothesis Testing Chapter 14
d̅ − (0)
t calc =
S
√n
5−0
t calc = =𝟐
5.57
√5
𝐓𝐜𝐚𝐥𝐜 < 𝐓𝐭𝐚𝐛𝐥𝐞
H0 is accepted.
Both Tests are same.
M. SHOAIB([Link]) 10