Hypothesis Testing in Quality Control
Hypothesis Testing in Quality Control
Hypothesis Testing
Dr Khalil AMINE
[Link]@[Link]
EHTP 2024/2025
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 1 / 61
Introduction
1. Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 2 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 3 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 4 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 5 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 6 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 7 / 61
Introduction
Introduction
a difference in data
−→ bilateral / two-tailed test
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 8 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 9 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 10 / 61
Introduction
Introduction
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 11 / 61
Introduction
Introduction
The rejection region corresponds to an error risk α,
referred to in this context as the significance level
of the test, which represents the probability that the
experimental or calculated value of the statistic falls
within the rejection region if H0 is (assumed) true.
α = P (reject H0 |H0 is true)
= P (accept H1 |H1 is false)
which is equivalent to:
1 − α = P (accept H0 |H0 is true)
= P (reject H1 |H1 is false)
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 12 / 61
Introduction
Introduction
2. Hypothesis Testing
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 14 / 61
Hypothesis Testing Two-Tailed Test for a Mean
Example:
A machine produces washers whose thickness is a
random variable X with a standard deviation of
0.3 mm. The machine has been set to achieve a
thickness of 5 mm.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 16 / 61
Hypothesis Testing Two-Tailed Test for a Mean
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 17 / 61
Hypothesis Testing Two-Tailed Test for a Mean
2. Choice of Hypotheses.
We assume that the machine is correctly
calibrated if the mean thickness of all washers
produced by the machine is 5 mm. Thus, the
hypothesis to test is µ = 5. Let:
H0 : “µ = 5”
̸ 5”
H1 : “µ =
We aim to determine whether the sample mean
µ100 of a sample of 100 washers confirms or
rejects the null hypothesis H0 .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 18 / 61
Hypothesis Testing Two-Tailed Test for a Mean
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 20 / 61
Hypothesis Testing Two-Tailed Test for a Mean
4. Decision Rule.
If the sample mean lies outside the critical region,
we accept H0 ; otherwise, we reject H0 and accept
H1 .
5. Conclusion.
Since 5.07 lies within the critical region, we
decide to reject the null hypothesis H0 and accept
the alternative hypothesis H1 : µ ̸= 5 (the
machine is not correctly calibrated).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 22 / 61
Hypothesis Testing Unilateral Test Related to a Mean
Example:
The lifespan (in hours) of light bulbs produced by a
factory is a random variable X with a standard
deviation of 120. The manufacturer claims that, on
average, the light bulbs have a lifespan of 1120 hours.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 23 / 61
Hypothesis Testing Unilateral Test Related to a Mean
1 Hypotheses Selection.
Let the null hypothesis be H0 : µ = 1120 (the
manufacturer’s claim is true).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 25 / 61
Hypothesis Testing Unilateral Test Related to a Mean
1 Critical Region.
The critical region is located on one side of the
mean. Thus, the test is referred to as one-sided.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 27 / 61
Hypothesis Testing Unilateral Test Related to a Mean
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 28 / 61
Hypothesis Testing Unilateral Test Related to a Mean
1 Decision Rule.
If the observed sample mean me is less than 1087,
we reject the null hypothesis H0 and accept the
alternative hypothesis H1 (the manufacturer’s
claim is false).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 30 / 61
Hypothesis Testing Unilateral Test Related to a Proportion
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 31 / 61
Hypothesis Testing Unilateral Test Related to a Proportion
2. Formulating Hypotheses.
If the player is not cheating, the value of p is
4
= 0.125.
32
Thus, the null hypothesis H0 is p = 0.125 (the
player is not cheating).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 35 / 61
Hypothesis Testing Unilateral Test Related to a Proportion
4. Decision Rule.
If the sample proportion is greater than 0.152, we
reject the null hypothesis H0 and accept the
alternative hypothesis H1 : the null hypothesis H0
is not validated.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 36 / 61
Hypothesis Testing Unilateral Test Related to a Proportion
5. Conclusion.
134
The observed sample proportion is = 0.1675.
800
According to the decision rule, since
0.1675 > 0.152, we accept the alternative
hypothesis H1 : we conclude that the player is
cheating.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 37 / 61
Comparison Test
3. Comparison Test
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 38 / 61
Comparison Test Comparison of Two Means
Example:
A company manufactures plastic rubbish bags. To
monitor production, regular checks are conducted on
the maximum weight the bags can support.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 39 / 61
Comparison Test Comparison of Two Means
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 40 / 61
Comparison Test Comparison of Two Means
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 41 / 61
Comparison Test Comparison of Two Means
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 43 / 61
Comparison Test Comparison of Two Means
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 44 / 61
Comparison Test Comparison of Two Means
2. Formulating Hypotheses.
The null hypothesis H0 is m1 = m2 (the quality
has not changed).
The alternative hypothesis H1 is m1 ̸= m2 (the
quality has changed).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 45 / 61
Comparison Test Comparison of Two Means
3. Critical Region.
Assuming the null hypothesis H0 is true, we have
m1 − m2 = 0, so D follows the normal
distribution N (0, 0.512 ).
We seek the real number ε such that
P (−ε ≤ D ≤ ε) = 0.96.
ε
We find = 2.055, hence ε ≃ 1.05.
0.51
At a 4% significance level, the critical region is:
] − ∞, −1.05 [ ∪ ] 1.05 , +∞[.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 46 / 61
Comparison Test Comparison of Two Means
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 47 / 61
Comparison Test Comparison of Two Means
4. Decision Rule.
If the difference between the means of the two
samples is less than −1.05 or greater than 1.05,
the null hypothesis H0 is not validated.
If the difference between the means of the two
samples is between −1.05 and 1.05, the null
hypothesis H0 is validated.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 48 / 61
Comparison Test Comparison of Two Means
5. Conclusion.
The difference between the means of the two
samples is 58 − 56 = 2.
According to the decision rule, we reject H0 and
conclude that the quality of the bags has changed
between dates t1 and t2 .
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 49 / 61
Comparison Test Comparison of Two Proportions
Example:
Following an examination, there are 23 students who
passed and 17 who failed in one class, and 15 students
who passed and 25 who failed in another class.
Is the observed difference between the two success
percentages statistically significant at the 5% level,
indicating a difference in level between the two
classes?
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 50 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 51 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 52 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 53 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 54 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 55 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 56 / 61
Comparison Test Comparison of Two Proportions
2. Hypothesis Testing.
The null hypothesis H0 is p1 = p2 (both
populations have the same level),
the alternative hypothesis H1 is p1 ̸= p2 (the two
populations do not have the same level).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 57 / 61
Comparison Test Comparison of Two Proportions
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 59 / 61
Comparison Test Comparison of Two Proportions
4. Decision Rule.
If the difference in the means of the two samples
is less than −0.22 or greater than 0.22, then the
null hypothesis H0 is not validated. Otherwise,
the null hypothesis H0 is validated.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 60 / 61
Comparison Test Comparison of Two Proportions
5. Conclusion.
The difference in success rates between the two
23 15
samples is − = 0.2.
40 40
According to the decision rule, we conclude that
at a 5% error risk, the observed difference
between the two samples is not statistically
significant to indicate a difference in level
between the two classes. (The null hypothesis H0
is validated).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 61 / 61