0% found this document useful (0 votes)
5 views61 pages

Hypothesis Testing in Quality Control

The document discusses hypothesis testing in the context of quality control for a machine that fills coffee packets. It explains the null hypothesis (H0) and alternative hypothesis (H1), the decision-making process based on sample results, and the significance level (α) associated with rejecting H0. An example is provided to illustrate a two-tailed test for a mean, concluding that a sample mean outside a defined critical region leads to rejecting H0.

Uploaded by

Fatima Belallam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views61 pages

Hypothesis Testing in Quality Control

The document discusses hypothesis testing in the context of quality control for a machine that fills coffee packets. It explains the null hypothesis (H0) and alternative hypothesis (H1), the decision-making process based on sample results, and the significance level (α) associated with rejecting H0. An example is provided to illustrate a two-tailed test for a mean, concluding that a sample mean outside a defined critical region leads to rejecting H0.

Uploaded by

Fatima Belallam
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapitre 9

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

We consider the following problem:

To fill coffee packets of 250 g, a machine is used,


calibrated with a certain level of precision. Within the
scope of quality control, we aim to determine whether
the machine is functioning correctly, that is, whether
any deviation from the standard “250 g” is due to a
technical issue with the machine rather than a
sampling problem.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 3 / 61
Introduction

Introduction

Thus, it cannot be expected that every packet


produced by the machine will weigh exactly 250 g, but
we can only require that the mathematical expectation
of the weights of all packets produced is 250 g.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 4 / 61
Introduction

Introduction

Suppose a pallet of 50 packets weighs, for instance,


12.45 kg. Should we conclude that the machine is
miscalibrated?

If, after recalibrating the machine differently, a new


pallet of 50 packets weighs 12.55 kg, can we conclude
that the machine is better calibrated?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 5 / 61
Introduction

Introduction

To address such a problem, we resort to a statistical


test, called a hypothesis test, which consists of a
procedure aimed at providing a decision rule that,
based on sample results, allows one to choose between
two statements, called statistical hypotheses.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 6 / 61
Introduction

Introduction

Définition (Null Hypothesis)


The null hypothesis, denoted H0 , is a statement
that postulates an equality between two data points
in a model or two coefficients.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 7 / 61
Introduction

Introduction

The null hypothesis of a statistical test is always


tested against a statement called the alternative
hypothesis, denoted H1 , which posits:

a difference in data
−→ bilateral / two-tailed test

an inequality between data


−→ unilateral / one-tailed test

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 8 / 61
Introduction

Introduction

The appropriate statistic for the test is thus a random


variable whose observed value will be used to decide
whether to “reject” or “not reject” H0 . The sampling
distribution of this statistic will be determined under
the assumption that the null hypothesis H0 is true.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 9 / 61
Introduction

Introduction

Thus, the methods of inferential statistics may lead to


two scenarios:
1. rejecting the null hypothesis H0 , thereby
accepting the alternative hypothesis H1 , or
2. accepting the null hypothesis H0 , thereby
rejecting the alternative hypothesis H1 .

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 10 / 61
Introduction

Introduction

Définition (Rejection Region)


The rejection region, or critical region, of the
null hypothesis H0 is the set of values for which the
null hypothesis H0 is rejected.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
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

Procedure of a statistical test:


1. Construction of the hypothesis validity test
Step 1: determine a decision random variable and its
parameters,
Step 2: choose the two hypotheses: the null
hypothesis H0 and the alternative hypothesis H1 ,
Step 3: with the null hypothesis assumed to be true
and given the alternative hypothesis, determine the
critical region for a given error risk α,
Step 4: write a decision rule.
2. Application of the hypothesis test
Step 5: calculate the characteristics of a specific
sample, then apply the decision rule.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 13 / 61
Hypothesis Testing

2. Hypothesis Testing

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 14 / 61
Hypothesis Testing Two-Tailed Test for a Mean

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.

A quality control check on a sample of 100 washers


yielded 5.07 mm as the mean thickness of these 100
washers. Can we assert that the machine is correctly
calibrated at a 5% risk level?
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 15 / 61
Hypothesis Testing Two-Tailed Test for a Mean

Two-Tailed Test for a Mean

1. Decision Random Variable.


Let µ represent the expected value of X , i.e., the
mean thickness of all washers produced by the
machine in its current setting.

Consider the random variable M100 , which


associates to each sample of size 100, its mean.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 16 / 61
Hypothesis Testing Two-Tailed Test for a Mean

Two-Tailed Test for a Mean

Since the sample size is sufficiently large, we


assume
( that) M100 follows the distribution
0.32
N µ, , i.e., N (µ, 0.0009).
100
M100 will be the decision random variable.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 17 / 61
Hypothesis Testing Two-Tailed Test for a Mean

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

