LECTURE 9
One-sample Hypothesis Tests
Lecturer: Nguyen Thi Thu Van
Email:
[email protected]Data and many of the statistical tools are used to
find the best answer to questions like
• Has the average service time at a Noodles &
Company restaurant decreased since last year?
• Did the proportion of defective products decrease
after a new manufacturing process was
introduced?
In this lecture, we will learn one of the most
widely used statistical tools: Hypothesis Testing.
Content
Basic principles of hypothesis testing
Testing a Mean:
with Known Population Variance
with Unknown Population Variance
Testing a Proportion
Testing a Variance
Principles of Hypothesis Testing
What is a Hypothesis?
A hypothesis is a claim
(assertion) about a population parameter:
population mean
Example: The mean monthly cell phone bill in
this city is μ = $42
population proportion
Example: The proportion of adults in this city
with cell phones is π = 0.68
Null Hypothesis, H0 vs. Alternative Hypothesis, H1
Types of Hypothesis Tests
Test for a Population Left-tailed Test Two-tailed Test Right-tailed Test
Mean
Test for a Population
Proportion
Test for a Population
Variance
Hypothesis Testing Process
Claim: the population mean
age is 50 ( Null Hypothesis:
H0: μ = 50 )
Population
Now select a
random sample
Is X= 20 likely if μ = 50?
If not likely,
REJECT
Null Hypothesis Sample
When Rejecting H0
Sampling Distribution of X
X
20 μ = 50
If it is unlikely that
If H0 is true ... then we
reject the null
we would get a
... if in fact this were hypothesis that
sample mean of
the population mean… μ = 50.
this value ...
As a result, if the sample mean is
close to the stated population mean, H0 is
not rejected.
far from the stated population mean, H0 is
rejected.
But how far is “far enough” to reject H0?
critical values creates a “line in the sand”
for decision making. What are these like?
Sampling Distribution of the test statistic
Region of Region of
Rejection Rejection
Region of
Non-Rejection
Critical Values
“Too Far Away” From Mean of Sampling Distribution
It is worth to mention right away that since our
ability to collect evidence can be limited by our
tools and by time and financial resources, it is
possible to make an incorrect decision regarding
the null hypothesis.
Much of statistical theory revolves around the
minimization of errors. So what kinds of errors are
there in hypothesis testing?
Errors in Hypothesis Test Decision Making
Type I Error
Reject a true null hypothesis
a serious type of error
Probability of Type I Error is
= level of significance of the
test Type II Error
= set by the researcher in Fail to reject a false null
advance hypothesis
Probability of Type II Error is β
How to Increase Quality of Hypothesis Testing?
Quality can be improved by
• selecting a low threshold/critical value
• modifying the alpha level 𝛼
Conceptually, we define
1 − 𝛼 by the confidence level of a hypothesis test
1 − 𝛽 by the power of a statistical test which is
the probability of rejecting 𝐻0 when it is false.
Level of Significance and Rejection Region
Level of significance = Represents
critical value
H0: μ = 3 /2 /2
H1: μ ≠ 3 Rejection
Two-tailed test 0 region is
shaded
H0: μ ≤ 3
H1: μ > 3
Right-tailed test 0
H0: μ ≥ 3
H1: μ < 3
Left-tailed test 0
Procedure for Testing a Hypothesis
Step 3. Find
State the null Calculate a the test
hypothesis Collect data
test statistic statistic
State the Construct
Select a level
alternative acceptance/rejec
of significance tion regions
hypothesis
Step 1. State the Step 2. Specify the Step 4. Make conclusion
Hypotheses level of inconsistency
Test for a Mean
Hypothesis Tests for the Mean
Hypothesis
Tests for
Known Unknown
(Z test) (t test)
Standard normal distribution Student’s t-distribution
Z - Test of Hypothesis for the Mean (σ Known)
Hypothesis
Tests for
σKnown
Known σUnknown
Unknown
(Z test) (t test)
The test statistic is:
X μ
Z =
σ
n
Critical Value Approach to Testing
X μ 2.84 3 .16
Z = = = = 2.0
σ 0.8 .08
n 100
Is the test statistic in the rejection region?
/2 = 0.05/2 /2 = 0.05/2
Reject H0 Do not reject H0 Reject H0
-Z= -1.96 0 +Z= +1.96
Z = -2.0 < -1.96, so the test statistic
is in the rejection region
An other Approach to Testing : p-Value
p-value: Probability of obtaining a test statistic more
extreme ( ≤ or ) than the observed sample value
given H0 is true.
Also called observed level of significance.
Smallest value of for which H0 can be rejected.
Compare the p-value with
If p-value < , reject H0
If p-value , do not reject H0
p-Value Example
How likely is it to see a sample mean of 2.84 (or something
further from the mean, in either direction) if the true mean is
= 3.0 (with σ = 0.8)?
P(Z 2.0) = 0.0228
P(Z 2.0) = 0.0228
/2 = 0.025 /2 = 0.025
0.0228 0.0228
p-value
= 0.0228 + 0.0228 = 0.0456
-1.96 0 1.96 Z
-2.0
Conclusion: Reject the null hypothesis. 2.0
Strength of p -Values
No evidence against the null hypothesis
Weak evidence against the null hypothesis
Moderate evidence against the null hypothesis
Strong evidence against the null hypothesis
p-value is not the probability of the null hypothesis being
true! If we get wrong on it, p-value approach by
themselves can cause misleading results.
Critical Value Approach to Testing
One-Tail Tests
In many cases, the alternative hypothesis
focuses on a particular direction.
This is a lower-tail test since the
H0: μ ≥ 3
alternative hypothesis is focused on
H1: μ < 3
the lower tail below the mean of 3
H0: μ ≤ 3 This is an upper-tail test since the
H1: μ > 3 alternative hypothesis is focused on
the upper tail above the mean of 3
Left-Tailed Tests
H0: μ ≥ 3
There is only one H1: μ < 3
critical value, since
the rejection area is
in only one tail
Reject H0 Do not reject H0
-Z Z
0
μ X
Critical value
Right-Tailed Tests
H0: μ ≤ 3
There is only one
critical value, since H1: μ > 3
the rejection area is
in only one tail
Do not reject H0 Reject H0
Z Zα
0
_
X μ
Critical value
Example: Upper-Tail Z Test for Mean ( Known)
A phone industry manager thinks that customer
monthly cell phone bills have increased, and
now average over $52 per month.
The company wishes to test this claim.
Assume = 10 is known.
A phone industry manager thinks that customer
monthly cell phone bills have increased, and now
average over $52 per month. The company wishes
to test this claim. Assume = 10.
Testing Hypotheses
H0: μ ≤ 52 = the average is not over $52 per month
H1: μ > 52 = the average is greater than $52 a month
First, suppose that = 0.10 is chosen for this test and find the
rejection region.
Reject H0
= 0.10
Do not reject H0 Reject H0
0 1.28
Reject H0 if Z > 1.28
X μ 53.1 52
Z = = = 0.88
σ 10
n 64
Example: Decision Making using Decision Rule
Reject H0
= 0.10
Do not reject H0 Reject H0
1.28
0
Z = 0.88
Conclusion: Do not reject H0 since Z = 0.88 ≤ 1.28. This means there
is not sufficient evidence that the mean bill is over $52
Example: Decision Making using p -Value
p-value = 0.1894
Reject H0 P( X 53.1)
= 0.10
53.1 52.0
= P Z
0 10/ 64
= P(Z 0.88) = 1 0.8106
Do not reject H0 Reject H0
1.28
Z = 0.88
= 0.1894
t-Test of Hypothesis for the Mean (σ Unknown)
Hypothesis
Tests for
σKnown
Known σUnknown
Unknown
(Z test) (t test)
The test statistic is:
X μ
t n-1 =
S
n
Example: Two-Tail Test ( Unknown)
H0: μ = 168
H1: μ 168
Example Solution: Two-Tail Test
H0: μ = 168
/2=.025 /2=.025
H1: μ 168
= 0.05 Reject H0 Do not reject H0 Reject H0
t n-1,α/2
-t n-1,α/2 0
n = 25 -2.0639 1.46
2.0639
is unknown, so X μ 172.50 168
t n 1 = = = 1.46
use a t statistic S 15.40
Critical Value: n 25
t24 = ± 2.0639 Do not reject H0: not sufficient evidence that
true mean cost is different than $168
Connection to Confidence Intervals
For X = 172.5, S = 15.40 and n = 25, the 95%
confidence interval is:
172.5 - (2.0639) 15.4/ 25 to 172.5 + (2.0639) 15.4/ 25
166.14 ≤ μ ≤ 178.86
Since this interval contains the Hypothesized mean (168),
we do not reject the null hypothesis at = 0.05
Test for a Proportion
Hypothesis Tests for Proportions
Involves categorical variables
Two possible outcomes
Possesses characteristic of interest
Does not possess characteristic of interest
Fraction or proportion of the population in the
category of interest is denoted by π
Hypothesis Tests for Proportions
Sample proportion in the category of interest is
denoted by p
X number in category of interest in sample
p= =
n sample size
When both X and n – X are at least 5, p can
be approximated by a normal distribution with
mean and standard deviation
(1 )
μp = σp =
n
Hypothesis Tests for Proportions
The sampling An equivalent form,
distribution of p is but in terms of the
approximately number in the
normal, so the test category of interest, X:
statistic is a ZSTAT:
pπ X n
ZSTAT = ZSTAT =
π (1 π ) n (1 )
n
Example: Z Test for Proportion
A marketing company claims Check:
X = 25
that it receives responses
n-X = 475
from 8% of those surveyed.
To test this claim, a random
sample of 500 were
surveyed with 25
responses. Test at the
= 0.05 significance level.
Z Test for Proportion: Solution
Test Statistic:
H0: π = 0.08
H1: π 0.08 p π .05 .08
ZSTAT = = = 2.47
π (1 π ) .08(1 .08)
= 0.05
n 500
n = 500, p = 0.05
Critical Values: ± 1.96 Decision:
Reject Reject Reject H0 at = 0.05
Conclusion:
.025 .025
There is sufficient
-1.96 0 1.96 z evidence to reject the
-2.47 company’s claim of 8%
response rate.
p-Value Solution
Calculate the p-value and compare to
(For a two-tail test the p-value is always two-tail)
Do not reject H0
Reject H0 Reject H0 p-value = 0.0136:
/2 = .025 /2 = .025
P(Z 2.47) P(Z 2.47)
0.0068 0.0068
= 2(0.0068) = 0.0136
-1.96 0 1.96
Z = -2.47 Z = 2.47
Reject H0 since p-value = 0.0136 < = 0.05
Test for a Variance
-- The End of Topic --
Thank You!