[go: up one dir, main page]

0% found this document useful (0 votes)
11 views81 pages

Hypothesis Testing in Engineering

Engineering probability and statistics

Uploaded by

j84bgr7c5c
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)
11 views81 pages

Hypothesis Testing in Engineering

Engineering probability and statistics

Uploaded by

j84bgr7c5c
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
You are on page 1/ 81

ENGINEERING PROBABILITY

& STATISTICS

TOPIC 6: HYPOTHESIS TESTING


Outline
• Introduction to hypothesis testing.
• Procedure of hypothesis testing.
• 𝑧-test, 𝑡-test
• Other common tests.
Introduction
Motivating examples
• Mr. Cường “đô la” is rumored to be a rich guy.
• How can you check for the rumor (the term ‘hypothesis’ in
statistics)?
• You need evidence?
Reject or not reject?
• The evidence is: you are seeing Mr.
Cuong is on a Dream 2.
• The probability of a wealthy man is
riding a Dream 2 is high or low?
• Can you reject the hypothesis/rumor
that ‘Cuong is rich’ or not?
• It is a good rejection?
Reject or not reject?
• Another day, you are seeing that Mr.
Cuong is driving Ferrari F8 Tributo.
• The probability of a wealthy man is
riding a Ferrari is high or low?
• Can you reject the hypothesis/rumor
that ‘Cuong is rich’ or not?
• It is a good non-rejection?
“Cuộc đời lúc nhục, lúc vinh,
Khi vay đấu gạo, khi ninh con bò.”
A new rumor claims that…
• Mr. Cuong goes bankrupted and is as poor as many others.
• How do you use the following evidences to support or reject
your new hypothesis:
§ Dream 2
§ Ferrari F8 Tributo
Hypothesis Testing
• A statistical hypothesis is usually a statement about a set of
parameters of a population distribution.
• A hypothesis is just a conjecture that is not known whether or not it is
true.
• We will learn the procedure for determining whether or not the values
of a random sample from the population are consistent with the
hypothesis.
• Example: we have an sample of Vietnamese men heights and want to evaluate if
the average of the Vietnam population reach a certain threshold or not, such as:
the world average. In particular, 𝜇 = 170cm.
Hypothesis Testing (2)
• If the random sample is found to be consistent with the hypothesis
under consideration, we say that the hypothesis has is supported by
the data;
• Otherwise, we say that the hypothesis can be rejected.
• It is noted that we never know for sure about the true value of the
parameter. We only learn the data is consistent or inconsistent (agree
or does not agree) with the hypothesis.
Hypothesis Testing’s
Procedure
Components of Hypothesis Testing
• 𝑯𝟎 : the null hypothesis. It is the default assumption for the model generating the
data.
• 𝑯𝟏 (𝒐𝒓 𝑯𝑨): the alternative hypothesis. If we can reject the null hypothesis, the
data is consistent with this hypothesis.
• 𝒅(𝑿): the test statistic. It is a random variable, and the data gives us its observed
values.
• The distribution of the test statistic: the probability distribution of 𝑑(𝑋) under 𝐻$.
• Rejection region/ critical region: if a sample (the data) provides a value of 𝑑(𝑋)
that is in the rejection region, we reject 𝐻$ in favor of 𝐻% .
Null Hypothesis 𝐇𝟎 and Alternative
Hypothesis 𝐇𝟏
• 𝐻! : the null hypothesis. This is the default assumption for the
model generating the data.
• 𝐻" : the alternative hypothesis. If we reject the null hypothesis is
we accept this alternative as the best explanation for the data.
• When performing a test using data, we have two cases:
• The evidence of the data rejects 𝐻$.
• The evidence of the data fails (do not) to reject 𝐻$.
Analogies
• In the court, one is always assumed to be innocent until proven
guilty beyond a reasonable doubt. We can write down as:
𝐻! : the defendant is innocent the default .
𝐻" : the defendant is guilty.
• Common sense lets us know that a coin is made fair unless we
have strong evidence to conclude it is not.
𝐻! : the coin is fair the default .
𝐻" : the coin is biased.
The test statistic
• The test statistic 𝒅 𝑿 is a statistic that is a function of the sample:
𝑑 𝑋 = 𝑔 𝑋! , 𝑋" , … , 𝑋#
• The test statistic is a random variable with a probability distribution.
• Note that: each sample (or each data) will provide a distinct value (as
a realization) for the test statistic.
• We will evaluate how likely the data generates the value of the test
statistic under the null hypothesis.
• We look at the rejection region (or the critical region) to see that.
Example
• To test whether a coin is fair we toss it 10 times. If we get an
unexpectedly large or small number of heads, we’ll suspect the
coin is unfair.
• Let 𝜃 be the probability of heads each time.
• If the coin is fair, 𝜃 is exactly 0.5. This is the hypothesis we want
to evaluate.
Example: toss a coin 10 times
• Null hypothesis: 𝐻! = ‘the coin is fair’, or
𝐻! : 𝜃 = 0.5
• Alternative hypothesis: 𝐻" = ‘the coin is not fair’, or
𝐻" : 𝜃 ≠ 0.5
• Test statistic:
"!
𝑑(𝑋) = 2 𝑋# = number of heads in 10 tosses
#$"
• The PDF of the test statistics based on the null hypothesis and random sample:
𝑝(𝑥 ∣ 𝜃 = 0.5) ∼ Binomial(10, 0.5).
Example: toss a coin 10 times
• The probability table under the null hypothesis 𝐻! : 𝜃 = 0.5:
𝑥 0 1 2 3 4 5 6 7 8 9 10
𝑝 𝑥 under 𝐻! : 𝜃 = 0.5 0.001 0.010 0.044 0.117 0.205 0.246 0.205 0.117 0.044 0.010 0.001

