HYPOTHESIS TESTING ON
POPULATION MEAN
CHAPTER 9
Learning Goals
Hypothesis tests on µ (one-tailed and two-tailed): σ known case
Test Statistics: 𝑧
Standard Error of 𝑥̅
Critical Value, 𝑧$ versus 𝑧$/&
Critical value approach
P-value approach
Example 1
Using a random sample of n = 36, the sample mean is 𝑥̅ = 2.92. Suppose
that the population standard deviation is σ=0.18.
Is the above statistical evidence sufficient to make the following claim:
µ<3
at the 5% level of significance?
USE THE CRITICAL VALUE APPROACH
Step 1: specify the opposing hypotheses
Remember from the previous set of slides, Alternate Hypothesis is the
hypothesis you will be testing and will be given to you in the question.
In this example, you are given to test µ < 3. Therefore, this is the
alternate hypothesis.
Thus, the opposing hypotheses are:
𝐻,: µ ≥ 3
𝐻/ : µ < 3
and α = 0.05 (given).
Step 2: Specify the test statistics
0 ,.34
Note that, S.E of 𝑥̅ = = = 0.03.
1 56
̅ <=
:; &.A&;5
Test statistics value: 𝑧789 = = = -2.67
>.? 7@ :̅ ,.,5
Interpretation: the sample mean=2.92 is 2.67 standard deviations
less than 3.
Now, the question is: does being this far less than 3 enough to argue
that perhaps µ is likely be less than 3?
a
𝒛𝜶 is the z-value such that P(Z> 𝒛𝜶)= α.
za
Step 3: Compute the Critical value : CV
Common sense tells us that 2.92 is so far to the left of the hypothesized
3 and hence we may be tempted to reject the null hypothesis.
The problem with this approach is that we are not controlling for the
possibility that “we may reject 𝐻, ” while it is true.
To control for Type I error, we now specify the critical value as follows.
CV = -𝒛𝜶 a
where 𝒛𝜶 is the z-value such that P(Z> 𝒛𝜶)= α.
In R, we can use 𝒛𝜶 = qnorm(1-α). You can find that -za
we also have that 𝒛𝜶 = -qnorm(α). For simplicity, we can always use
𝒛𝜶 = qnorm(1-α) in R.
Computing CV
CV = -𝑧$ = −𝑧,.,E
where 𝑧,.,E = qnorm(1-0.05)= 1.64
Therefore, CV = -1.64
Step 4: specify the decision rule and conclude
Decision Rule: Reject 𝐻, if z < CV
Conclusion: Because 𝑧789 = -2.67 < -1.64, we
reject 𝐻, in favor of 𝐻/
Example 2
Using a random sample of n = 50, the sample mean is 𝑥̅ = 297.6. Suppose
that the population standard deviation is σ=12.
Is the above statistical evidence sufficient to make the following claim:
µ > 295
at the 1% level of significance?
USE THE CRITICAL VALUE APPROACH
Step 1: specify the opposing hypotheses
The opposing hypotheses: 𝐻,: µ ≤ 295
𝐻/ : µ > 295
and α = 0.01.
Note that the hypothesized value = 295 is contained in the null
hypothesis.
>> see that the level of significance (α) in Example 2 is less than
that used in Example 1. This means that in Example 2, the likelihood of
Type I error is less.
Step 2: Specify the test statistics
0 3&
Note that, S.E of 𝑥̅ = = = 1.70.
1 E,
̅ <=
:; &AK.6;&AE
Test statistics: 𝑧789 = = = 1.53
>.? 7@ :̅ 3.K,
Interpretation: the sample mean=297.6 is 1.53 standard deviations
more than 295.
Now, the question is: does being this far more than 295 enough to argue
that perhaps µ is likely be more than 295?
Step 3: Compute the Critical value : CV
The critical value is:
CV = 𝒛𝜶 (note that I have now removed the minus prefix)
where 𝒛𝜶 = qnorm(1-α).
za
Computing CV
CV = 𝑧$ = 𝑧,.,3
where 𝑧,.,3 = qnorm(1-0.01)= 2.33
Therefore, CV = 2.33
Step 4: specify the decision rule and conclude
Decision Rule: Reject 𝐻, if z > CV
Conclusion: Because 𝑧789 = 1.53 not > 2.33,
we do not reject 𝑯𝟎
Therefore, we do not have sufficient sample evidence to reject the
null hypothesis.
Something to think about
In which Example, Example 1 or Example 2,
there is a danger of making Type II error?
Example 3
Using a random sample of n = 50, the sample mean is 𝑥̅ = 13.5. Suppose
that the population standard deviation is σ=2.5.
Is the above statistical evidence sufficient to make the following claim:
µ ≠ 15
at the 5% level of significance?
USE THE CRITICAL VALUE APPROACH
Step 1: specify the opposing hypotheses
The opposing hypotheses: 𝐻,: µ = 15
𝐻/ : µ ≠ 15
and α = 0.05.
Note that the hypothesized value = 15 is contained in the null
hypothesis.
>> See that the alternative hypothesis is µ ≠ 15 which
allows for two possibilities: µ < 15 or µ > 15. For this reason,
Example 3 is a two-tailed test.
Step 2: Specify the test statistics
0 &.E
Note that, S.E of 𝑥̅ = = = 0.35.
1 E,
̅ <=
:; 35.E;3E
Test statistics: 𝑧789 = = = -4.24
>.? 7@ :̅ ,.5E
Interpretation: the sample mean=13.5 is 4.24 standard deviations
less than 15.
Now, the question is: does being this far less than 15 enough to argue
that perhaps µ is likely be different from 15?
Step 3: Compute the Critical value : CV
The critical values are:
a/2 a/2
CV1 = −𝒛𝜶/𝟐 and CV2 = 𝒛𝜶/𝟐
-za/2 za/2
where 𝒛𝜶/𝟐 = qnorm(1-α/2).
Note that in a two-tailed test: we take α/2 instead of α when
computing the critical value.
Computing CV
CV1 = -𝑧$/& = −𝑧,.,E/& =−𝑧,.,&E
CV2 = 𝑧$/& = 𝑧,.,E/& = 𝑧,.,&E
where 𝑧,.,&E = qnorm(1-0.025)= 1.96
Therefore, CV1 = −𝟏. 𝟗𝟔 and CV2 = 𝟏. 𝟗𝟔.
Step 4: specify the decision rule and conclude
Decision Rule: Reject 𝐻, if z < CV1 OR z > CV2
Conclusion: Because 𝑧789 = -4.24 < -1.96,
we reject 𝑯𝟎 in favor of 𝑯𝒂
Summary: critical value approach
In critical value approach, using
̅ <=
:;
𝑧789 =
>.? 7@ :̅
we measure how far the sample evidence, 𝑥̅ is from the hypothesized
value, 𝜇, .
Then,
>> Large positive or large negative
observed z values (relative to the CV) will lead
to rejection of the null hypothesis.
The p-value approach
Now, instead of comparing the observed test statistic value, 𝒛𝒐𝒃𝒔 , to
the CV and conclude (this is the critical value approach),
we ask the question:
How likely is 𝒛𝒐𝒃𝒔 if the null
hypothesis was actually true?
In other words:
What is the probability of obtaining our sample evidence
given the null hypothesis.
Suppose that
We are testing the following:
𝐻, : µ ≤ 𝜇,
𝐻/ : µ > 𝜇,
and the sample mean from our sample is
𝑥-observed.
̅
p-value visualization
x
𝝁𝟎 Z-observed
𝒙
From the sampling distribution of 𝑥̅
When the observed 𝑥̅ is farther and farther (to the right) from the
hypothesized value, 𝜇, , the area in the green gets smaller and smaller.
We say, the p-value (the probability in the green) gets smaller and smaller.
The likelihood of observing such a large 𝑥̅ becomes less and less plausible
under the null hypothesis.
Therefore, when p-value is very small, we are more likely to reject the null
hypothesis.
Example 2 - revisited
Using a random sample of n = 50, the sample mean is 𝑥̅ = 297.6. Suppose
that the population standard deviation is σ=12.
Is the above statistical evidence sufficient to make the following claim:
µ > 295
at the 1% level of significance?
USE THE P-VALUE APPROACH
Steps 1 and 2 are the same as CV
approach
𝐻,: µ ≤ 295
𝐻/ : µ > 295
α = 0.01.
𝑧789 = 1.53. (observed test statistics)
Step 3: compute the p-value
p-value = 𝑃 𝑧 > 𝑧789 = P(z > 1.53)
Now, recall Chapter 6 (computing probabilities from standard normal
random variable)
P(z > 1.53) = pnorm(1.53, [Link] = F)
= 0.063
Therefore, p-value = 0.063.
Step 4: Specify the decision rule and conclude
Decision Rule: Reject 𝐻, if p-value < α
Conclusion: Because p-value = 0.063 not < 0.01, we
do not reject 𝑯𝟎
Example 1 - revisited
Using a random sample of n = 36, the sample mean is 𝑥̅ = 2.92. Suppose
that the population standard deviation is σ=0.18.
Is the above statistical evidence sufficient to make the following claim:
µ<3
at the 5% level of significance?
USE THE P-VALUE APPROACH
Step 1 and 2 are the same as in CV approach
𝐻,: µ ≥ 3
𝐻/ : µ < 3
α = 0.05.
𝑧789 = -2.67
Step 3: Compute p-value
p-value = 𝑃(𝑧 < 𝑧789 ) = P(z < -2.67)
why this formula? See the visualization in the next page.
P(z < -2.67) = pnorm(-2.67) = 0.004.
Therefore, p-value = 0.004.
P-value visualization
x
Z-observed
𝒙 𝝁𝟎
Step 4: Specify decision rule and conclude
Decision Rule: Reject 𝐻, if p-value < α
Conclusion: Because p-value = 0.004 < 0.05, we reject
𝐻, in favor of 𝐻/
Example 3 - revisited
Using a random sample of n = 50, the sample mean is 𝑥̅ = 13.5. Suppose
that the population standard deviation is σ=2.5.
Is the above statistical evidence sufficient to make the following claim:
µ ≠ 15
at the 5% level of significance?
USE THE P-VALUE APPROACH
Steps 1 and 2 are the same as in CV approach
𝐻,: µ = 15
𝐻/ : µ ≠ 15
α = 0.05.
𝑧789 = -4.24
Step 3: compute p-value
p-value = 2 ∗ 𝑃(𝑧 < 𝑧789 ) = 2 * P(z < -4.24)
Why this formula? See the visualization in the next page.
#############################
How will this formula change if 𝑧789 was positive.
p-value = 2 ∗ 𝑃(𝑧 > 𝑧789 )
##############################
Note that P(z < -4.24) = pnorm(-4.24) ≈ 0. Therefore, p-value ≈ 0.
To simplify our formula, we can always use the following:
p-value = 2 ∗ 𝑃(𝑧 > |𝑧789 |) = 2 *pnorm(abs(𝑧789 ), lower. tail = F)
regardless of 𝑧789 , where |𝑧789 | is the absolute value of 𝑧789 .
p-value visualization
x
𝝁𝟎 Z-observed
𝒙
Step 4: specify decision rule and conclude
Decision Rule: Reject 𝐻, if p-value < α
Conclusion: Because p-value = 0 < 0.05, we reject
𝐻, in favor of 𝐻/ .
Summary
p-value=P(Z<Zobs) p-value=P(Z>Zobs) p-value=2*P(Z>|Zobs|)
a a a/2 a/2
-za za -za/2 za/2