Professional Documents
Culture Documents
Introductory Statistics
Session 10
Hypothesis Testing
(One Sample)
Objectives
• Formulate Null and Alternative Hypotheses for Single
Population Mean and Proportion
• Decision Rule in Hypothesis Testing
• Use of Critical Value and p-value in Testing Hypothesis
• Type I Type II errors
2
Hypothesis Testing (One Sample) - Dr Gan
Concepts of Hypothesis Testing
A hypothesis is a claim (assumption) about a population
parameter.
Example:
The mean monthly mobile phone bill is:
𝜇 = $52
The proportion of elderly who are aware of the campaign is:
𝑝 = 0.32
Process:
First, there is a claim (e.g. that the mean age of the population is
50, i.e. 𝜇 = 50). Next, we collect a random sample of data and
calculate the sample mean (e.g. sample mean, 𝑥ҧ = 20). We would
like to test if 𝑥ҧ = 20 is likely if 𝜇 = 50. If it is not likely, then the
hypothesis is rejected.
𝛼 Also known as
𝐻0 : 𝜇 ≤ 3
critical value, 𝑍𝑐
𝐻1 : 𝜇 > 3 Upper-tail test
0 𝑍𝛼
𝛼 𝛼
𝐻0 : 𝜇 = 3 2 2
𝐻1 : 𝜇 ≠ 3 Two-tail test
−𝑍𝛼 0 𝑍𝛼
2 2
5
Hypothesis Testing (One Sample) - Dr Gan
Decision Rule:
p-Value, Critical Value, Test Statistics
𝑋ത − 𝜇0
• Test statistics, 𝑍 = 𝜎
𝑛
• 𝑝−𝑣𝑎𝑙𝑢𝑒 : Probability of obtaining a test statistic more extreme (≤ or ≥)
than the observed sample value given 𝐻0 is true (e.g. 𝐻0 : 𝜇 = 𝜇0 ).
−𝑍𝛼 𝑍
0
𝑋ത
---------------------------- Test statistics,
𝜇0
𝜎
Assumption: 𝑋ത − 𝜇0 𝜇0 − 𝑍𝛼
𝑛
𝑍= 𝜎
• Population is 𝐻0 ∶ 𝜇 = 𝜇0
𝑛
normally 𝐻1 ∶ 𝜇 ≠ 𝜇0
distributed 𝐶 𝐶%
𝛼 = 1−
100
𝛼 𝛼
2 Do not 2
reject 𝐻0
−𝑍𝛼 𝑍𝛼 𝑍
0
2 2
𝜇0 𝑋ത
𝜎 𝜎
𝜇0 − 𝑍 𝛼 𝜇0 + 𝑍 𝛼
2 𝑛 2 𝑛
8
Hypothesis Testing (One Sample) - Dr Gan
Hypothesis Test of Mean (𝜎 unknown)
Sampling 𝐻0 ∶ 𝜇 ≥ 𝜇0 What about
ത with ത 𝑁 𝜇𝑋ത , 𝜎𝑋ത 2 𝐻1 ∶ 𝜇 < 𝜇0 upper-tail test?
Distribution 𝑋, 𝑋~
𝐶 𝐶%
sample size n 𝜇𝑋ത = μ 𝛼 = 1−
100
(Population variance 𝑠2 𝑠
𝜎 2 unknown) 𝜎𝑋ത 2 = ⇒ 𝜎𝑋ത = 𝛼
Do not
𝑛 𝑛 reject 𝐻0
−𝑡𝜈, 𝛼 0 𝑍
𝑋ത
Test statistics, 𝜇0
𝑠
ത
---------------------------- 𝑡 = 𝑋 − 𝜇0
𝜇0 − 𝑡𝜈, 𝛼
𝑛
𝑠
Assumption: 𝐻0 ∶ 𝜇 = 𝜇0
𝑛
• Population is 𝐻1 ∶ 𝜇 ≠ 𝜇0
normally 𝐶 𝐶%
where 𝜈 = 𝑛 − 1 𝛼 = 1−
distributed 100
𝛼 𝛼
2 Do not 2
reject 𝐻0
− 𝑡𝜈 ,𝛼 𝑡𝜈,𝛼 𝑍
0
2 2
𝜇0 𝑋ത
𝑠 𝑠
𝜇0 − 𝑡𝜈 ,𝛼 𝜇0 + 𝑡𝜈 ,𝛼
2 𝑛 2 𝑛
9
Hypothesis Testing (One Sample) - Dr Gan
Example (known 𝜎)
A manager in the mobile phone industry thinks that customer monthly cell
phone bill has increased, and now average over $52 per month. The
company wishes to test this claim. Suppose a sample is taken with the
following results: n = 64, 𝑋ത = 53.1 (Assume 𝜎 = 10 is known and population
is normally distributed). Test the claim at 𝛼 = 10%.
Step 1: Develop hypotheses
𝐻0 ∶ 𝜇 ≤ 52
Do not
𝐻1 ∶ 𝜇 > 52 reject 𝐻0
0.10
1.2816 Z
0
Step 2: Decision Rule (𝜇0 )
Step 3: Conclusion
Since the test statistic (0.88) does not fall into the critical region, we do not
reject 𝐻0 at 10% significance level. We therefore conclude that there is not
sufficient evidence that population mean bill is over $52 per month.
10
Hypothesis Testing (One Sample) - Dr Gan
Example (unknown 𝜎)
The average cost of a hotel room in Chicago is said to be $168/night.
From a random sample of 25 hotels, the sample statistics are: 𝑋ത = $172.50
and s = $15.40. Test the claim at 𝛼 = 0.05. Assume the population
distribution is normal.
Step 1: Develop hypotheses
𝐻0 ∶ Do not
𝐻1 ∶ reject 𝐻0
2.0639 𝑡
−2.0639 0
(𝜇0 )
Step 2: Decision Rule
𝛼 = 0.05 ⇒ 𝑡𝜈, 𝛼 = 𝑡(25−1), 0.025 =
2
𝑋ത −𝜇0
Test statistics, 𝑡 = 𝑠 =
𝑛
Step 3: Conclusion
Since the test statistic ( ) _______ fall into the critical region, we____
_________ 𝐻0 at 5% significance level. We therefore conclude that there
__________evidence that population mean cost is ____________$168.
11
Hypothesis Testing (One Sample) - Dr Gan
Example (unknown 𝜎)
The average cost of a hotel room in Chicago is said to be $168/night.
From a random sample of 25 hotels, the sample statistics are: 𝑋ത = $172.50
and s = $15.40. Test the claim at 𝛼 = 0.05. Assume the population
distribution is normal.
Step 1: Develop hypotheses
𝐻0 ∶ 𝜇 = 168 0.025 Do not 0.025
𝐻1 ∶ 𝜇 ≠ 168 reject 𝐻0
2.064 𝑡
−2.064 0
(𝜇0 )
Step 2: Decision Rule
𝛼 = 0.05 ⇒ 𝑡𝜈, 𝛼 = 𝑡(25−1), 0.025 = ±2.064
2
𝑋ത −𝜇0 172.5−168
Test statistics, 𝑡 = 𝑠 = 15.4 = 1.4610 < 2.064
𝑛 25
⇒ 𝑑𝑜 𝑛𝑜𝑡 𝑟𝑒𝑗𝑒𝑐𝑡 𝐻0
Step 3: Conclusion
Since the test statistic (1.4610) does not fall into the critical region, we do
not reject 𝐻0 at 5% significant level. We therefore conclude that there is
not sufficient evidence that population mean cost is different than $168.
12
Hypothesis Testing (One Sample) - Dr Gan
Decision Rule with p-value
Step 2: Decision Rule
𝛼 = 0.05
𝑋ത −𝜇0 172.5−168
Test statistics, 𝑡 = 𝑠 = 15.4 = 1.4610
𝑛 25
= 0.1466
> 𝛼 = 0.05
-2.064 0 2.064
t = -1.461 t = 1.461
Since 𝑝−𝑣𝑎𝑙𝑢𝑒 > 𝛼 ⇒ do not eject 𝐻0
13
Hypothesis Testing (One Sample) - Dr Gan
HYPOTHESIS TEST OF
PROPORTION
15
Hypothesis Testing (One Sample) - Dr Gan
Example
A marketing company claims that it receives 8% responses from its direct
mail marketing. To test this claim, a random sample of 500 were surveyed
with 25 responses. Test the claim at the 𝛼 = 0.05.
Check if sample size is large enough (for approximate normal distribution):
25
Approximation for population proportion: 𝑝Ƹ = = 0.05
500
n𝑝 1 − 𝑝 = 500 0.05 0.95 = 23.75 > 5 → normally distributed
Step 1: Develop hypotheses
𝐻0 ∶ 𝑝 = 0.08
𝐻1 ∶ 𝑝 ≠ 0.08
0.025 0.025
Step 2: Decision Rule 𝑍
−1.96 0 1.96
𝛼 = 0.05 ⇒ 𝑍𝛼 = 1.96 (0.08)
2
ො 𝑝0
𝑝− 0.05−0.08
Test statistics, 𝑍 = = = −2.4727 < −1.96 ⇒ reject 𝐻0
𝑝0 (1−𝑝0 ) 0.08(1−0.08)
𝑛 500
16
Hypothesis Testing (One Sample) - Dr Gan
Example
Step 3: Conclusion
Since the test statistic (_______) falls into the critical region,
we_______ 𝐻0 at 5% significance level. We therefore
conclude that _____________evidence to reject the
company’s claim of 8% response rate.
17
Hypothesis Testing (One Sample) - Dr Gan
Example
Step 3: Conclusion
Since the test statistic (-2.4727) falls into the critical region,
we reject 𝐻0 at 5% significance level. We therefore conclude
that there is sufficient evidence to reject the company’s claim
of 8% response rate.
18
Hypothesis Testing (One Sample) - Dr Gan
Decision Rule with p-value
Step 2: Decision Rule
𝛼 = 0.05
ො 𝑝0
𝑝− 0.05−0.08
Test statistics, 𝑍 = = = −2.4727
𝑝0 (1−𝑝0 ) 0.08(1−0.08)
𝑛 500
𝛼 Do Not Reject 𝑯𝟎
𝑋ത
𝜇∗ 𝑋ത𝑐 𝜇0
𝑍
𝑍𝛼 = 𝑍𝑐
𝑍∗
𝑍𝛽 = 𝑍𝑐 ∗
From hypothesized mean graph: From actual mean graph:
1. Find 𝑍𝛼 using: 𝑃 𝑍 < 𝑍𝛼 = 𝛼 3. Find 𝛽 = 𝑃 𝑋ത > 𝑋ത𝑐 |𝜇 = 𝜇 ∗ where 𝑋~𝑁(𝜇
ത ∗
, 𝜎 2)
𝜎
2. Find 𝑋ത𝑐 using: 𝑋ത𝑐 = 𝜇0 + 𝑍𝛼 𝑛 Alternatively:
𝑋ത𝑐 −𝜇 ∗
3. Find 𝑍𝛽 using:𝑍𝛽 = 𝜎
𝑛
4. Find 𝛽 = 𝑃(𝑍 > 𝑍𝛽 ) where Z~𝑁(0 , 1)
21
Hypothesis Testing (One Sample) - Dr Gan
Type II Error Calculation
A hypothesis test is conducted to test the following
hypotheses at 5% significance level, given that 𝑛 = 64 and
𝜎 = 6. Suppose that the conclusion is “we do not reject the
null hypothesis”. If the true mean is in fact 50, determine the
probability of Type II error.
𝐻0 ∶ 𝜇 ≥ 52
𝐻1 ∶ 𝜇 < 52
22
Hypothesis Testing (One Sample) - Dr Gan
Example
Reject 𝑯𝟎 𝛽
𝑛 = 64 and 𝜎 = 6
𝛼 = 0.05
Do Not Reject 𝑯𝟎
𝑋ത
𝜇∗ = 50 𝑋ത𝑐 𝜇0 =52
𝑍
𝑍𝛼 = 𝑍𝑐
𝑍∗
From hypothesized mean graph: 𝑍𝛽 = 𝑍𝑐 ∗ From actual mean graph:
1. Find 𝑍𝛼 using: 𝑃 𝑍 < 𝑍𝛼 = 𝛼 3. Find 𝛽 = 𝑃 𝑋ത > 𝑋ത𝑐 |𝜇 = 𝜇 ∗ where (𝑋~𝑁(𝜇
ത ∗
, 𝜎2)
𝜎
2. Find 𝑋ത𝑐 using: 𝑋ത𝑐 = 𝜇0 + 𝑍𝛼 𝑛 = 𝑃 𝑍 > 𝑍𝛽
𝑋ത𝑐 −𝜇∗
𝛼 = 0.05 ⇒ 𝑍𝛼 = 1.6449 =𝑃 𝑍> 𝜎 where (Z~𝑁(0 , 1)
𝑛
𝜎
𝑋ത𝑐 = 𝜇0 + 𝑍𝛼
𝑛 𝛽 = 𝑃 𝑋ത ≥ 𝑋ത𝑐 |𝜇 ∗ = 50
6 𝑋ത𝑐 −𝜇 ∗ 50.7663−50
= 52 + −1.6449 = 50.7663 𝛽=𝑃 𝑍> 𝜎 =𝑃 𝑍> 6 = 𝑃 𝑍 > 1.0217 =
64 𝑛 64
1 − 𝑃 𝑍 < 1.0217 = 1 − 0.8461 = 0.1539
24
Hypothesis Testing (One Sample) - Dr Gan