• We’ll reject 𝐻! if the number of heads is “extreme” (or too fewer


or greater than 5).
• What are the values of 𝑥 are considered “extreme”. We look at
the probabilities of them.
𝑥 0 1 2 3 4 5 6 7 8 9 10
𝑝(𝑥|𝜃 = 0.5) 0.001 0.010 0.044 0.117 0.205 0.246 0.205 0.117 0.044 0.010 0.001

• Let’s set the rejection region as {0, 1, 2, 8, 9, 10}.


• The total probability of rejection region are 0.001 + 0.010 + 0.044 ∗ 2 = 0.11, or
𝑃 rejecting H$ when H$ is true = 0.11 (this is Type I error).
• Note:
§ The null hypothesis is the cautious default. We are thinking that the coin is fair unless…
there are very strong evidence against it.
§ The rejection has the probability of 0.11 which is relatively extreme. The numbers of 0, 1,
2, 8, 9, and 10 are more likely from the alternative hypothesis.
§ Which alternative hypothesis is the most likely? We needs perform other tests.
Two types of error
• There are two types of errors we can make:
• Type I: incorrect rejection of 𝐻! .
• Type II: incorrect non-rejection of 𝐻! .

• Type I and type II error measures the “quality” of the test.


• Type I is more severe and needed to prioritized. We want to make it small.

When 𝐇𝟎 is true When 𝐇𝟏 is true


Reject 𝑯𝟎 Type I error Correct inference
Do not reject 𝑯𝟎 Correct inference Type II error
Significance level and power of the test
We call:
Signi=icance level at 𝛼 = 𝑃 Reject 𝐻! when 𝐻! is true
= probability we incorrectly reject 𝐻!
= 𝑃 Type I error
Power of the test = 𝑃 Reject 𝐻! when 𝐻! is wrong
= probability we correctly reject 𝐻!
= 1 − 𝑃 Type II error
Significance level
• In general, we need to make a trade-off between type I and type II errors.
Lower one must increase the other.
• Type I error is more severe and usually fixed at a small levels such as 0.1,
0.05, 0.01 or 0.001.
• These levels are called significance level of the test. The notation is 𝛼.
• Example: significance level 𝛼 = 0.05.

• Note that:
𝑃 Reject 𝐻$ when 𝐻$ is wrong + 𝑃 Reject 𝐻$ when 𝐻$ is true ≠ 100%
Hypothesis testing’s general procedure
1. Pick the null hypothesis 𝐻! . It could be one-sided or two-sided.
2. Find the optimal test statistic.
3. Pick a significance level and find the rejection region.
4. Compare the value of the test statistic from the data with the
rejection region.
5. Make the conclusion.
Tests Concerning Mean of a
Normal Population
Example
• We know that the heights of Vietnamese men have been improved
in the last 30 years. We want to check whether the average height
of the population has been reached to 170cm or not.
• We take a sample and perform hypothesis testing. The two types
of hypotheses can be written down as:
H! : 𝜇 = 170
H" : 𝜇 ≠ 170
Two-sided test for known variance (𝑧-test) (1)

