Today’s Objectives
1. Intro to Hypothesis Testing
2. Conduct a one-tailed upper and lower hypothesis test for the true
population mean 𝜇
– when sigma is known
– when sigma is unknown
3. Conduct two-tailed hypothesis tests for the true population mean 𝜇
2
Motivating Example
Your investment advisor proposes you a monthly investment scheme.
Upon analyzing the data over the past three years, you find out that the
sample mean return of the scheme is $205 and it is known that the
population standard deviation is $65.
Suppose you only want to invest in the scheme if its population mean
return is more than $200. Should you invest or not?
3
Making Judgment Using Hypothesis Testing
– It is not possible to ascertain the truthfulness of a certain claim or hypothesis with 100%
certainty. No such thing as perfect judgment.
– But we can make reasonable judgment, while minimizing some statistical error. This is the idea
of Hypothesis Testing.
– Our reasonable judgement comes from asking the question:
Does the sample data we have suggest something
we think about the population is actually NOT true?
Does the sample data we have on investment
returns suggest the population mean income is
actually more than $200 per month?
4
Null and Alternative Hypotheses
Start with the Alternative
Null Hypothesis, H0 Alternative Hypothesis, HA
• The opposite of HA • “Research hypothesis” or the claim
• Status quo, what is assumed you are testing
about the population • Challenges the presumed value of
the null hypothesis
5
The Logic of Hypothesis Testing
If no evidence to
contradict H0, we do
Test if H0 is likely to not reject H0.
Assume H0 is true. be true given the
data you have. If evidence exists to
contradict H0, we
reject H0.
A jury
member
Collect evidence to see if you
The defendant is
have “enough” evidence to
assumed innocent first.
reject the initial assumption.
6
The Logic of Hypothesis Testing
If no evidence to
contradict H0, we do
Test if H0 is likely to not reject H0.
Assume H0 is true. be true given the
data you have. If evidence exists to
contradict H0, we
reject H0.
A researcher wants
to test a new
finding/hypothesis.
The old theory To decide if you have “enough”
(currently accepted) is evidence to reject the old
assumed to be true. theory.
7
Null and Alternative Hypotheses
Start with the Alternative
Null Hypothesis, H0 Alternative Hypothesis, HA
• Currently accepted value for a • Challenges the presumed value of
parameter. the null hypothesis
• For example, = 15 • Never contains “=”
• Always contains “=” (=,≤, or ≥)
•Lower tail test has <
• First write the alternative, and
then write the null as the •Upper tail test has >
opposite. •Two tail test has ≠
8
Examples of H0 and HA
Suppose a baker claims that his bread height is more than 15 cm, on average.
Several of his customers do not believe him. To persuade his customers that
he is right, the baker decides to do a hypothesis test.
He bakes 9 loaves of bread. The mean height of the sample loaves is 17 cm.
The baker knows from baking hundreds of loaves of bread that the standard
deviation for the height is 0.5 cm. and the distribution of heights is normal.
H0: ≤ 15
HA: > 15
9
Distribution needed for Hypothesis Testing
▪ Perform tests of a population mean using a normal distribution or a
Student's t-distribution.
▪ If you are testing a population mean, the distribution for the test is:
– We can use the normal distribution when the population standard deviation is
known.
𝜎𝑋
𝑋ത ~𝑁(𝜇𝑋 , )
𝑥
x̅−𝜇𝑋
Z = 𝜎𝑋 ~N(0, 1)
ൗ 𝑛
ҧ 𝑋
𝑥−𝜇
Given a specific sample mean 𝑥,ҧ define z-score = 𝜎𝑋 .
ൗ 𝑛
10
Rare events and the Sample
▪ Suppose you make an assumption about a property of the population
(this assumption is the null hypothesis). Then you gather sample data
randomly. If the sample has properties that would be very unlikely to
occur if the assumption is true, then you would conclude that your
assumption about the population is probably incorrect.
▪ Use the sample data to calculate the actual probability of getting the
test result, called the p-value.
– p-value is P(the results from another randomly selected sample will be as
extreme or more extreme as the results obtained from the given sample | Null
hypothesis is true)
– A large p-value calculated from the data indicates that we should not reject the
null hypothesis.
– Draw a graph that shows the p-value. The hypothesis test is easier to perform if
you use a graph because you see the problem more clearly.
11
Example of p-value
Suppose a baker claims that his bread height is more than 15 cm, on average.
Several of his customers do not believe him. To persuade his customers that he
is right, the baker decides to do a hypothesis test. He bakes 9 loaves of bread.
The mean height of the sample loaves is 17 cm. The baker knows from baking
hundreds of loaves of bread that the standard deviation for the height is 0.5 cm.
and the distribution of heights is normal.
The p-value, then, is the probability that a sample mean is the same or greater
than 17 cm, when the population mean is, in fact, 15 cm.
𝜎
𝑋ത ~𝑁(𝜇𝑋 , √𝑛𝑋 )
ҧ 𝑋
𝑥−𝜇 17−15
z−score = 𝜎𝑋 = 0.5 =12
ൗ 𝑛 ൗ 9
ത
P−value = P(𝑋>17)
= P(Z > 12)
12
Decision and Conclusion
▪ A systematic way to make a decision of whether to
reject or not reject the null hypothesis is to compare
the p-value and a preset or preconceived α (also
called a "significance level").
1. The smaller the p-value, the more evidence to reject the
Null.
Reject H0 if p-value < α
2. The p-value does NOT tell you the chance the null
hypothesis is wrong.
Do not reject H0 if p-value > α
13
Example: Baking
Suppose a baker claims that his bread height is more than 15 cm, on average.
Several of his customers do not believe him. To persuade his customers that he
is right, the baker decides to do a hypothesis test. He bakes 9 loaves of bread.
The mean height of the sample loaves is 17 cm. The baker knows from baking
hundreds of loaves of bread that the standard deviation for the height is 0.5 cm.
and the distribution of heights is normal. 𝛼 = 0.05
14
Baking
H0: ≤ 15
Hypotheses:
HA: > 15 Hence it’s an upper-tail test
Data Picture
n = 9, x̅ = 17, 𝜎 = 0.5
SE = 0.5/ 9 = 1/6
𝛼 = 0.05
Test Statistic p-Value
ҧ 0
𝑥−𝜇
P(Z > z-score) = 1 – P(Z ≤ z-score)
z-score = 𝑆𝐸
= 1 – P(Z ≤ 12)
= 1 – [Link] (12, 0, 1, 1)
= 0.000
z-score = 12
p-value = 0.000 is smaller than 𝛼 = 0.05
Reject H0
15
Today’s Objectives
1. Intro to Hypothesis Testing
2. Conduct a one-tailed upper and lower hypothesis test for the true
population mean 𝜇
– when sigma is known
– when sigma is unknown
3. Conduct two-tailed hypothesis tests for the true population mean 𝜇
16
16
Statistics & p-Values For One-Sided Tests (with known )
Type Test Statistic, P-Value
known
Lower Tail Test
P(Z < z-score)
HA: < 0
= [Link](z-score, 0, 1, 1)
0 is given in problem
statement x̅−𝜇0
Z= 𝜎 Z has a standard normal
ൗ 𝑛
distribution
ҧ 0
𝑥−𝜇
z-score = 𝜎
Upper Tail Test ൗ 𝑛
P(Z > z-score)
HA: > 0
=[Link](z-score, 0, 1, 1)
0 is given in problem
statement
Z has a standard normal
distribution
17
Exercise: Manufacturing
A manufacturing process drills a hole in a metal plate. The mean dimension
of the hole is specified to be at most 8 mm. The population standard
deviation is known to be 0.001 mm. A random sample of 9 holes had a
sample mean of 8.0007. Test that the mean size of the holes have increased
at 𝛼 = 0.05. Assume that the dimensions of holes are Normally distributed.
18
Manufacturing
H0: ≤ 8
Hypotheses:
HA: > 8 Hence it’s an upper-tail test
Data Picture
n=9, x̅ = 8.0007, 𝜎 = 0.001
SE = 0.001/ 9 = 0.000333
𝛼 = 0.05
Test Statistic p-Value
ҧ 0
𝑥−𝜇
P(Z > z-score) = 1 – P(Z ≤ z-score)
z-score = 𝑆𝐸
= 1 – P(Z ≤ 2.1)
= 1 – [Link] (2.1, 0, 1, 1)
8.0007−8 = 0.018
z-score = 0.000333 = 2.1
p-value = 0.018 is smaller than 𝛼 = 0.05
Reject H0
19
Today’s Objectives
1. Intro to Hypothesis Testing
2. Conduct a one-tailed upper and lower hypothesis test for the true
population mean 𝜇
– when sigma is known
– when sigma is unknown
3. Conduct two-tailed hypothesis tests for the true population mean 𝜇
20
20
Student's t-distribution
▪ X1, …, Xn are a random sample (independent and identically
distributed) from a population with mean 𝝁𝑿 and a possibly unknown
standard deviation σ
The 𝒕𝒅𝒇 has a t distribution with n-1 degrees of freedom (df).
ഥ − 𝝁𝑿
𝑿 s: sample standard deviation.
𝒕𝒅𝒇 = 𝒔 Need the population to have a normal distribution or n > 30.
ൗ 𝒏
Given a specific sample
mean 𝑥,ҧ
ҧ
𝑥−𝜇
define t-score = 𝑠 𝑋.
ൗ 𝑛
𝜈 is the degree of
freedom.
21
Student's t-distribution
▪ X1, …, Xn are a random sample (independent and identically
distributed) from a population with mean 𝝁𝑿 and a possibly unknown
standard deviation σ
ഥ − 𝝁𝑿
𝑿 The 𝒕𝒅𝒇 has a t distribution with n-1 degrees of freedom (df).
𝒕𝒅𝒇 = 𝒔 s: sample standard deviation.
ൗ 𝒏 Need the population to have a normal distribution or n > 30.
Given a specific sample
mean 𝑥,ҧ
ҧ
𝑥−𝜇
define t-score = 𝑠 𝑋.
ൗ 𝑛
▪ The t-score has the same interpretation as the z-score. It
measures how far 𝐱ത is from its mean 𝝁𝑿 .
▪ The degrees of freedom, n – 1, come from the calculation of the
sample standard deviation s.
22
Statistics & p-Values For One-Sided Tests (with unknown )
Type Test Statistic, P-Value
Unknown
Lower Tail Test P(𝒕𝒅𝒇 < t-score)
HA: < 0
=[Link](t-score,n-1,1)
0 is given in problem ഥ − 𝝁𝟎
𝑿
statement 𝒕𝒅𝒇 = 𝒔 𝒕𝒅𝒇 has a t-distribution with
ൗ 𝒏 n-1 degrees of freedom
ഥ−𝝁
𝒙
t-score = 𝒔 𝟎
ൗ 𝒏
P(𝒕𝒅𝒇 > t-score)
Upper Tail Test
HA: > 0
=[Link](t-score,n-1,1)
0 is given in problem
𝒕𝒅𝒇 has a t-distribution with
statement
n-1 degrees of freedom
23
Cadillac Buyers Age: Lower Tail Test
It is presumed the average Cadillac driver is over 50 years old. But you
hypothesize as a result of recent successful marketing efforts, the
mean age of a Cadillac driver is actually younger than 50 years old. To
test your hypothesis, you sample 36 drivers and find a sample mean
age of 45 years and the sample standard deviation is 12 years. Conduct
a hypothesis test and determine: is there evidence to support your
hypothesis at the 𝜶 = 𝟎. 𝟎𝟓 level?
24
Cadillac Buyers Age: Lower Tail Test
Hypotheses: H0: ≥ 50
HA: < 50 Hence it’s a lower-tail test
Data Picture
n = 36, x̅ = 45, and s = 12
12
SE = 36 = 2
df = n-1 = 35
𝛼 = 0.05
T Test Statistic p-Value
x̅−𝜇0 p-value
t-score = 𝑆𝐸 = 𝑃 𝑡𝑑𝑓 < t−score = [Link] (t-score, df,
1) = [Link](-2.5,35,1)
45−50
t-score = 2
= −2.5 = 0.00862
p-value is less than 𝛼 = 0.05
Conclusion: Reject H0
25
Example: Cadillac Buyers Income
It is also presumed the population mean household income of a
Cadillac driver is under $75,000. But there is a belief that there is
evidence the population mean household income is actually above
$75,000. To test this hypothesis, you sample 36 drivers and find a mean
household income of $79,000, and the sample standard deviation is
$15,000. Conduct a hypothesis test and determine: is there evidence to
support your hypothesis at the 𝛼 = 𝟎. 𝟎𝟓 level?
26
Cadillac Buyers Income: Upper Tail Test
Hypotheses: H0: ≤ 75000
HA: > 75000 Hence it’s an upper-tail test
Data Picture
n=36, x̅ = 79,000, s=15,000
SE = 15000/ 36 = 2500
df = n-1 =35
𝛼 = 0.05
Test Statistic p-Value
P(𝑡𝑑𝑓 > t−score) = P(𝑡𝑑𝑓 > 1.6) = 1 –
x̅−75,000
tstat = 𝑆𝐸
P(𝑡𝑑𝑓 ≤ 1.6) = 1 - [Link] (1.6,35,1)
= 0.0593
79000−75000
tstat = 2500 = 1.6 The p-value is larger than 𝛼 = 0.05
Do Not Reject H0
27
Today’s Objectives
1. Intro to Hypotheses Testing
2. Conduct a one-tailed upper and lower hypothesis test for the true population mean 𝜇
– when sigma is unknown
– when sigma is known
3. Conduct two-tailed hypothesis tests for the true population mean 𝜇
28
Test Statistics & p-Values For Two-Tailed Tests
Type Test Statistic P-Value
Two-Tailed Test
P(Z < -|z-score|) + P(Z > |z-score|)
HA: ≠ 0 z-score =
When 𝜎 is =2*P(Z < -|z-score|)
known x̅−𝜇0 = 2*[Link](-|z-score|,0 , 1, 1)
0 is given in the 𝜎
problem statement ൗ 𝑛
Z has standard normal distribution
Two-Tailed Test P(T < -|t-score|) + P(T > |t-score|)
When is 𝜎 HA: ≠ 0 t-score = =2*P(T < -|t-score|)
is x̅−𝜇0 = 2*[Link](-|t-score|,n-1,1)
unknown 0 is given in the 𝑠
problem statement ൗ 𝑛 T has t-distribution with n-1 degrees
of freedom
*Suppose the t-score = -2.5
and df = 15, then p-value =
2*P(T < -|t-score|) is the area
of the tails shaded in red →
29
HK pop (sigma is known)
HK pop plans to introduce a new song this winter with a TicTok video. In the past, their videos
received 55,000 daily views on average (daily population mean). The number of daily views for 25 days
had a sample mean of 57,000 and a population standard deviation of 15,000. Test that the population
mean number of daily views is different from the past with a 0.05 level of significance test. Assume that
the number of daily views is Normally distributed.
Presumed population mean = 55,000
n=25, x̅ =57,000, and sigma = 15,000
0.05 Level of Significance
30
HK pop
Hypotheses: H0: = 55,000
“Two-Tailed Test”
HA: ≠ 55,000
Data Picture
n=25, x̅ = 57,000 & 𝜎 = 15,000
SE = 𝜎 / 𝑛 = 15,000/ 25 = 3,000
𝛼 = 0.05
Z Test Statistic p-Value
x̅−55000 2*P(Z<-|zstat|) = 2*P(Z < -0.667)
zstat = 𝜎
ൗ 𝑛 = 2* [Link](-0.667, 0, 1 , 1) = 0.5048
(57000−55000) Do not Reject H0 because p-value > 0.05
zstat = 3000
= 0.667
There does not exist evidence to support that the new video on TicTok is
any different from previous videos
31
Today’s Objectives
1. Intro to Hypotheses Testing
2. Conduct a one-tailed upper and lower hypothesis test for the true population mean 𝜇
– when sigma is unknown
– when sigma is known
3. Conduct two-tailed hypothesis tests for the true population mean 𝜇
32
32