Unit-4 - Hypothesis Testing
Unit-4 - Hypothesis Testing
Unit-4 - Hypothesis Testing
HYPOTHESIS-TESTING
(Prof: ASFAR SIDDIQUI)
Introduction
Hypothesis testing in statistics is a way for you to test the results of a survey or experiment
to see if you have meaningful results.
1) NH− 𝐻0: µ = µ0
3) LOS: Given
4) Acceptance region:
5) Calculation:
𝑥−µ
𝑍= σ
𝑛
Ex: The length of the life of certain computer is approximately normally distributed with
Mean 800hours and std 40 h. if a random sample of 30 computer has an average life of 788 h
Test the null hypo that µ = 800ℎ 𝑎𝑔𝑎𝑖𝑛𝑠𝑡 alternate that μ≠800ℎ at α = 5%
Sol: Let µ =800 𝑥 = 788 σ = 40 Given LOS 5%
1) Null Hypothesis 𝐻0: µ = 800h
5) Calculation statistic
𝑀𝑒𝑎𝑛 𝑜𝑓 𝑠𝑎𝑚𝑝𝑙𝑒 = 𝑥 = 788 𝑎𝑛𝑑 𝑛 = 𝑠𝑎𝑚𝑝𝑙𝑒 𝑠𝑖𝑧𝑒 = 30
𝑆. 𝐷 = σ = 40
𝑥−µ 788−800
𝑍= = =− 1. 643
σ/ 𝑛 40/ 30
Ex: Mice with an average lifespan of 32 months will live up to 40months when
fed by a certain nutrious food. If 64 mice fed on this diet have an average
lifespan of 38 months and std of 5.8months. is there is any reason to believe that
4) Critical Region :
5) Calculation statistic
𝑥−µ 38−40
𝑍= σ = 5.8
𝑛 64
𝑍 =− 2. 7586
4) Critical Region :
5) Calculation statistic
𝑥−µ 38−40
𝑍= σ = 5.8
𝑛 64
𝑍 =− 2. 7586
Ex: A company claims that the mean of thermal efficiency of disesel engines produced by
them is 32.3%. to test this claim, a random sample of 40 engines were examined which
showed the mean thermal efficiency of 31.4% and s.d of 1.6%. can this claim be accepted or
not at 0.01 LOS and 0.05 LOS
Solution:
4) Critical Region :
i) − 1. 96 < 𝑍𝑠 < 1. 96
5) Calculation statistic
𝑥−µ 31.4−32.3
𝑍= σ = 1.6
𝑛 40
𝑍 =− 3. 5575
Since calculated value fall/lies in critical region (rejection region) in both case
Ex: A pharmaceutical firm maintains that the mean time for a drug to show its effect is 24
minutes. In a sample of 400 trials, the meanyime is found to be 26 minuteswith a standard
deviation of 4 minutes. Test the hypothesis that the mean time is 24 minutes against the
alternative that it is not equal to 24 minutes,using 0.05 level of significance
Sol:
4) Critical Region :
Since AH is ≠ type We use the Two tail test and critical region is
i) − 1. 96 < 𝑍𝑠 < 1. 9
5) Calculation statistic
𝑥−µ 26−24
𝑍= σ = 4
𝑛 400
𝑍 = 10
Ex: An Ambulance service company claims that on an average it takes 20 min between a call
for an ambulance and between a call and the patient’s arrival at the hospital. If in 6 calls the
time taken (between a call and arrival at hospital) are 27, 18, 26, 15, 20, and 32. Can the
company’s claim, be accepted?
4) Critical Region :
5) Calculation statistic
𝑥−µ 23−20
𝑡(𝑐𝑎𝑙) = = = 1. 15
σ/ 𝑛 6.3875/ 6
𝑡(𝑡𝑎𝑏) = 1.476
Ex. Producer of 'gutkha', claims that the nicotine content in his 'gutkha' on the average is
1.83 mg. Can this claim be accepted if a random sample of 8 ‘gutkhas’ of this type has the
nicotine contents of 2.0, 1.7, 2.1, 1.9, 2.2, 2.1, 2.0, 1.6 mg? LOS 5%
4) Critical Region :
5) Calculation statistic
𝑥−µ 1.95−1.83
𝑡(𝑐𝑎𝑙) = σ = 0.207 = 1. 6395
𝑛 8
EXERCISE
1. Mean lifetime (mlt) of computers manufactured by a company is 1120 hours with standard
deviation of 125 hours. (a) Test the hypothesis that mean lifetime of computers has not
changed if a sample of 8 computers has a mlt of 1070 hours (b) Is there decrease in mlt? Use
(i) 0.05 (ii) 0.01 L.O.S.
2. Producer of 'gutkha', claims that the nicotine content in his 'gutkha' on the average is 1.83
mg. Can this claim be accepted if a random sample of 8 'gutkhas' of this type have the
nicotine contents of 2.0, 1.7, 2.1, 1.9, 2.2, 2.1, 2.0, 1.6 mg?
. 3. In 1950 in India the mean life expectancy was50 years. If the life expectancies from a
random sample of 11 persons are 58.2,56.6,54.2, 50.4, 44.2, 61.9, 57.5, 53.4, 49.7, 55.4, 57.0,
does it confirm the expected view.
4. An auditor claims that he takes on an average10.5 days to file income tax returns (I.T.
returns). Can this claim be accepted if a random sample shows that he took 13, 19, 15, 10, 12
, 11, 14, 18 days to file I.T. returns? Use (a) 0.01 (b) 0.05 L.O.S
5. If 5 pieces of certain ribbon selected at random have mean breaking strength of 169.5
pounds with s.d. of 5.7, do they confirm to the specification mean breaking strength of 180
pounds.Use (a) 0.05 (b) 0.01 L.O.S.
6. In a random sample of 10 bolts produced by a machine the mean length of bolt is 0.53 mm
and standard deviation 0.03 mm. Can we claim from this that the machine is in proper
working order if in the past it produced bolts of length 0.50 mm? Use (a) 0.05 (b) 0.01
L.O.S.
TEST FOR SUM/DIFF OF MEAN
Ex: In a random sample of 100 tubelights produced by company A,the mean lifetime of
tubelight is 1190 hours with standard deviation of 90 hrs. Also in a random sample of 75
tubelights from company B the mean lifetime is 1230 hours with standard deviation of 120
hrs. Is there a difference between the mean lifetime of two brands of tubelights at a
significant level of a) 0.05 b) 0.01?
Solution:
i) -1.96< 𝑍 < 1. 96
5) Calculation statistic
𝑥−µ
𝑍=
σ/ 𝑛
𝑍=
(𝑥 −𝑥 )−(µ −µ )
𝐵 𝐴 𝐵 𝐴
2 2
σ𝐵 σ𝐵
𝑛𝐵
+ 𝑛𝐵
(1230−1190)−0
𝑍= 2 2
120 90
75
+ 100
𝑍 = 2. 421
6) Decision :
Ex: To test the effects a new pesticide on rice production a farm land was divided into 60
units of equal areas all portions having identical qualities as to soil, exposure to sunlight
etc,The new pesticide is applied to 30 units while old pesticide to remaining 30.Is there a
reason to belive that the new pesticide is better than old one if mean no of kgs of rice
harvested / unit using new pesticide is 496.31 with sd of 17.18 kgs while for old one is
485.41 kgs is mean and sd is 14.73 test at a=0.05
Solution:
i) 𝑍 < 1. 64
ii) 𝑍 < 2. 33
5) Calculation statistic
𝑍=
(𝑥 −𝑥 )−(µ −µ )
𝑁 𝑂 𝑁 𝑂
2 2
σ𝑁 σ𝑂
𝑛𝑁
+ 𝑛𝑂
(496.31−485.41)−0
𝑍= 2 2
(17.18) (14.73)
30
+ 30
𝑍 = 2. 6381
6) Decision :
Ex:1 A random samples of 40 'Geyers' produce by the company A have a mean lifetime (mlt)
of 647 hours of continuous use with a s.d of 27 hours while a sample 40 produced by another
company B have mlt 638 hours with s.d 31 hours .Does this substainted the claim of company
A that their 'geyers' are superior to those produced by company B at (a) 0.05 (b) 0.01?
Ex:3 If random sample data show that 42 men earn on the average Xi = 744.85 with s.d. si =
397.7 while 32 women earn on the average x2 = 516.78 with s.d. s2 = 162.523, test at 0.05
level of significance whether the average income for men and women is same or not.
Ex: A company claims that alloying reduces resistance of electric wire by more than 0.050
ohm. To test this claim samples of standard wire and alloyed wire are tested yielding the
following results:
Ex: Test the claim that teen-age boys are heavier than teen-age girls given the following
information L.O.S 0.05,0.01
Gender Sample size Mean weight s.d
Boys 50 68.2 2.5
Girls 50 67.7 2.8
1) NH 𝐻0: 𝑝 = 𝑝0 (percentage)
2) AH 𝐻1: 𝑝 ≠ 𝑝0 [𝑜𝑟 𝑝 < 𝑝0 𝑜𝑟 𝑝 > 𝑝0 ]
3) LOS: α [ Given]
4) Critical region:
i) NH reject if 𝑝≤α
Compute p value
a) AH 𝑝 ≠ 𝑝0
( )
𝑝 = 2𝑝 𝑋 ≤ 𝑥 𝑤ℎ𝑒𝑛 𝑝 = 𝑝0 𝑖𝑓 𝑥 < 𝑛𝑝0
( )
𝑝 = 2𝑝 𝑋 ≥ 𝑥 𝑤ℎ𝑒𝑛 𝑝 = 𝑝0 𝑖𝑓 𝑥 > 𝑛𝑝0
b) AH 𝑝 < 𝑝0
(
𝑝 = 𝑝 𝑋 ≤ 𝑥 𝑤ℎ𝑒𝑛 𝑝 = 𝑝0 )
c) AH 𝑝 > 𝑝0
(
𝑝 = 2𝑝 𝑋 ≥ 𝑥 𝑤ℎ𝑒𝑛 𝑝 = 𝑝0 )
6) Decision :
Reject NH if 𝑝≤α
Accept NH if 𝑝 > α
Ex: If 6 out of 20 cigarette smokers randomly chosen preferred 'charminar' cigarettes test the
claim at 0.05 L. O. S. that 20% of the smokers prefers 'charminar'.
Solution:
1) NH 𝐻0: 𝑝 = 0. 2 (percentage)
2) AH 𝐻1: 𝑝 ≠ 𝑝0
3) LOS: α = 0. 05
( )
5
𝑝 = 2 1 − ∑ 𝐵(𝑋, 20, 0. 2)
0
𝑝 = 2(1 − 0. 8042)
𝑝 = 0. 3916
Ex: Past experience shows that 40% of Indian youth favoured cricket. If in a random sample
of 15 Indian youth,8 favored cricket, is there reason to believe that the proportion of Indian
youth favoring cricket today has increased . Use 0.05 L.O.S
Solution:
1) NH 𝐻0: 𝑝 = 0. 4 (percentage)
2) AH 𝐻1: 𝑝 > 0. 4
3) LOS: 0. 05
𝑝 = 𝑝(𝑋 ≥ 8 𝑤ℎ𝑒𝑛 𝑝 = 0. 4)
( )
7
𝑝 = 1 − ∑ 𝐵(𝑋, 15, 0. 4) = 0. 2131
0
1. To test the claim of a flat builder that mosquito nets were installed in 70% of the flats, a
random survay was conducted and found that 8 15 flats had mosquito nets. Is the claim valid
0.10 L.O.S.
2. Test the N.H.: that a coin is fair at 0.03 L.O.S.against an A.H. that heads occur less than
50% of the time if 5 heads occur when it is tossed 20 times
3. If 9 out 20 pizza' eaters like the native variety over the Italian, can the claim
that 40% of "pizza' eaters like native variety is tenable?
TEST FOR PROPORTION (LARGE SAMPLES)
Let sample size 𝑛 > 30 and p be the probability. then hypothesis for proportion for large
sample is given by
1) NH 𝐻0: 𝑝 = 𝑝0 (percentage)
3) LOS: α
4) Acceptance Region:
6) Decision : Accept NH if
Example 1: If in a random sample of 600 cars making a right turn at a certain trafic junction
157 drove into the wrong lane, test whether actually 30% of all drivers make this mistake or
not at this given junction. Use (a) 0.05 (b) 0.01 L.O.S.
Solution: Let X be discrete random variable denoting the number of cars driving into the
wrong lane at a junction
1) NH 𝐻0: 𝑝 = 0. 3 (percentage)
2) AH 𝐻1: 𝑝 ≠ 0. 3
4) Acceptance Region:
− 1. 96 < 𝑍 < 1. 96
− 2. 58 < 𝑍 < 2. 58
5) Calculation :
6) Decision :
Reject NH
Example 2: Test the claim of a manufacturer that 95% of his 'stabilizers' confirm to ISI
specifications if out of a random sample of 200 stabilizers produced by this manufacturer 18
were faulty. Use (a) 0.01 (b) 0.05 L.O.S.
Solution: Let p = probability that the stabilizers are of ISI standard i.e., good
1) NH 𝐻0: 𝑝 = 0. 95 (percentage)
2) AH 𝐻1: 𝑝 < 0. 95
4) Acceptance Region:
− 1. 645 > 𝑍
− 2. 33 > 𝑍
5) Calculation :
6) Decision : Reject NH
EXERCISE
1. If in a random sample of 200 persons suffering with 'headache' 160 persons got cured by a
drug, can we accept the claim of the manufacturer that his drug cures 90% of the sufferers?
Use 0.01 L.O.S.
2. A student answers by guess 32 questions correctly in an examination with 50 true or false
questions. Are the results significant at (a) 0.05 L.O.S. (b) 0.01 L.O.S.
3. If a random sample of 120 tractors produced by a company 47 is defective, is the claim, by
the company that at most 30% of the tractors are defective, tenable. Use 0.05 L.O.S.
4. In a sample of 90 university professors 28 own a computer. Can we conclude at 0.05
L.O.S. that at most of the professors own a computer?
5. It is observed that 174 out of a random sample of 200 truck drivers on highway during
night are drunk. Is it valid to state that at least 90%of the truck drivers are drunk. Use 0.05
L.O.S.
6. A hospital claims that at least 40% of the patients admitted are for 'emergency' ward. Is
there reason to believe this claim if the records
shows that only 49 of 150 patients are for'emergency' ward. Use 0.01 L.O.S.
TEST FOR PROPORTION (Differences)
Consider two different samples with size 𝑛1and 𝑛2 with proportions 𝑝1 and 𝑝2 respectively.
Then hypothesis testing for proportions is given by
Solution:
5) Calculation statistic
𝑝−µ
𝑍= σ
(𝑝1−𝑝2)−δ
𝑍=
𝑝1𝑞1 𝑝2𝑞2
𝑛1
+ 𝑛2
Example 1: Out of two vending machines at a 'super bazar', the first machine fails to work 13
times in 250 trials and second machine fails to work 7 times in 250 trials. Test at 0.05 L.O.S.
whether the difference between the corresponding sample proportions is significant.
Solution:
1) NH 𝐻0: 𝑝1 − 𝑝2 = δ = 0 no difference
2) AH 𝐻1: 𝑝1 − 𝑝2 ≠ δ
5) Calculation statistic
𝑝−µ
𝑍= σ
𝑍=
(𝑝1−𝑝2)−δ
=
(𝑝1−𝑝2)−δ
=
( 237
250
243
− 250 ) =− 1. 3698
𝑝1𝑞1
𝑛1
+
𝑝2𝑞2
𝑛2
𝑝𝑞(
1
𝑛1
+
1
𝑛2
) ( )
24
25
(
1
25
)(
1
𝑛1
+𝑛 )
1
2
𝑍 =− 1. 3698
6) Decision : Accept NH
Example 2: If 57 out of 150 patients suffering with certain disease are cured by allopathy and
33 out of 100 patients with same disease are cured by homeopathy, is there reason to believe
that allopathy is better than homeopathy at 0.05 L.O.S.
Solution:
1) NH 𝐻0: 𝑝1 − 𝑝2 = δ = 0 no difference
2) AH 𝐻1: 𝑝1 − 𝑝2 > δ
5) Calculation :
(𝑝1−𝑝2)−δ
𝑍= (𝑝 = 𝑝1 + 𝑝2)
(𝑝𝑞) ( 1
𝑛1
+𝑛
1
2
)
𝑍=
( 57
150
33
− 100 −0 ) = 0. 81
( 9
25
16
× 25 )( 1
150
1
+ 100 )
6) Decision : Accept NH or Reject NH
2) AH − 𝐻1: 𝑝1, 𝑝2, 𝑝3, ..., 𝑝𝑘 At least not all equal (difference)
3) LOS: α
2 2
4) Critical Region : Reject NH if χ > χ α 𝑤𝑖𝑡ℎ 𝑘 − 1 𝑑𝑜𝑓
5) Calculation statistic
Given Sample-1 Sample-1 …… Sample-1 total
Success(p) 𝑥1 𝑥2 …… 𝑥𝑘 x
Failure(q) 𝑛1 − 𝑥 𝑛2 − 𝑥 …… 𝑛𝑘 − 𝑥 𝑛−𝑥
1 2 𝑘
Total(n) 𝑛1 𝑛1 …… 𝑛𝑘 𝑛
𝑛𝑗𝑥
𝑒1𝑗 = 𝑛
,
𝑛𝑗(𝑛−𝑥)
𝑒2𝑗 = 𝑛
=
6) Decision :
2 2
Reject NH if χ > χ α 𝑤𝑖𝑡ℎ 𝑘 − 1 𝑑𝑜𝑓
3) LOS: α = 0. 05
2 2
4) Acceptance Region: Reject NH if χ > χ α 𝑤𝑖𝑡ℎ 𝑘 − 1 𝑑𝑜𝑓
5) Calculation statistic
Given(𝑂𝑖𝑗) A B C D Total
success 𝑜11 = 174 177 185 168 𝑥 = 704
failure 26 23 15 32 𝑛 − 𝑥 = 96
total 200 200 200 200 𝑛 = 800
Given(𝑒𝑖𝑗) A B C D Total
Success 𝑒11 = 176 𝑒12 = 176 𝑒13 = 176 𝑒14 = 176 704
failure 𝑒21 = 024 𝑒22 = 024 𝑒23 = 024 𝑒24 = 024 96
total 200 200 200 200 800
2 4 (𝑜𝑖𝑗−𝑒𝑖𝑗)
2
2
χ = ∑ ∑[ 𝑒𝑖𝑗
]
𝑖=1 𝑗=1
2 2 2 2
2 (174−176) (177−176) (185−176) (168−176)
χ = [ 176
+ 176
+ 176
+ 176
2 2 2 2
(26−24) (23−24) (15−24) (32−24)
+ 24
+ 24
+ 24
+ 24
]
2
χ = 7. 10
And
2
χ 0.05
= 7. 815 with 𝑑𝑜𝑓 = 𝑘 − 1 = 4 − 1 = 3
6) Decision :
2 2
Accept NH since χ < χ α 𝑤𝑖𝑡ℎ 𝑘 − 1 𝑑𝑜𝑓
EXERCISE
1. A study was conducted to estimate the proportion of wives who regularly watch TV serials' yielding the
following data:
5) Calculation statistic
Given(𝑂𝑖𝑗) A B C Total
watch 52 31 37 120
Not watch 148 119 113 380
total 200 150 150 500
Given(𝑒𝑖𝑗) A B C Total
Success 𝑒11 = 48 𝑒12 = 36 𝑒13 = 36 120
failure 𝑒21 = 152 𝑒22 = 114 𝑒23 = 114 380
total 200 150 150 500
2 4 (𝑜𝑖𝑗−𝑒𝑖𝑗)
2
2
χ = ∑ ∑[ 𝑒𝑖𝑗
]
𝑖=1 𝑗=1
2 (𝑜11−𝑒11)2 (𝑜12−𝑒12)2 (𝑜13−𝑒13)2 (𝑜14−𝑒14)2 (𝑜21−𝑒21)2 (𝑜22−𝑒22)2 (𝑜23−𝑒23)2
χ = [ 𝑒11
+ 𝑒12
+ 𝑒13
+ 𝑒14
+ 𝑒21
+ 𝑒22
+ 𝑒23
]
2 2 2 2 2 2
2 (52−48) (31−36) (37−36) (148−152) (119−114) (113−114)
χ = [ 48
+ 36
+ 36
+ 152
+ 114
+ 114
]
2
χ = 1. 3889
And
2
χ 0.05
= 5. 991 with 𝑑𝑜𝑓 = 𝑘 − 1 = 3 − 1 = 2
6) Decision :
2 2
Accept NH since χ < χ α 𝑤𝑖𝑡ℎ 𝑘 − 1 𝑑𝑜𝑓
Is there reason to believe at 0.05 L.O.S. that there is no difference among the true proportions of wives with
different educational background who watch TV 'serials'.
Example: Three cough syrups A, B, C were used on patients with cough with the following results:
A B C total
cured 41 27 22 90
Do not cured 79 53 78 210
total 120 80 100 300
Can we conclude whether there is significant (at 0.05 level) difference among the proportion of patients cured by
the three brands A, B, C?
A survey was conducted to determine whether
three categories of employees prefer pension scheme or not resulting the table given below
A B C total
For pension 67 84 109 260
Do not pension 33 66 41 140
total 100 150 150 400
At 0.01 L.O.S. test whether the proportions of employees favoring pension scheme are same
4. If a can containing 500 dry fruits is selected at random from each of three different companies • A, B, C of mixed
dry fruits and there are 345,313 and 359 cashew nuts respectively in each of the cans, can we conclude at 0.01
L.O.S. that the mixed dry fruits of three companies contain equal proportions of cashew nuts.
3) LOS: α
2 2
4) Critical Region : Reject NH if χ > χ α 𝑤𝑖𝑡ℎ (𝑟 − 1)(𝑐 − 1) = 𝑑𝑜𝑓
5) Calculation statistic
𝑛𝑗𝑥
𝑒1𝑗 = 𝑛
,
𝑛𝑗(𝑛−𝑥)
𝑒2𝑗 = 𝑛
6) Decision :
2 2
Reject NH if χ > χ α 𝑤𝑖𝑡ℎ (𝑟 − 1)(𝑐 − 1)𝑑𝑜𝑓
Example: Test the hypothesis at 0.05 LOS that the presence of Hypertension (HT) is
Independent of smoking habits from the following experimental data on 180 persons.
Given NS MS HS TOTAL
HT 21 36 30 87
NHT 48 26 19 93
Total 69 62 49 180
Solution:
1) NH − 𝐻0: 𝑖𝑛𝑑𝑝𝑒𝑛𝑑𝑒𝑛𝑡
3) LOS: α = 0. 05
2 2
4) Critical Region : Reject NH if χ > χ α 𝑤𝑖𝑡ℎ (𝑟 − 1)(𝑐 − 1) = 𝑑𝑜𝑓
5) Calculation statistic
Given(𝑂𝑖𝑗) NS MS HS Total
HT 21 36 30 87
NHT 48 26 19 93
total 69 62 49 180
Given(𝑒𝑖𝑗) NS MS HS Total
HT 33.35 29.97 23.69 087
NHT 35.65 32.03 25.32 093
total 69.00 62.00 49.00 180
2 3 (𝑜𝑖𝑗−𝑒𝑖𝑗)
2
2
χ = ∑ ∑[ 𝑒𝑖𝑗
]
𝑖=1 𝑗=1
2
χ = 14. 46
And
2
χ 0.05
= 5. 991 with 𝑑𝑜𝑓 = (𝑟 − 1)(𝑐 − 1) = (2 − 1)(3 − 1) = 2
6) Decision :
2 2
Reject NH since χ < χ α
𝑑𝑜𝑓 = (𝑟 − 1)(𝑐 − 1) = (2 − 1)(3 − 1)
PERFORMANCE
EFFECT
GOOD OK NOT OK TOTAL
BLIND 21 64 17 102
DEAF 16 49 14 79
NO Handicap 29 93 28 150
TOTAL 66 206 59 331
Test the claim that handicaps have no effect on performance at 0.05 L.O.S.
Example: To determine the effectiveness of drugs against "aids”, three types of medicines, allopathic, homeopathic
and ayurvedic were tested on 50 persons with the following results,
DRUG
EFFECT
AP HP AV TT
NO RELIF 11 13 9 33
SOME RELIF 32 28 27 87
TOTAL RELIF 7 9 14 30
TOTAL 50 50 50 150