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
(unknown σ)
Business Statistics
Plan for Today
• Recall:
– 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 with unknown σ
• Examples
1
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.
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.
2
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.
Errors and Correct Decisions
• Example: buying a laundry detergent.
Two choices: Tide and generic detergent
VS
3
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
4
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.
Hypothesis testing when σ is not known
When the population standard deviation, σ, is
not known, we use the sample standard
deviation, s, instead. And instead of the normal
distribution, we use the Student’s t distribution.
For the classical approach, we will use Table 2
(Critical Values of Student’s t Distribution), and
for the p-value approach we will use Table 3
(called p-values for Student’s t Distribution) with
df = n – 1
5
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.
Tails and critical values
𝐻𝑎 : 𝜇 ≠ 𝜇0
a two-tailed test
with the critical values ±𝑡(df, 𝛼 2)
𝐻𝑎 : 𝜇 > 𝜇0
a right-tailed test
with the critical value 𝑡(df, 𝛼)
𝐻𝑎 : 𝜇 < 𝜇0
a left-tailed test
with the critical value −𝑡(df, 𝛼)
6
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
7
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: right-tailed test
A company that makes Orange Soda claims that
on the average its soda cans contain no more
than 39 grams of sugar. A random sample of 12
cans tested in a lab yielded the following sugar
contents (in grams): 39.4 40.2 40.9 39.6 38.2
40.0 38.1 39.9 40.7 39.5 38.4 39.5
Can we disprove the company’s claim at a 5%
level of significance? Assume that the amount
of sugar in cans is normally distributed.
8
Example: Orange Soda (classical approach)
1. 𝐻0 : 𝜇 ≤ 39 g
𝐻𝑎 : 𝜇 > 39 g
2. Compute from sample:
𝑥 = 39.53 g, 𝑠 = 0.913 g
Test statistic: 𝑡∗ =
39.53−39
0.913/ 12
= 2.01
3. Since 𝛼 = 0.05, we have the critical value
𝑡 df, 𝛼 = 𝑡 11, 0.05 = 1.796
4. Plot the curve!
5. Where is 𝑡∗ ? (in the region of rejection)
6. Decision: reject H0
Example: Orange Soda
(the p-value approach)
1. 𝐻0 : 𝜇 ≤ 39 g
𝐻𝑎 : 𝜇 > 39 g
2. Test statistic 𝑡∗ = 2.01
3. This is a right-tailed test.
4. From Table 3 with df = 11:
p-value = 0.037 (always pick the bigger value)
5. Compare: p-value = 0.037 < 0.05 = 𝛼
6. Decision:
Reject H0
9
Example: left-tailed test
A restaurant owner has counted the number of
clients in his restaurant during 14 randomly
selected Fridays: 155 172 164 188 191 181
184 194 177 170 193 201 182 174
He wants to test the claim that the average
number of clients in the restaurant on Fridays is
actually smaller than 186, using a 2.5% level of
significance. Assume that the number of clients
is normally distributed.
Example: restaurant (classical approach)
1. 𝐻0 : 𝜇 ≥ 186
𝐻𝑎 : 𝜇 < 186
2. Compute from the sample:
𝑥 = 180.43 and 𝑠 = 12.708
Test statistic: 𝑡∗ =
180.43−186
12.708 14
= −1.64
3. 𝛼 = 0.025, the critical value:
−𝑡 df, 𝛼 = −𝑡 13, 0.025 = −2.160
4. Plot the curve
5. Where is 𝑡∗ ? (in the region of acceptance)
6. Decision: Fail to reject H0
10
Example: restaurant (the p-value approach)
𝐻0 : 𝜇 ≥ 186
𝐻𝑎 : 𝜇 < 186
Test statistic: 𝑡∗ = −1.64
This is a left-tailed test.
Use Table 3 to find with df = 13
p-value = 0.068 (take the larger value)
5. Compare: p-value = 0.068 > 0.025 = 𝛼
6. Decision:
Fail to reject H0
1.
2.
3.
4.
Example: two-tailed test
According to a website, the average weekly
wage of government workers is $1038. A
sample of randomly chosen 11 government
workers is taken and their weekly wages are
recorded: $1080 $990 $1540 $960 $920
$880 $1220 $1630 $940 $1270 $1160
Test at a 10% level of significance whether the
average weekly wage of government workers is
actually different from $1038. Assume a normal
distribution of wages.
11
Example: wages (classical approach)
1. 𝐻0 : 𝜇 = $1038
𝐻𝑎 : 𝜇 ≠ $1038
2. Compute from the sample:
𝑥 = $1144.5 and 𝑠 = $252.6
Test statistic: 𝑡∗ =
1144.5−1038
252.6 11
= 1.40
3. 𝛼 = 0.1, the critical values:
±𝑡 df, 𝛼/2 = ±𝑡 10, 0.05 = ±1.812
4. Plot the curve
5. Where is 𝑡∗ ? (in the region of acceptance)
6. Decision: Fail to reject H0
Example: wages (the p-value approach)
1. 𝐻0 : 𝜇 = $1038
𝐻𝑎 : 𝜇 ≠ $1038
2. Test statistic: 𝑡∗ = 1.40
3. This is a two-tailed test with positive 𝑡∗ .
4. Find the p-value from Table 3 with df = 10:
p-value = 2 * 0.096 = 0.192
(because two-tailed!)
5. Compare: p-value = 0.192 > 0.1 = 𝛼
6. Decision: Fail to reject H0
The decision would be different if we would’ve forgotten to multiply by 2.
12
Example: practice
An article in the San Jose Mercury News claims
that students in the California state university
system take an average of 4.5 years to finish
their undergraduate degrees. Suppose you
suspect that the average time is longer. You
conduct a survey of 30 students and obtain a
sample mean of 4.8 years and a sample standard
deviation of 0.9 years. Test the claim at a 5%
level of significance.
(Do both, the classical, and the p-value approaches.)
Example: practice
A website claims that in Toronto, the average
water/garbage bill for a single family house is
$650 per year. A researcher wants to test this
claim by randomly choosing 50 single family
houses. The average water/garbage bill in his
sample turns out to be equal to $705 per year
with a standard deviation of $195. Can he claim
that the average annual water/garbage bill for a
single family house in Toronto is actually
different from $650 at a 2% level of significance?
13
Example: practice
A telephone company claims that the mean
duration of all long-distance phone calls made by
its residential customers is at least 11 minutes.
Here is a random sample of 16 long-distance
calls, in minutes: 12.3 13.6 4.4 13.1 9.0 12.5
6.6 16.5 5.0 3.9 7.8 9.4 15.7 5.7 11.2 3.7
Assuming the duration of long-distance calls is
normally distributed, test at a 10% level of
significance whether the mean duration of all
long-distance calls is actually less than 11
minutes.
14