Professional Documents
Culture Documents
ETF1100 Business Statistics Week 5: Hypothesis Testing
ETF1100 Business Statistics Week 5: Hypothesis Testing
Week 5
Hypothesis Testing Coding on Laptop by Matthew Henry
Reminders:
• Mid-semester Test – 1st of September (8am - 11.55 pm)
✓ 15 MCQs to be completed in one hour
Sample
Sampling
STATISTICS Distribution
DESCRIPTIVE INFERENTIAL
ESTIMATION
HYPOTHESIS TESTS
Point & Interval
Consider 𝑯𝟎 : 𝝁 = 𝝁𝟎
• 𝝁 is the unknown population mean,
• 𝝁𝟎 is the hypothesised value (a value set at the null hypothesis)
ഥ−𝝁𝟎
𝒙
If the null is true, then ∼ 𝑵(𝟎, 𝟏)
𝒔/ 𝒏
Mechanics of Hypothesis Testing
• If the null is true, then
ഥ − 𝝁𝟎
𝒙
∼ 𝑵(𝟎, 𝟏)
𝒔/ 𝒏
𝑥ҧ − 𝜇0
𝑇𝑒𝑠𝑡 𝑆𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 =
𝑠/ 𝑛
2. Judge whether the 𝑇𝑒𝑠𝑡 𝑆𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 is likely to be from the standard
normal distribution 𝑁(0,1)
3. How do we judge whether the 𝑇𝑒𝑠𝑡 𝑆𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 is likely to be from the
standard normal distribution 𝑁(0,1)?
Mechanics of Hypothesis Testing
How do we judge whether the 𝑇𝑠𝑡𝑎𝑡 is likely to be from the standard normal
distribution 𝑁(0,1)?
Two-sided tests:
𝐻0 : 𝜇 = 𝜇0
𝐻1 : 𝜇 ≠ 𝜇0
Sign matters.
If the test statistic value falls in the
positive tail – there is evidence for
the alternative
Do not reject 𝑯𝟎 Evidence in favour of 𝑯𝟏
(rejection region – reject
the null hypothesis)
Mechanics of Hypothesis Testing
• How do we judge whether the 𝑇𝑒𝑠𝑡 𝑆𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 is likely to be from the standard
normal distribution 𝑁(0,1)?
Sign matters.
If the test statistic is in the negative
tail – there is evidence for the
alternative
Evidence in favour of 𝑯𝟏
(rejection region – reject Do not reject 𝑯𝟎
the null hypothesis)
Mechanics of Hypothesis Testing: p-value
Judging whether or not the test statistic is outstandingly “far from zero”, in the
direction of the alternative.
• If the p-value is small, then the test statistic is far from zero.
(In the direction of the alternative hypothesis.)
• A smaller p-value means that there is stronger evidence in favor of the
alternative hypothesis.
Interpreting The p-value
P-value should be interpreted as the level of “evidence” in favour of the null
hypothesis, when compared against the ALTERNATIVE hypothesis.
This will prescribe the chance of making potential error of rejecting the 𝐻0 when
it is true in our conclusion.
Low tolerance means there is a lower chance that the correct 𝐻0 will be
rejected.
Significance level for Two- and One Sided Test
The tolerance level is determined such that the significance level of is spread
over both tails in a two-sided test, whereas it is in one tail in the one-sided
case.
→ we still can tolerate the potential error and conclude that the p-value is small so, we reject
the 𝐻0 .
If p-value >
→ we no longer can tolerate the potential error as it is bigger than the tolerance level
allowed, . We conclude that the p-value is large so, we fail to reject the 𝐻0 .
1 2 3 4
Formulate Decide Calculate Apply
𝐻0 & 𝐻1 on the p-value decision rule:
reject 𝐻0
if p-value <
OR retain it if
p-value >
Hypothesis Test for the Mean – Real Estate Data
Consider the Real Estate data set:
• We wish to establish whether the average house prices in this suburb is
greater than the average price across the metropolitan Melbourne area of
$993k
• Statistical hypothesis:
𝑁𝑢𝑙𝑙 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟎 : μ = $𝟗𝟗𝟑𝒌
𝐴𝑙𝑡𝑒𝑟𝑛𝑎𝑡𝑖𝑣𝑒 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟏 : μ > $𝟗𝟗𝟑𝒌
Hypothesis Test for the Mean – Real Estate Data
• Statistical hypothesis:
𝑁𝑢𝑙𝑙 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟎 : μ = $𝟗𝟗𝟑𝒌
𝐴𝑙𝑡𝑒𝑟𝑛𝑎𝑡𝑖𝑣𝑒 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟏 : μ > $𝟗𝟗𝟑𝒌
mu_0 993
From descriptive statistics xbar 1215.462006
SE(xbar) 23.09593056
ഥ−𝝁𝟎
𝒙 ഥ−𝝁𝟎
𝒙
𝒕 − 𝒔𝒕𝒂𝒕 = = ഥ
t-stat 9.632086722
𝒔/ 𝒏 𝑺𝑬 𝒙
p-value (upper-tail) 0.0000
=1-NORM.S.DIST(9.632087,TRUE)
Remembering that for upper tail test: p-value = Pr(𝑍 > 𝑡𝑠𝑡𝑎𝑡 )
Hypothesis Test for the Mean – Real Estate Data
• Statistical hypothesis:
𝑁𝑢𝑙𝑙 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟎 : μ = $𝟗𝟗𝟑𝒌
𝐴𝑙𝑡𝑒𝑟𝑛𝑎𝑡𝑖𝑣𝑒 𝐻𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠 𝑯𝟏 : μ > $𝟗𝟗𝟑𝒌
Conclusion:
Let us use the significance level of 𝛼 = 5%. mu_0 993
xbar 1215.462006
Since p-value is < 𝛼, we reject the null SE(xbar) 23.09593056
hypothesis in favour of the alternative. t-stat 9.632086722
p-value (upper-tail) 0.0000
There is statistical evidence to support the
hypothesis that the mean price of this suburb is
greater than $993k.
Hypothesis Test for the Mean – Real Estate Data
Still looking at the average price of houses in this Melbourne suburb. Conduct
a hypothesis test to verify that the average price is not equal to the
Melbourne metropolitan median price of $993k.
𝑯𝟎 is TRUE 𝑯𝟎 is FALSE
Do not reject 𝑯𝟎 CORRECT TYPE II ERROR
DECISION! (β)
Reject 𝑯𝟎 TYPE I ERROR CORRECT
(α) DECISION!
Errors in Hypothesis Testing
𝑝 1−𝑝
• Here, 𝜋 =unknown population proportion and 𝑆𝐸 𝑝 =
𝑛
Test statistic
• If the sample size 𝑛 is large,
𝑝 ∼ 𝑁 𝜋, 𝑆𝐸 𝑝
𝑝 1−𝑝
• Here, 𝜋 =unknown population proportion and 𝑆𝐸 𝑝 =
𝑛
𝑝 − 𝜋0
𝑇𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 =
SE(𝑝)
Hypothesis testing
At 𝛼 = 5%, reject 𝐻0 in favour of 𝐻1 .
pi_0 0.5 There is statistical evidence to suggest that
t-stat 4.637 more than half of potential market have
p-value (upper tail) 0.000 tried the frozen food product.
Note: Result is consistent with confidence interval. However, hypothesis testing gives
you more concrete statistical evidence, rather than range.
Hypothesis Testing – SPECIAL CASE
• In small sample size and normal population,
ഥ−𝝁𝟎
𝒙
T𝑒𝑠𝑡 𝑠𝑡𝑎𝑡𝑖𝑠𝑡𝑖𝑐 = ∼ 𝑺𝒕𝒖𝒅𝒆𝒏𝒕 − 𝒕(𝒅𝒇 = 𝒏 − 𝟏)
𝒔/ 𝒏
ANSWER: C
Conduct a hypothesis test to verify that the average house price is not equal to the Melbourne
metropolitan median price of $993k. What is the p-value for this test?
A) 2*P(Z>9.632086) = 0.0000
B) P(Z>9.632086) = 0.0000
C) P(Z<9.632086) = 0.0000
ANSWER: A
Hypothesis Testing Poll Questions
For the testing of average property price, if we reduce the significance level from 5% to 1%,
what would happen to the potential errors that we can make from our conclusions?
ANSWER: C
Hypothesis Testing
❖ Hypothesis testing summary
▪ Hypotheses (null and alternative statements)
▪ Significance level (α): Tolerance level of making the potential error of rejecting
the correct 𝐻0 .
▪ p-value: a measure of evidence of the 𝐻0
▪ Small p-value means little evidence in support of 𝐻0 , reject 𝐻0 in favour of 𝐻1
❖ Error in hypothesis testing
▪ Type I error
▪ Type II error
▪ Increasing P(Type I error) will reduce P(Type II error) and vice versa.