Download Hypotheses testing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
Transcript
Hypothesis Testing
(known σ)
Business Statistics
Plan for Today
•
•
•
•
•
•
•
•
Null and Alternative Hypotheses
Types of errors: type I, type II
Types of correct decisions: type A, type B
Level of Significance and Power of the Test
Hypothesis testing (classical approach)
Examples
Hypothesis testing (the p-value approach)
Examples
1
Recall: Inferential Statistics
• Goal = use information obtained from a
sample to increase our knowledge about
the population from which the sample was
taken (i.e., to estimate or make inferences
about the population)
• 2 types:
– Estimating the value of a population
parameter
– Testing a hypothesis
• Using the SDSM is the key
Null and Alternative hypothesis
Hypothesis :
A statement about the value of a population
parameter. In case of two hypotheses, the statement
assumed to be true is called the null hypothesis
(notation H0) and the contradictory statement is
called the alternative hypothesis (notation Ha).
Hypothesis testing :
Based on sample evidence, a procedure for
determining whether the hypothesis stated is a
reasonable statement and should not be rejected, or
is unreasonable and should be rejected.
2
Defining and establishing null and
alternative hypotheses
• http://www.youtube.com/watch?v=cpL38ZeIecE
Null and Alternative Hypotheses
• The null hypothesis (H0) : It is a statement
about the population that either is believed to
be true or is used to put forth an argument
unless it can be shown to be incorrect beyond
a reasonable doubt.
• The alternative hypothesis (Ha): It is a claim
about the population that is contradictory to
H0 and what we conclude when we reject H0.
3
Example
• It is widely assumed that the average annual
cost of textbooks at the University of
Toronto is at least $1000 per year.
• We would like to test this hypothesis,
whether we can reject it or not.
• The null and alternative hypotheses are:
–H0: μ ≥ $1000
–Ha: μ < $1000
How to formulate the conclusion
• The conclusions are made in reference to the
null hypothesis.
• We either reject the null hypothesis, or else
we fail to reject the null hypothesis.
• If we reject the null hypothesis, it means that
our data support the alternative hypotheses.
• If we fail to reject H0, it does not mean that it
is proven to be true. It only means that our
data fits within its scope.
4
Two types of Errors: Type I Error
• http://www.youtube.com/watch?v=k80pME7mWRM
Two types of Errors: Type II error
5
Level of significance for a test: (notation: α) it equals
the probability of a Type I error (to reject the null hypothesis
when it is true).
Errors and Correct Decisions
• Example: buying a laundry detergent.
Two choices: Tide and generic detergent
VS
6
Example: laundry detergents (continued)
H0: there is no difference in performance
Ha: Tide performs better
H0 is true
H0 is false
Type A correct decision.
Decision: no difference in
performance (and it is true).
You bought generic product and
saved money.
Type I error (false positive).
Decision: Tide performs better
(in reality, no difference)
You bought Tide and wasted $$
Type II error (false negative).
Decision: no difference (false, as
Tide performs better).
You bought generic product, got
inferior results.
Type B correct decision.
Decision: Tide is better (true)
You bought Tide and got better
results
Video on hypothesis testing with example:
http://www.youtube.com/watch?v=-FtlH4svqx4
7
Alpha and beta
𝛼 is the level of significance of the test
It equals the probability of making a type I error.
1 − 𝛼 equals the probability of making type A
correct decision
𝛽 is the probability of making a type II error.
1 − 𝛽 is called the Power of the Test. It equals
the probability of making type B correct decision.
Example: restaurant tips
A restaurant manager wants to test the claim
that on the average, the servers in his restaurant
make at least $150 per shift in tips. To test this
claim, he randomly chooses a number of random
shifts of randomly selected servers and
calculates the average.
𝐻0 : 𝜇 ≥ $150
𝐻𝑎 : 𝜇 < $150
He will use a 4% level of
significance: 𝛼 = 0.04
8
Example: restaurant tips (continued)
0.04 is the probability that indeed 𝜇 ≥ $150,
but the manager has concluded otherwise.
1 − 𝛼 = 0.96 is the probability that H0 is true
and the manager did not reject H0.
Suppose that the Power of the Test is 0.92. This
is the probability that the servers, on the
average, make less than $150 per shift, and the
manager has rejected H0.
𝛽 = 0.08 is the probability that the manager did
not reject H0, but in reality the servers make less
than $150 on the average (type II error).
Hypothesis testing (classical approach)
1. State the hypotheses H0 and Ha.
2. Compute the test statistic 𝑧∗ =
𝑥−𝜇
𝜎 𝑛
3. Find the critical value(s) in the table.
4. Draw a bell-shaped curve and indicate the
region(s) of rejection.
5. Place the test statistic onto the graph.
6. State your decision.
9
Example: two-tailed test
Z-Line is a company that makes office furniture.
It claims that the average phone call to the
company’s customer support lasts 15 minutes.
The standard deviation for the phone calls is
known: 𝜎 = 5 minutes. A sample of 43 phone
calls was taken and the sample average time of
a phone call turned out to equal 16.4 minutes.
At the level of significance of 5%, test the
company’s claim using the data from the
sample.
Example: two-tailed test (continued)
1. 𝐻0 : 𝜇 = 15 min
2. Test statistic: 𝑧∗ =
𝐻𝑎 : 𝜇 ≠ 15 min
16.4−15
5/ 43
=1.84
3. Since 𝛼 = 0.05, we have the critical values
±𝑧(𝛼 2) = ±1.96
4. Plot the curve:
5. Where is 𝑧∗ ?
6. Decision:
Fail to reject H0
10
Tails and critical values
𝐻𝑎 : 𝜇 ≠ 𝜇0
a two-tailed test
with the critical values ±𝑧(𝛼 2)
𝐻𝑎 : 𝜇 > 𝜇0
a right-tailed test
with the critical value 𝑧(𝛼)
𝐻𝑎 : 𝜇 < 𝜇0
a left-tailed test
with the critical value −𝑧(𝛼)
Example: right-tailed test
Obelix claims that on the average, he eats not
more than 5 wild boars per day. The standard
deviation is known to be 1.5 boars. A sample of
14 randomly selected days showed an average
consumption of 6.1 wild boars per day.
Test the claim of Obelix at
the 10% level of significance.
We have: 𝜇0 = 5, 𝜎 = 1.5
𝑛 = 14, 𝑥 = 6.1
11
Assumption: normal distribution
Since the sample size in this problem is not big
enough, n = 14, we will add an assumption that
the number of boars consumed approximately
follows the normal distribution.
Example: right-tailed test (continued)
1. 𝐻0 : 𝜇 ≤ 5 boars
2. Test statistic 𝑧∗ =
𝐻𝑎 : 𝜇 > 5 boars
6.1−5
1.5 14
= 2.74
3. 𝛼 = 0.1 and the critical value is 1.28
(check the table!)
4. and 5.
(see the graph)
6. Decision:
Reject H0
12
Example: left-tailed test
A food company claims that its frozen dinners
contain, on the average, at least 20 grams of
protein each. The standard deviation is known
to be 2 g. A sample of 26 frozen dinners
revealed the mean of 19.5 grams of protein.
Test the company’s claim at
a 5% level of significance.
𝜇0 = 20 g, 𝜎 = 2 g
𝑛 = 26, 𝑥 = 19.5 g
Example: left-tailed test (continued)
1. 𝐻0 : 𝜇 ≥ 20 g
2. Test statistic: 𝑧∗ =
𝐻𝑎 : 𝜇 < 20 g
19.5−20
2 26
= −1.27
3. 𝛼 = 0.05, the critical value: −𝒛 𝜶 = −𝟏. 𝟔𝟒𝟓
4. Plot the curve
5. Where is 𝑧∗ ?
(in the region of acceptance)
6. Decision:
Fail to reject H0
13
Hypothesis testing (p-value approach)
1. State the hypotheses H0 and Ha.
2. Compute the test statistic 𝑧∗ =
𝑥−𝜇
𝜎 𝑛
3. Is this a left-, right-, or a two-tailed test?
4. Find the corresponding p-value in the table.
5. Compare the p-value with the level of
significance 𝛼 .
6. State your decision.
What is the p-value?
• Right-tailed test: the area to the right of 𝑧∗
• Left-tailed test: the area to the left of 𝑧∗
http://www. mathcaptain.com
• Two-tailed
test: twice
the area
14
Comparing the p-value and 𝛼:
• If the p-value is smaller than the level of
significance 𝛼, it means that the test statistic
is in the region of rejection.
In this case, decision: reject H0.
• If the p-value is larger than the level of
significance 𝛼, it means that the test statistic
is in the region of acceptance.
In this case, decision: fail to reject H0.
Example: two-tailed test
Z-Line is a company that makes office furniture.
It claims that the average phone call to the
company’s customer support lasts 15 minutes.
The standard deviation for the phone calls is
known: 𝜎 = 5 minutes. A sample of 43 phone
calls was taken and the sample average time of
a phone call turned out to equal 16.4 minutes.
At the level of significance of 5%, test the
company’s claim using the data from the
sample.
15
Example: two-tailed test (continued)
1. 𝐻0 : 𝜇 = 15 min
2. Test statistic: 𝑧∗ =
𝐻𝑎 : 𝜇 ≠ 15 min
16.4−15
5/ 43
=1.84
3. This is a two-tailed test with positive 𝑧∗ .
4. Compute the p-value:
area: 0.5 – T(1.84) = 0.5 – 0.4671 = 0.0329
p-value = 2 * area = 0.0658 (because two-tailed!)
5. Compare: p-value = 0.0658 > 0.05 = 𝛼
6. Decision:
Fail to reject H0
Example: right-tailed test
Obelix claims that on the average, he eats not
more than 5 wild boars per day. The standard
deviation is known to be 1.5 boars. A sample of
14 randomly selected days showed an average
consumption of 6.1 wild boars per day.
Test the claim of Obelix at
the 10% level of significance.
We have: 𝜇0 = 5, 𝜎 = 1.5
𝑛 = 14, 𝑥 = 6.1
16
Example: right-tailed test (continued)
1. 𝐻0 : 𝜇 ≤ 5 boars
2. Test statistic 𝑧∗ =
𝐻𝑎 : 𝜇 > 5 boars
6.1−5
1.5 14
= 2.74
3. This is a right-tailed test.
4. Compute: p-value = 0.5 – T(2.74) =
= 0.5 – 0.4969 = 0.0031
5. Compare: p-value = 0.0031 < 0.1 = 𝛼
6. Decision:
Reject H0
Example: left-tailed test
A food company claims that its frozen dinners
contain, on the average, at least 20 grams of
protein each. The standard deviation is known
to be 2 g. A sample of 26 frozen dinners
revealed the mean of 19.5 grams of protein.
Test the company’s claim at
a 5% level of significance.
𝜇0 = 20 g, 𝜎 = 2 g
𝑛 = 26, 𝑥 = 19.5 g
17
Example: left-tailed test (continued)
1. 𝐻0 : 𝜇 ≥ 20 g
2. Test statistic: 𝑧∗ =
𝐻𝑎 : 𝜇 < 20 g
19.5−20
2 26
= −1.27
3. This is a left-tailed test.
4. Compute p-value = 0.5 – T(1.27) =
= 0.5 – 0.3980 = 0.1020
5. Compare: p-value = 0.1020 > 0.05 = 𝛼
6. Decision:
Fail to reject H0
Example: practice
According to the Institut de la statistique du
Québec, the average weekly salary for full-time
and part-time workers in 2008 was $737. A
recent sample of 2000 workers revealed that
their average weekly salary is $752. Test at a 2%
level of significance whether the average weekly
salary has increased since 2008. Assume that the
population standard deviation is $360.
(Do both, the classical, and the p-value approaches.)
18
Example: practice
A sample of 25 workers in Trenton, NJ found
that their average commuting time is 25
minutes. Test at a 5% level of significance
whether the mean commuting time for all
Trenton workers is different from 35 minutes.
Assume that the population standard deviation
is 14 minutes.
Example: practice
How much time do school children spend on the
internet? A sample of 50 students from grade 6
showed that on the average, they spent 17.4
hours per week on the internet. Test at a 1%
level of significance whether the mean time for
all students from grade 6 is less than 20 hours.
The standard deviation can be taken as 10
hours.
19