Two-Tailed Test for a Mean


3. Critical Region.
Assuming that the null hypothesis H0 is true, the
random variable M100 follows the distribution
N (5, 0.0009).

We seek the value of ε such that


P (5 − ε ≤ M100 ≤ 5 + ε) = 0.95.

From the standard normal distribution table, we


ε
find = 1.96, so ε ≃ 0.06.
0.03
The confidence interval is therefore:
[5 − 0.06, 5 + 0.06] = [4.94, 5.06]. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 19 / 61
Hypothesis Testing Two-Tailed Test for a Mean

Two-Tailed Test for a Mean

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 20 / 61
Hypothesis Testing Two-Tailed Test for a Mean

Two-Tailed Test for a Mean

Given that the probability of a sample having a mean


outside this interval is 0.05, such an event can be
considered rare. Consequently, the sample mean
µ100 = 5.07 calls into question the validity of the null
hypothesis H0 .

It is important to remember that it is still possible for


the machine to be correctly calibrated and for the
sample to belong to the 5% of cases where the mean
lies outside the identified interval. This is why this
region is referred to as the critical region.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 21 / 61
Hypothesis Testing Two-Tailed Test for a Mean

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

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.

We are tasked with formulating a decision rule to


verify the manufacturer’s claim at a 5% significance
level by testing a sample of 36 light bulbs.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 23 / 61
Hypothesis Testing Unilateral Test Related to a Mean

Unilateral Test Related to a Mean

1 Decision Random Variable.


Let µ denote the expected value of X , which is
the mean lifespan of all light bulbs produced by
the factory. Consider the random variable M36 ,
which associates the mean lifespan of 36 light
bulbs to each sample of 36 bulbs.

Since the sample size is sufficiently large, we


assume
( M36)follows the distribution
1202
N µ, , or N (µ, 400).
36
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 24 / 61
Hypothesis Testing Unilateral Test Related to a Mean

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

Unilateral Test Related to a Mean

In the previous example, washers were required to


have an average thickness of 5 mm, a measurement
with no room for excess or deficit. In this case,
however, the buyer would only express dissatisfaction
if the lifespan of the bulbs is less than 1120 hours. If
the sample mean µ exceeds 1120, the manufacturer’s
claim is immediately validated.

The alternative hypothesis H1 is therefore µ < 1120


(the manufacturer’s claim is false).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 26 / 61
Hypothesis Testing Unilateral Test Related to a Mean

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.

If the null hypothesis H0 is true, the random


variable M36 follows the distribution
N (1120, 202 ).

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 27 / 61
Hypothesis Testing Unilateral Test Related to a Mean

Unilateral Test Related to a Mean

We then seek the real number ε such that


P (M36 < 1120 − ε) = 0.05.
ε
We find = 1.645, thus ε ≃ 33.
20
The critical region is therefore the interval
] − ∞, 1120 − 33] =] − ∞, 1087].

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 28 / 61
Hypothesis Testing Unilateral Test Related to a Mean

Unilateral Test Related to a Mean

The critical region is the interval ] − ∞, 1087[: only


5% of samples of size 36 have an average lifespan of
less than 1087 hours.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 29 / 61
Hypothesis Testing Unilateral Test Related to a Mean

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).

If the observed sample mean me is greater than


1087, we accept the null hypothesis H0 .

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 30 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

Unilateral Test Related to a Proportion

Example: Unilateral Test Related to a


Proportion
A player who must randomly select a card from a
deck of 32 cards gains certain advantages if they
reveal a king. It is observed that they turned over a
king 134 times out of 800 attempts.

Can we presume, at a 1% significance level, that this


player is cheating?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 31 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

Unilateral Test Related to a Proportion

1. Decision Random Variable.


Let p be the proportion of kings the player would
reveal if they played an infinite number of times.

Let F be the random variable that, for each


sample of 800 attempts, associates the proportion
of kings revealed. Since the sample size is
sufficiently large,
( we assume)that F follows the
p(1 − p)
distribution N p, .
800
F will be the decision random variable.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 32 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

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).

If p < 0.125, we will also consider that the player


is not cheating. Therefore, the alternative
hypothesis H1 is p > 0.125 (the player is
cheating).
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 33 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

Unilateral Test Related to a Proportion