• In general, we can write down the two hypotheses as:


𝑯𝟎 : 𝝁 = 𝝁𝟎
𝑯𝟏 : 𝝁 ≠ 𝝁𝟎
• 𝝁𝟎 is the value of the mean of the population’s distribution that
we assume it generates the data.
• This is the two-sided, or two-tailed test.
Two-sided test for known variance (𝑧-test) (2)

• Assume that our data is a random sample that 𝑋! , 𝑋" , …, 𝑋$ are IID
normal distributed with unknown mean 𝜇 and a known variance 𝜎 " .
• Under H% : 𝜇 = 𝜇% , the distribution 𝑁(𝜇% , 𝜎 " ) generates the data. Hence,
𝑋! + 𝑋" + ⋯ + 𝑋# 𝜎"
𝑋0 = ~ 𝑁(𝜇% , )
𝑛 𝑛
• We get the test statistic as:

𝑋0 − 𝜇%
𝑍= ~ 𝑁(0,1)
𝜎/ 𝑛
𝝈𝟐
- ~ 𝑵(𝝁𝟎 , )
𝑿
𝒏

M (as a value) is extreme


𝒙
if the belong to the two
tail areas.
𝝁𝟎
Example: a population of men with the mean
at 170cm has a low chance to have a random
sample with the sample mean at 160cm The standardization
𝒁 ~ 𝑵 𝟎, 𝟏
provide us with 𝒁 ~ 𝑵 𝟎, 𝟏
𝜶
𝟐 𝜶
𝟐

0
Two-sided test for known variance (𝑧-test) (3)

• Let choose a significance 𝛼, we get the rejection region (or the critical
region) in the blue-shaded areas as:

The standard normal 𝒁 ~ 𝑵(𝟎, 𝟏)

𝜶 𝜶
𝟐 𝟐

0
Rejection Non-rejection Rejection
region of 𝑯𝟎 region of 𝐻# region of 𝑯𝟎
Critical values
Critical values for significance level 𝜶
• Critical values are like quantiles except
they refer to the probability to the right
of the value instead of the left at 𝛼. 𝜶 𝜶
𝟐
• The value of the test statistic that marks 0
𝟐

the start of the rejection region is a Rejection Non-rejection Rejection


critical value. region of 𝑯𝟎 region of 𝐻# region of 𝑯𝟎

• On the two-sided test, we use both


negative and positive values of the
critical values to formulate the rejection
regions.
Critical values (2)
Critical values for significance level 𝜶

• When 𝛼 = 0.05, each blue-shaded


areas in the left and the right are
𝜶 𝜶
𝛼/2 = 0.025. Hence, the critical value 𝟐 𝟐
is +𝟏. 𝟗𝟔. 0
Rejection Non-rejection Rejection
• We label 𝑧$.$67 = 1.96 region of 𝑯𝟎 region of 𝐻# region of 𝑯𝟎

• It is because 𝑃 𝑍 ≥ 1.96 ≈ 0.025.


And 𝑧$.$67 has 2.5% probability to its
right and therefore 97.5% probability
to its left.
Example
• We are testing the hypothesis that the average height of
Vietnamese young men is the same as 170cm (the world
average) at the significance level 𝛼 = 0.05.
• We know that the data has the sample mean 𝑥̅ = 168.7cm with
the sample size 𝑛 = 100, and the population is normally
distributed with unknow mean 𝜇 and know standard deviation
𝜎 = 6.
Example
• The null and alternative hypotheses can be written down as:
H! : 𝜇 = 170
H" : 𝜇 ≠ 170
• The test statistic is:
𝑥̅ − 𝜇! 168.7 − 170 −1.3
𝑧= = = 10 ∗ = −2.167
𝜎/ 𝑛 6/ 100 6
Example
• At significance level 𝛼 = 0.05, we know that 𝑃 𝑍 ≤ −1.96 =
𝑃 𝑍 ≥ 1.96 = 0.025. The rejection region is as:
−∞, −1.96 ∪ 1.96, +∞
𝜶 𝜶
= 𝟎. 𝟎𝟐𝟓 = 𝟎. 𝟎𝟐𝟓
𝟐 𝟐
Non-rejection
region of 𝐻#

−𝟏. 𝟗𝟔 0 𝟏. 𝟗𝟔
Rejection Rejection
region of 𝑯𝟎 region of 𝑯𝟎
Example
• 𝑧 = 2.167 belong to the rejection region.
• Hence, we can reject 𝐻! that the mean of the Vietnamese men’s
height is 170cm.
• It implies that we have evidence for 𝐻" that the mean of the
Vietnamese young men’s height is NOT 170cm.
Example
If we use the significance level at 1%, what is outcome of the test?
Solution:
• The new critical values is 𝑧!.!!0 = 2.580. Now, 𝑧 = 2.167 do not
belong to the rejection region.
• Hence, we cannot reject the null hypothesis. Hence, this
evidence is supporting 𝐻!
Example
Now, we have another sample, with 𝑛 = 1000 and 𝑥̅ = 168.7. Perform
the test at the significance at 1% and 5%?
Solution:
• The new test statistic is:
𝑥̅ − 𝜇% 168.8 − 170
𝑧= = ≈ −6.852
𝜎/ 𝑛 6 ∗ 1000
• It is a huge value. We can reject the null hypothesis at 1% and 5%
significance levels..
One-sided test for known variance
• In the one-sided test, the null hypothesis involves a range of
values rather a single value as in the one-sided test.
• We have two types of two-sided test:
H! : 𝜇 ≥ 𝜇! 𝑣𝑠 H" : 𝜇 < 𝜇!
H! : 𝜇 ≤ 𝜇! 𝑣𝑠 H" : 𝜇 > 𝜇!
• Note that for technical reasons, 𝑯𝟎 must always have ≥ or ≤ or =
One-sided test for known variance (2)
• For one-sided tests, the test statistic, under the null hypothesis
𝐻! , is also the same:
𝑋h − 𝜇!
𝑍= ~ 𝑁(0, 1)
𝜎/ 𝑛
• The rejection region now changes. At a significance level 𝛼:
For H! : 𝜇 ≥ 𝜇! 𝑣𝑠 H" : 𝜇 < 𝜇! : it is [−∞, 𝑧1 ]
For H! : 𝜇 ≤ 𝜇! 𝑣𝑠 H" : 𝜇 > 𝜇! : it is [ 𝑧1 , +∞]
Two-side 𝑯𝟎 : 𝝁 ≠ 𝝁𝟎

𝛼/2 𝛼/2

−𝑧$/& 𝑧$/&

One-side: 𝑯𝟎 : 𝝁 ≤ 𝝁𝟎 𝐯𝐬 𝑯𝟏 : 𝝁 > 𝝁𝟎 One-side: 𝑯𝟎 : 𝝁 ≥ 𝝁𝟎 𝐯𝐬 𝑯𝟏 : 𝝁 < 𝝁𝟎


𝛼 𝛼

𝑧' −𝑧'

Rejection region of 𝐻# Rejection region of 𝐻#


Example
Test the hypothesis that the average heights of Vietnamese men
has overcame the world average at 170cm at the significance level
𝛼 = 0.05 with 𝑛 = 100, and 𝜎 = 6. We have two samples:
a. Sample #1 that the sample mean 𝑥̅ = 169.2cm
b. Sample #2 that the sample mean 𝑥̅ = 170.8cm
c. Sample #3 that the sample mean 𝑥̅ = 172cm
Solution
• Keep in mind that the default case is that the average of
Vietnamese men is still SHORTER than 170. Hence, we have:
H! : 𝜇 ≤ 170cm
H" : 𝜇 > 170cm
• The critical value 𝑧!.!0 = 1.645.
• The test statistic for each sample One-side: 𝑯𝟎 : 𝝁 ≤ 𝝁𝟎 𝐯𝐬 𝑯𝟏 : 𝝁 > 𝝁𝟎

?̅ #" @A# EFG.6@EH$ 𝛼


Sample #1: 𝑧 = B/ D
= F/ E$$
= −1.33

?̅ #$ @A# EHE.6@EH$ 𝑧$ =1.645


Sample #2: 𝑧 = B/ D
= F/ E$$
= 1.33
Rejection region of 𝐻#
?̅ #% @A# EH6.$@EH$
Sample #3: 𝑧 = B/ D
= F/ E$$
= 3.33

• The conclusion:
With samples #1 and #2, we fail to reject 𝐻$, and
We can reject 𝐻$ with sample #3.
The critical values for the 𝒛 test
One-sided One-sided
Significance Two-sided
Left-tail Right-tail
level 𝜶
Critical Values

10% 1.645 -1.280 1.280


5% 1.960 -1.645 1.645
1% 2.580 -2.330 2.330

• Note: you can obtain them from the table of the standard normal CDF, or
using the function NORM.DIST()of Excel.
𝑝-value
• Definition: Assume the null hypothesis, 𝒑-value is the
probability of the obtaining the test statistic (from experimental
data) is at least as extreme as from observed data.
• In other words, 𝑝-value is the smallest significance level that we
can reject 𝐻! with the data.
• In practice, people often specify the significance level and
perform the significance test using 𝑝-values.
Computing 𝒑-value
• The 𝑝-value is the total probability computed
from the obtained test statistic. 0
The test statistic 𝒙
-
• The orange-shaded region is “at least as (obtained from the data)
extreme as” the data.
• One-sided and two-sided tests have a slightly
𝜶
different way to compute the 𝑝-value. 𝟐
• We can reject the null hypothesis when the
orange-shaded area is than the blue-shaded 0
The test statistic 𝒙
-
area. (obtained from the data)
Example: 𝒑-value of a one-sided test
• For example, if we have a
negative statistic 𝑧 = −2.37 for a
𝜶
one-sided z test. 𝟐
The area of p-value Non-rejection
• From 𝑃 𝑍 ≤ −2.37 = 0.009, the region of 𝐻#

p-value is 0.09 or 0.9%. 0

• We can reject the null hypothesis Rejection Rejection


region of 𝑯𝟎 region of 𝑯𝟎
at 1% and more.
We do not reject 𝐻! when 𝑝-value > 𝛼 We reject 𝐻! when 𝑝-value < 𝛼

𝜶 𝜶
The area of The area of 𝟐
𝟐 p-value
p-value
Non-rejection Non-rejection
region of 𝐻# region of 𝐻#

0 0

Rejection Rejection
region of 𝑯𝟎 region of 𝑯𝟎
Example: 𝒑-value of a two-sided test
• For example, if we have a negative
statistic 𝑧 = −2.37 for a two-sided
𝜶
𝒛 test. The area of p-value 𝟐 The area of p-value
Non-rejection
• From 𝑃 𝑍 ≤ −2.37 = 0.009, the p- region of 𝐻#
value is 2 ∗ 0.009 = 0.018 or 1.8% 0
• We can reject the null hypothesis
Rejection Rejection
at 1% significance level but do not region of 𝑯𝟎 region of 𝑯𝟎
reject at 5%.
Problem
A population distribution is known to have standard deviation
𝜎 = 20. Determine the 𝑝-value of a test of the hypothesis that the
population mean is equal to 50, if the average 𝑋h of a sample of 64
observations is:
a. 52.5
b. 55.0
c. 57.5.
Unknown Variance:
the 𝑡-test
𝟐
Hypothesis testing under unknown 𝝈
• The case of known 𝜎 " is rare.
• The more common situation is that both 𝝁 and 𝝈𝟐 are unknown.
• Under that case, we need to perform the 𝑡-test.
• It is noted that we are still assuming that the population is normally
distribution.
The set-up of 𝒕 test
• We have a random sample 𝑋! , 𝑋" , … , 𝑋# ~ 𝑁 𝜇, 𝜎 " with unknown 𝜇 and 𝜎 " .
• The hypothesis can be one-sided or two-sided.
• Under the null hypothesis 𝐻$, the test statistic has a Student-𝑡 distribution:
𝑋` − 𝜇$
𝑇= ~ 𝑡D@E
𝑆/ 𝑛
𝑡D@E has 𝑛 − 1 degrees of freedom.
The set-up of 𝒕 test (2)
• With a data, we can compute the value of the test statistic as:
𝑥̅ − 𝜇!
𝑇=
𝑆/ 𝑛
"
where 𝑆 =8 ∑9;<" 𝑥; − 𝑥̅ 8
as the sample variance.
9:"
The Student-𝑡 distribution
Two-side 𝑯𝟎 : 𝝁 ≠ 𝝁𝟎

The 𝑡𝜶 critical value 𝛼/2 𝛼/2

−𝑡'/) 𝑡'/)
• The rejection regions are similar
to the 𝑧 test. One-side: 𝑯𝟎 : 𝝁 ≥ 𝝁𝟎 𝐯𝐬 𝑯𝟏 : 𝝁 < 𝝁𝟎

• The critical values can be got from 𝛼


the table or Excel by the function
T.INV(). −𝑡'

• When 𝑛 is large, the Student-𝑡 One-side: 𝑯𝟎 : 𝝁 ≤ 𝝁𝟎 𝐯𝐬 𝑯𝟏 : 𝝁 > 𝝁𝟎


distribution approximates the 𝛼
standard normal 𝑁 0, 1 .
𝑡'
Example
• We have sample of 5 men with the following heights
170, 168, 175, 172, 165
Perform hypothesis testing for the following hypotheses:
H! : 𝜇 = 170
H" : 𝜇 ≠ 170
Remarks (1)
• A significance level of 0.05 DOES NOT mean the test only is wrong 5% of
the time. It means that if the null hypothesis 𝑯𝟎 is true, then the
probability of incorrectly rejecting 𝑯𝟎 is 5% by the test.
• The null hypothesis is considered the ‘cautious’ one. The lower we set the
significance level (from 5% to 1%), the stronger of our evidence against 𝐻$
needs to be to reject 𝐻$.
In our example testing 𝜇 = 170, the sample mean needs to deviate more
from 170cm to reject 𝐻$ (from 5% to 1%).
Remarks (2)
• When we fail to reject the null hypothesis 𝐻% , it does not prove 𝐻% is
not wrong; it simply indicates that the data does not support a
rejection of 𝐻% .
̅ *
()* - *
.)*
• When the sample size 𝑛 increases, the test statistic 𝑧 = +/ #
or 𝑇 = // #
also gets bigger. It means that it becomes easier to reject the null
hypothesis.
Normal Population: Summary (1)
Normal Population: Summary (2)
If Population IS NOT Normal?
• Under the case that the population is not normally distributed,
the central limit theorem says that:
𝑋h − 𝜇
𝑍= 𝑛 ≈ 𝑁 0, 1 when 𝑛 is large
𝑆
=
>:?
• The test statistic 𝑍 = 𝑛 works when 𝑛 is large.
@
Equality of Means of Two
Normal Populations
Equality of two means: Normal and
KNOWN variance
• Two groups of data are normal random samples:
𝑋; ∼ 𝑁 𝜇> , 𝜎>8 , 𝑖 = 1,2, … 𝑛
𝑌A ∼ 𝑁(𝜇B , 𝜎B8 ), 𝑗 = 1,2, … 𝑚
where both 𝜇> and 𝜇B are unknown and possibly different.
• 𝜎>8 , 𝜎B8 are KNOWN and possibly equal.
• 𝑋; and 𝑌A are assumed to be independent.
Null and Alternative Hypotheses
• The null hypothesis 𝐻! :
𝐻! : 𝜇> − 𝜇B = Δ
• The alternative hypothesis 𝐻" :
Two-sided 𝐻" : 𝜇> − 𝜇B ≠ Δ
One-sided 𝐻" : 𝜇> − 𝜇B > Δ (greater)
One-sided 𝐻" : 𝜇> − 𝜇B < Δ (lesser)
The test statistic
"
C! C#"
• From 𝑋h − 𝑌h ~ 𝑁 𝜇> − 𝜇B , + , the test statistic:
9 D

𝑋h − 𝑌h − Δ
𝑡= ~ 𝑁(0, 1)
𝜎>8 𝜎B8
𝑛 +𝑚
The rejection region
• Two-sided:𝐻" : 𝜇> − 𝜇B ≠ Δ
−∞, −𝑧1/8 ∪ 𝑧1/8 , +∞
• One-sided 𝐻" : 𝜇> − 𝜇B > Δ (greater)
𝑧1 , +∞
• One-sided 𝐻" : 𝜇> − 𝜇B < Δ (lesser)
−∞, −𝑧1
Equality of two means: Normal and
UNKNOWN and EQUAL variance
• Two groups of data are normal random samples:
𝑋; ∼ 𝑁 𝜇> , 𝜎>8 , 𝑖 = 1,2, … 𝑛
𝑌A ∼ 𝑁(𝜇B , 𝜎B8 ), 𝑗 = 1,2, … 𝑚
where both 𝜇> and 𝜇B are unknown and possibly different.
• 𝜎>8 , 𝜎B8 are UNKNOWN but EQUAL.
• 𝑋; and 𝑌A are assumed to be independent.
The test statistic
= B:?
>: = ! :?#
• From @$"
~ 𝑡9ED:8 , the test statistic:

𝑋h − 𝑌h − Δ
𝑡= 8 ~ 𝑡(𝑛 + 𝑚 − 2)
𝑆F
" "
9:" G! E D:" G# " "
with 𝑆F8 = + ; 𝑆> and 𝑆B are the sample
9ED:8 9 D
mean of two random sample 𝑋; and 𝑌A
The rejection region
• Two-sided 𝐻" : 𝜇> − 𝜇B ≠ Δ
−∞, −𝑡1,/8 9ED:8 ∪ 𝑧1,/8 9ED:8 , +∞

• One-sided 𝐻" : 𝜇> − 𝜇B > Δ (greater)


𝑡1, 9ED:8 , +∞
• One-sided 𝐻" : 𝜇> − 𝜇B < Δ (lesser)
−∞, −𝑡1,9ED:8
Equality of two means: Normal and
UNKNOWN and UNEQUAL variance
• For this case, the distribution of the test statistic become
complicated. We need to invoke the CLT with 𝑛 and 𝑚
becoming large.
• We can approximate:

𝑋h − 𝑌h − Δ
𝑍= ≈ 𝑁(0, 1)
𝑆>8 𝑆B8
+
𝑛 𝑚
Normal Population: Summary (3)
The paired 𝑡 –test
Data in pairs
• When the data naturally comes in pairs (𝑥0 , 𝑦0 ), we can use the paired
two-sample 𝑡-test.
• ‘The pair’ is roughly thought as two measurements taken from the
same individual, object, or related units before and after an effect.
• Example: the body’s weights of a group of participants before and after an
exercise-training program; or
Fuel consumption of a group of cars after an engine upgrade.

• Be cautious that the assumptions of this test needs to be valid.


The test
• 𝑊0 = 𝑋0 − 𝑌0 , 𝑖 = 1,2. . 𝑛 with 𝑋0 and 𝑌0 being normal independent
random samples.
• The effect is zero if the mean of 𝑊0 . We want to test:
𝐻% : 𝜇1 = 0 vs 𝐻! : 𝜇1 ≠ 0
• Test statistic:
𝑊Q
𝑡= ~ 𝑡2)!
𝑆1 / 𝑛
with 𝑆1 as the sample variance of 𝑊0 .
Other Common Testing
Cases
Testing the variance of a normal
population
• Let 𝑋! , . . . , 𝑋# denote a sample from a normal population having
unknown mean 𝜇 and unknown variance 𝜎 " , we want to test:
𝐻% : 𝜎 " = 𝜎%" vs 𝐻! : 𝜎 " ≠ 𝜎%"
• The test statistic:
𝑛 − 1 𝑆" "
~ 𝜒#)!
𝜎%"
• The rejection region of a two-sided test:
" "
−∞, −𝜒!)3/",#)! ∪ 𝜒3/",#)! , +∞
Testing for the equality of variances of two
normal populations
• Let 𝑋! , . . . , 𝑋# and 𝑌! , . . . , 𝑌5 denote independent random samples
from two normal populations having respective (unknown)
parameters 𝜇. , 𝜎." and 𝜇6 , 𝜎6" . We want to test:
𝐻% : 𝜎." = 𝜎6" vs 𝐻! : 𝜎." ≠ 𝜎6"
• The test statistic:
𝐹 = 𝑆." /𝑆6" ~ 𝐹#)!, 5)!
• The rejection region for a two-sided test:
−∞, 𝐹!)3, #)!, 5)! ∪ 𝐹3, #)!, 5)! , +∞
" "
𝐻# : 𝜎'& ≤ 𝜎(&
𝐻# : 𝜎'& ≥ 𝜎(&
𝐻) : 𝜎'& > 𝜎(&
𝐻) : 𝜎'& < 𝜎(&
1− 𝛼

Rejection region: 𝐹 ≥ F$, +,),-,)


Rejection region: 𝐹 ≤ F),$, +,), -,)

𝐻# : 𝜎'& = 𝜎(&
𝐻) : 𝜎(& ≠ 𝜎(&

Rejection region: 𝐹 ≥ F$/&, +,), -,) or 𝐹 ≤ F),$/&, +,), -,)


Other cases from the textbook
• Testing the probability of success of a binomial distribution.
• Testing the equality of parameters in two Bernoulli populations
• Testing the mean of a Poisson distribution.
• Testing the relationship between two Poisson parameters.

You might also like