Math 4030 – 9a
Introduction to Introduction to Hypothesis TestingHypothesis Testing
Research Problem Hypothesis
Experiments Data Collection
Data Analysis Hypothesis
Testing
Report the results (Reject the
Hypothesis?)
The first example:
A paint manufacturer claims that the average drying time of his new “fast-drying” paint is 20 minutes.
The consumer protection agency wants to know if this is true.
36 1-gallon cans of such paint are collected and tested. The sample results the sample mean of 20.85 minutes.
What should we do with manufacturer’s claim?
We assume that the drying time has normal distribution with SD = 2.4 min.
How does Hypothesis Testing work?
• Assume the claim is true• Sample mean is random• Difference• Distribution of sample means• Probability of having such difference (error)
Sample mean distribution (from a sample of size 36)
n
NX2
,~ 1,0~ N
n
XZ
or
= 20
0
X
Z
Confidence Interval Approach:Confidence Interval Approach:
20.85 – E < < 20.85 +E
With sample of size 36, the maximum error for 95% confidence interval is: 2.4
1.96 0.78436
E
With probability 0.95, the true population mean is in the interval
20.066 < < 21.634or
But we see the hypothesized population mean is outside this interval.
Critical Region Approach:Critical Region Approach:
= 20
If the hypothesis is true ( = 20), sample mean (or size 36) should have a normal distribution with mean 20 and standard deviation 2.4/6 = 0.4.
1 - = 0.95
Sample mean
Critical Region
20 – E = 19.216 20 + E = 20.784
Critical Values
P-value Approach:
= 20
Sample mean (or size 36) distribution under the assumption = 20
Sample mean = 20.85
P-Value = Probability of having such a “bad sample” or even worse.
Calculate P-value:
= 20Sample mean = 20.85
P-Value = Probability of having such a “bad sample” or even worse.
20 20.85 2020 20.85 20
0.4 0.4
2.13 2 0.0166 0.0332
XP X P
P Z
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Find the 95% confidence interval for population mean using sample mean:
Conclusion: the population mean assumed in the null hypothesis does not fall in this confidence interval. Null hypothesis should be rejected.
Confidence Interval Method
2.41.96 0.784
36E
20.85 – E < < 20.85 +E
20.066 < < 21.634
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Critical region for Z-score:
Statistic from the sample:
Conclusion: Sample statistic falls in the critical region, the null hypothesis should be rejected.
Critical Region Method
,96.196.1,
20 20.85 202.13
2.4
36
XZ
n
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Statistics:
P-Value:
Conclusion: the P-value is less than 0.05, the null hypothesis should be rejected.
P-Value Method
36, 20.85, 2.4n X
20 20.85 2020 20.85 20
0.4 0.4
2.13 2 0.0166 0.0332
XP X P
P Z
When the null hypothesis is rejected, what do we say?
“We have enough evidence to reject the claim that the average drying time of the paint is 20 min. (The proposed alternative is that the average drying time is not 20 min.)”
• Three methods will lead to the same decision (reject or not reject the null hypothesis.)
• Advantages of using each…
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Find the 95% confidence interval for population mean using sample mean:
Conclusion: the population mean assumed in the null hypothesis does not fall in this confidence interval. Null hypothesis should be rejected.
Confidence Interval Method
2.41.96 0.784
36E
20.85 – E < < 20.85 +E
20.066 < < 21.634
When the null hypothesis gets rejected, a confidence
interval for the true population mean is
presented.
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Critical region for Z-score:
Statistic from the sample:
Conclusion: Sample statistic falls in the critical region, the null hypothesis should be rejected.
Critical Region Method
,96.196.1,
20 20.85 202.13
2.4
36
XZ
n
Critical values for the sample mean can give a
guideline for future sampling.
Null Hypothesis: = 20 (min)
Alternative hypothesis: 20 (min)
Level of significance: = 0.05
Statistics:
P-Value:
Conclusion: the P-value is less than 0.05, the null hypothesis should be rejected.
P-Value Method
36, 20.85, 2.4n X
20 20.85 2020 20.85 20
0.4 0.4
2.13 2 0.0166 0.0332
XP X P
P Z
The null hypothesis is rejected at = 0.05 level, but not at 0.01
level.
What affect our decision of whether or not to reject the null hypothesis? And how?
• Difference between what is assumed in the null hypothesis and what we find from the sample data;
• The variance (variability/stability) of the population (in our study);
• Level of significance;• Sample size;• Statistical testing method we choose.
Basic Elements in Hypothesis Testing (Sec. 7.4):
• Null hypothesis and Alternative hypothesis;• Level of significance ;• Tail(s) of the test;• Sample statistic(s) and distribution(s);• Conclusion about the null hypothesis based on the
sample statistic(s)– Confidence Interval– Critical region(s)– P-value
• Conclusion for your research report• Errors in Hypothesis Testing
Null Hypothesis vs. Alternative Hypothesis (Sec. 7.5)
The Null hypothesis, denoted by H0, is set up as an assumption that the distribution of the sample statistic(s) will be based on; •To begin the test, we always assume that the null hypothesis is true;•When we see an “significant” inconsistency between the null hypothesis and the “evidence” from the data, we reject the null hypothesis.•The objective of the hypothesis testing is to see whether we can reject the null hypothesis.
Null Hypothesis vs. Alternative HypothesisThe Alternative hypothesis, denoted by H1, is set up as an alternative assumption when the null hypothesis is declared false; •To start with, we assume that the null hypothesis is true;•When the null hypothesis is rejected, we will present the alternative hypothesis;•It is the alternative hypothesis that the researcher usually wants to present, so alternative hypothesis is also called researcher’s hypothesis.
Level of Significance :
• Common choices for level of significance : 0.1, 0.05, 0.01, 0.001
• Rules that plays in the hypothesis testing;
• 1 - : confidence;• relate to probability of making
certain error;
One-Tail vs. Two-Tail test:
180:
180:
1
0
H
H
180:
180:
1
0
H
H
• When to use one-tail test?• Advantage of using one-tail test.• What to watch for?
Sample statistics and distributions:
• Null hypothesis gives assumed values for the population parameters;
• If the null hypothesis is true, then the sample statistic(s) should follow certain distribution;
• Compare the sample statistic(s) distribution and the observed values from the sample data;
• If there is too much of the discrepancy, then the null hypothesis will be rejected.
Conclusion of the Hypothesis Testing:
If the null hypothesis is not rejected, we say
Since the assumed population parameter (mean, etc.) falls in the confidence interval generated from the sample data, we do not reject the null hypothesis that …
If the null hypothesis is rejected, we say
Since the assumed population parameter (mean, etc.) does not fall in the confidence interval generated from the sample data, we reject the null hypothesis that …
If the null hypothesis is rejected, we say
Since the sample statistic(s) fall(s) in the critical region, we reject the null hypothesis that …..
If the null hypothesis is not rejected, we say
Since the sample statistic(s) does not fall(s) in the critical region, we do not reject the null hypothesis that …..
If the null hypothesis is rejected, we say
Since P-value is less than = 0.05 (for example), we reject the null hypothesis that …
If the null hypothesis is not rejected, we say
Since P-value is greater than = 0.05 (for example), we do not reject the null hypothesis that …
How do we address researcher’s initial
objective?
Research Objective:
A company wants to establish that the mean life of its batteries, when used in a wireless mouse, is over 183 days.
Null hypothesis H0:
Alternative hypothesis H1: 183
183 183
(Researcher’s Claim)
A company wants to establish that the mean life of its batteries, when used in a wireless mouse, is over 183 days.
Null hypothesis H0:
Alternative hypothesis H1: 183183 183
(Researcher’s Claim)
If H0 is rejected we say: Since …. the null hypothesis is reject, we support the claim that the mean life of its batteries, when used in a wireless mouse, ISIS over 183 days.
If H0 is not rejected we say: Since …. the null hypothesis is not reject, we do not have enough evidence to support the claim that the mean life of its batteries, when used in a wireless mouse, is over 183 days.
Research Objective:
A company claims that the mean life of its batteries, when used in a wireless mouse, is over 183 days. A consumer wants to argue that the actual battery life is no longer than 183 days.
Null hypothesis H0:
Alternative hypothesis H1: 183
183 183(Researcher’s Claim)
If H0 is rejected we say: Since …. the null hypothesis is reject, we reject the claim that the mean life of its batteries is no longer than 183 days.
A company claims that the mean life of its batteries, when used in a wireless mouse, is over 183 days. A consumer wants to argue that the actual battery life is no longer than 183 days.
Null hypothesis H0:
Alternative hypothesis H1: 183183 183
(Researcher’s Claim)
If H0 is not rejected we say: Since …. the null hypothesis is not reject, we do not have enough evidence to reject the claim that the mean life of its batteries is no longer than 183 days.
Comments:
• When the null hypothesis is rejected, we can support the alternative hypothesis --- Action!
• When the null hypothesis is not rejected, there are many reasons. Null hypothesis is false is just one of many. So we say: we don’t have enough evidence to….
• Rejecting null hypothesis is the purpose of the hypothesis testing.
• Ability of rejecting a false null hypothesis will be called the power of a test.
Errors in hypothesis testing:
H0 is true H0 is false
Reject H0
Type I error
(Probability )No error
Fail to reject H0
No errorType II error
(Probability )
Errors in hypothesis testing:• is the probability of making Type I error (of
rejecting a true null hypothesis); this is the same we set as the level of significance;
• is the probability of making Type II error (of not rejecting a false null hypothesis);
• 1 - is the probability of rejecting a false null hypothesis, called the power of the test.
• Relationship between and ;• Choose will effect the power of the test.
H0 is true H0 is false
Reject H0 Type I error
(with probability )
No error
Fail to reject H0 No error Type II error (with
probability )
The actual drying time is
20 min
Mistakenly accuse the
manufacturer and hurt the
business
Be quiet toward the business and hurt the consumers
The actual drying time is
not 20 min
Claim that the actual drying time is not 20
min
Fail to detect that the actual drying time is
not 20 min
H0 is true H0 is false
Reject H0 Type I error
(with probability )
No error
Fail to reject H0 No error Type II error (with
probability )
No cancer
False positive: patient
undergo unnecessary treatments
False negative: miss the
opportunity for needed
treatments
Cancer exists
Test positive: Claim that there
is cancer
Test negative: Claim that there
is no cancer