3. Critical Region.
If the null hypothesis H0 is true, the random
(
variable )
F follows the distribution
0.125 × 0.875
N 0.125, or N (0.125, 0.01172 ).
800
We then seek the real number ε such that
P (F > 0.125 + ε) = 0.01.
ε
We find that = 2.33, giving ε ≃ 0.027.
0.0117
The critical region is thus the interval
[0.125 + 0.027, +∞[= [0.152, +∞[. . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 34 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

Unilateral Test Related to a Proportion

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 35 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

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.

If the sample proportion is less than 0.152, we


accept the null hypothesis H0 : the null hypothesis
H0 is validated.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 36 / 61
Hypothesis Testing Unilateral Test Related to a Proportion

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

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.

On the first date t1 , a check of 100 bags resulted in an


average weight of 58 kg with a standard deviation of 3
kg.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 39 / 61
Comparison Test Comparison of Two Means

Comparison of Two Means

On the second date t2 , a check of 150 bags resulted in


an average weight of 56 kg with a standard deviation
of 5 kg.

Can we consider, at a 4% significance level, that the


quality of the bags has changed between the two
dates?

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 40 / 61
Comparison Test Comparison of Two Means

Comparison of Two Means

1. Decision Random Variable.


Let E1 (resp. E2 ) represent the population of all
bags produced by the company on date t1 (resp.
t2 ).

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 41 / 61
Comparison Test Comparison of Two Means

Comparison of Two Means

Let M1 be the random variable that assigns the


mean of each sample of 100 bags taken from the
population E1 .
A point estimate of the mean and standard
deviation√ on date t1 is: m1 = 58, and
100
σ1 = 3 × .
99
Given the large(sample size,
) M1 (follows )the
σ12 1
distribution N m1 , = N 58, .
100 11
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 42 / 61
Comparison Test Comparison of Two Means

Comparison of Two Means

Let M2 be the random variable that assigns the


mean of each sample of 150 bags taken from the
population E2 . A point estimate of the mean and
standard √deviation on date t2 is: m2 = 56, and
150
σ2 = 5 × .
149
Given the large(sample size,
) M2 (follows the)
2
σ2 25
distribution N m2 , = N 56, .
150 149

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 43 / 61
Comparison Test Comparison of Two Means

Comparison of Two Means

The random variable D = M1 − M2 also follows a


normal distribution with parameters:
E[D] = E[M1 ] − E[M2 ] = m1 − m2 .
1 25
var(D) = var(M1 ) + var(M2 ) = + = 0.2587.
11 149
Thus, σD = 0.51.
Therefore, D follows the distribution
N (m1 − m2 , 0.512 ). D is the decision random
variable.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 44 / 61
Comparison Test Comparison of Two Means

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

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

Comparison of Two Means

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 47 / 61
Comparison Test Comparison of Two Means

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

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

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

Comparison of Two Proportions

1. Random Variable for Decision-Making.


We assume that the first class is drawn from a
population C1 where the success rate is p1 , and
the second class is drawn from a population C2
where the success rate is p2 .

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 51 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

Let F1 be the variable that associates the success


rate to each sample of 40 students from
population C1 .
Given the sufficiently large sample size, F1 is
( √to follow the
assumed ) distribution
p1 (1 − p1 )
N p1 , .
40

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 52 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

A point estimate for the success rate and the


standard deviation in population C1 is:
23
p1 = = 0.545, and

40 √
40 0.545(1 − 0.545)
σ1 = × = 0.079.
39 40
Thus, F1 follows the distribution N (p1 , 0.0792 ).

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 53 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

Let F2 be the variable that associates the success


rate to each sample of 40 students from
population C2 .
Given the sufficiently large sample size, F2 is
( √to follow the
assumed ) distribution
p2 (1 − p2 )
N p2 , .
40

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 54 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

A point estimate for the success rate and the


standard deviation in population C2 is:
15
p2 = = 0.375, and

40 √
40 0.375(1 − 0.375)
σ2 = × = 0.078.
39 40
Thus, F2 follows the distribution N (p2 , 0.0782 ).

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 55 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

The random variable D = F1 − F2 also follows a


normal distribution with parameters:
E[D] = E[F1 ] − E[F2 ] = p1 − p2 .
var(D) = var(F1 ) + var(F2 ) = 0.0792 + 0.0782 .
Hence, σD = 0.11.

Thus, D follows the distribution N (p1 − p2 , 0.112 ).

D is the random variable for decision-making.

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 56 / 61
Comparison Test Comparison of Two Proportions

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

Comparison of Two Proportions


3. Critical Region.
Assuming the null hypothesis H0 is true, we have
p1 − p2 = 0, thus D follows the normal
distribution N (0, 0.112 ).

We then find the value ε such that


P (−ε ≤ D ≤ ε) = 0.95.
ε
We obtain = 1.96, so ε ≃ 0.22.
0.11
For a 5% error risk, the critical region is:
] − ∞, −0.22[∪]0.22, +∞[.
. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 58 / 61
Comparison Test Comparison of Two Proportions

Comparison of Two Proportions

. . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . .
Dr Khalil Amine (EHTP, Casablanca) [Link]@[Link] 59 / 61
Comparison Test Comparison of Two Proportions

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

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

You might also like