Download Hypothesis 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
no text concepts found
Transcript
---‫לא מסווג‬---
Quantitative Methods
2013
Hypothesis Testing with One Sample
1
---‫לא מסווג‬---
Concept of Hypothesis Testing
Testing Hypotheses is another way to deal with the problem of making a statement about an unknown population parameter, based on a random sample.
Instead of finding an estimate for the parameter, we can often find it convenient to hypothesize a value for it and then use the information from the sample to confirm or refute the hypothesized value.
2
---‫לא מסווג‬---
A hypothesis is a judgment about the population parameter based simply on an assumption or intuition with no concrete backup information or analysis.
For example:
‐ population mean
The mean monthly cell phone bill in Haifa is
μ ≤ $42
3
---‫לא מסווג‬---
Hypothesis testing
Hypothesis testing is the comparison of the analyst's belief or claim about a population parameter to the corresponding sample statistic and deciding whether or not the belief or claim about the population parameter is correct.
4
---‫לא מסווג‬---
Example: Filling of soft drink bottles in a bottling plant. Managers have the belief that the machine is filling 1L bottles with 1L of the soft drink. This belief is tested by drawing a sample of filled bottles, measuring the amount of soft drink in each, finding the mean and variance of the amount of soft drink in sample of bottles, comparing this amount with the 1L belief, and finally deciding whether the information from the sample supports or refutes the 1L belief. 5
---‫לא מסווג‬---
Stating a Hypothesis
The Null Hypothesis, H0
This is the hypothesis or claim that is initially assumed to be true. It is what is believed to be, presumed to be, or accepted as true and correct without any evidentiary support. In the bottling scenario, managers believe the machine is filling the bottles correctly even though they have no evidence to support that belief. The null hypothesis in that case is that the bottling machine is functioning correctly.
6
---‫לא מסווג‬---
The Null Hypothesis, H0
Example: The average number of TV sets in U.S. homes is equal to three ( )
H0 : µ = 3
Always contains “=” , “≤” or “≥” sign.
Is always about a population parameter, not about a sample statistic H0 : µ = 3
H0 : X = 3
7
---‫לא מסווג‬---
The Alternative Hypothesis, H1 , (Ha)
This is the hypothesis or claim which we initially assume to be false but which we may decide to accept if there is sufficient evidence. In the bottling scenario, managers will not believe the machine is filling the bottles incorrectly unless they have evidence to support that belief.
It is the sample which provides this evidence.
The alternative hypothesis in that case is that the bottling machine is not functioning correctly.
8
---‫לא מסווג‬---
The Alternative Hypothesis, H1 , (Ha)
Is the opposite (the complement) of the null hypothesis
e.g., The average number of TV sets in U.S. homes is not equal to 3 ( H1: μ ≠ 3 )
Never contains the “=” , “≤” or “≥” sign
9
---‫לא מסווג‬---
This procedure is familiar to us already from the legal system:
“Innocent until proven guilty”. The Null Hypothesis (Innocent) is only
rejected in favor of the Alternative Hypothesis (Guilty)
if there is sufficient evidence of this.
10
---‫לא מסווג‬---
Example:
A weight loss company claims its product, when used as directed, will lead to at least 10 kilograms of weight loss within 45 days. A consumer protection agency wants to verify the company's claim in order to protect the public from fraud. What is the hypothesis statement the agency director should use? 11
---‫לא מסווג‬---
Since the consumer protection agency wants evidence that the weight loss product does not performs as claimed, yields less than 10 kg of weight loss. The entire hypothesis statement is:
H0: µ ≥ 10kg
Ha: µ < 10kg
Complement of the null hypothesis
12
---‫לא מסווג‬---
Rejection Regions
One way of performing a Hypothesis test is to
compute a rejection region.
If we find that our sample statistic is in this region then we reject our Null Hypothesis.
13
---‫לא מסווג‬---
What is important is the idea that the rejection region is a region far away from our Null hypothesis. And that it is unlikely that we would observe a sample with a value of the sample statistic (for example the sample mean) this far away from the Null Hypothesised value if that Null Hypothesis was true. X
14
---‫לא מסווג‬---
For example in a class of 100 people. Suppose our Null Hypothesis is that the average age of the whole class is 31. Ho: the population
mean age is 31.
H0: µ = 31
Ha: µ ≠ 31
15
---‫לא מסווג‬---
If we took a sample from our population and the average age is 33 year we might say that average age of the population is not significantly different from 35.
In this case we would accept the Null Hypothesis as being correct.
However, suppose we now observe a value of 20 in a sample we have randomly chosen. That’s very unlikely to have happened by chance if our Null Hypothesis was true. It’s much more likely that our Null Hypothesis is false. 16
---‫לא מסווג‬---
So we decide to reject our Null Hypothesis in favour
of an alternative, which is that the true average age of the whole class is different from 31 years. Is X = 20
likely if μ = 31?
Suppose
the sample
mean age is 20: X = 20
Random sample
If not likely, REJECT
Null Hypothesis
17
Sampling Distribution of X
---‫לא מסווג‬---
If the sample mean falls in this region we accept the null hypothesis
20
μ = 31
X
If H0 is true
we reject the null hypothesis that μ = 31 if sample mean falls in either of these regions.
18
---‫לא מסווג‬---
Rejection Regions and Critical Values
A rejection region (or critical region) of the sampling distribution is the range of values for which the null hypothesis is not probable. A critical value separates the rejection region from the nonrejection region. 19
---‫לא מסווג‬---
Level of Significance, α
defines the unlikely values of the sample statistic if the null hypothesis is true.
– Defines rejection region of the sampling distribution
α
Typical values are 0.01, 0.05, or 0.10
20
---‫לא מסווג‬--Level of Significance, α
is selected by the researcher at the beginning
α
By setting the level of significance at a small value, you are saying that you want the probability of rejecting a true null hypothesis to be small.
Provides the critical value(s) of the test. 21
---‫לא מסווג‬---
There are three types of hypothesis tests –
a left-, right-, or two-tailed test. The type of test depends on the region of the sampling distribution that favors a rejection of H0. This region is indicated by the alternative hypothesis.
α
/2
α
/2
α
α
0
22
---‫לא מסווג‬---
Level of significance = α
Represents critical value.
Left‐tailed Test
1. If the alternative hypothesis contains the less‐than inequality symbol (<), the hypothesis test is a left‐tailed test. H0: μ ≥ k
H1: μ < k
α
0
23
Right-tailed Test
---‫לא מסווג‬---
2. If the alternative hypothesis contains the greater‐than symbol (>), the hypothesis test is a right‐tailed test. H 0: μ ≤ k
Ha: μ > k
α
0
24
---‫לא מסווג‬---
Two-tailed Test
3. If the alternative hypothesis contains the not‐equal‐to symbol (≠), the hypothesis test is a two‐tailed test. In a two‐tailed test, each tail has an area of α/2.
H0: μ = k
H 1: μ ≠ k
α
/2
α
/2
25
---‫לא מסווג‬---
Statistical Tests
After stating the null and alternative hypotheses and specifying the level of significance,
a random sample is taken from the population and sample statistics are calculated.
The statistic that is compared with the parameter in the null hypothesis is called the test statistic.
A test statistic tells us how far, or how many standard deviations, a sample mean is from the population mean. The larger the value of the test statistic, the further the distance, or number of standard deviations, a sample mean is from the population mean stated in the null hypothesis.
26
---‫לא מסווג‬---
If the population standard deviation is known, and the population is (approx.) Normally distributed then the test statistic, is,
z =x −µ
σ
n
μ is the hypothesized population mean.
X is the sample mean.
σx is the population standard deviation.
n is the sample size.
σ
n
is the standard error.
z, is how many standard errors, the observed sample mean is from the hypothesized mean.
27
---‫לא מסווג‬---
If the population standard deviation is unknown then the only standard deviation we can determine is the sample standard deviation, s.
This value of s can be considered an estimate
of the population standard deviation.
If the sample size is more than 30 we can use
Normal Distribution.
z =x −µ
s
n
Central Limit Theorem
28
---‫לא מסווג‬---
Example:
Find the critical value and rejection region for a right
tailed test with α = 0.5%.
z
0
2.575
The rejection region is to the right of z0 = 2.575.
29
---‫לא מסווג‬---
Decision Rule Based on Rejection Region
To use a rejection region to conduct a hypothesis test, calculate the test statistic, z. If the test statistic
1. is in the rejection region, then reject H0.
2. is not in the rejection region, then fail to reject H0.
Fail to reject Ho.
Reject Ho.
z
0
z0
z > z0 Right-Tailed Test
30
---‫לא מסווג‬---
Fail to reject Ho.
Reject Ho.
Reject Ho.
z
−z0
z < z0 z0
0
z > z0 Two-Tailed Test
Fail to reject Ho.
Reject Ho.
z
z < z0 z0
0
Left-Tailed Test
31
---‫לא מסווג‬---
Hypothesis Testing Example
Test the claim that the true mean # of TV sets in US homes is equal to 3.
(Assume σ = 0.8)
1. State the appropriate null and alternative
hypotheses
ƒ H0: μ = 3 H1: μ ≠ 3 (This is a two‐tail test)
2. Specify the desired level of significance and the sample size
ƒ Suppose that α = 0.05 and n = 100 are chosen for this test
32
---‫לא מסווג‬---
3. Determine the appropriate technique
ƒ σ is known, so this is a Z test.
4. Determine the critical values
ƒ At a significance level of 5% for the test of a
difference there is 2.5% in each tail.
Using function NORMSINV in Excel this gives a
critical value of z of 1.96.
33
---‫לא מסווג‬---
5. Collect the data and compute the test statistic
ƒ Suppose the sample results are n = 100, X = 2.84 (σ = 0.8 is assumed known)
So the test statistic is:
Z =
X −µ
2.84 − 3
− .16
=
=
= −2.0
σ
0.8
.08
n
100
34
---‫לא מסווג‬---
6. Is the test statistic in the rejection region?
α = 0.05/2
Reject H0
Reject H0 if ‐Z= ‐1.96
α = 0.05/2
Do not reject H0
0
Reject H0
+Z= +1.96
Z < ‐1.96 or Z > 1.96; otherwise do not Here, Z = ‐2.0 < ‐1.96, so the test statistic is in the rejection region
reject H0
35
---‫לא מסווג‬---
Since Z = ‐2.0 < ‐1.96, we reject the null hypothesis and conclude that there is sufficient evidence that the mean number of TVs in US homes is not equal to 3. 36
Connection to Confidence Intervals
---‫לא מסווג‬---
For X = 2.84, σ = 0.8 and n = 100, the 95% confidence interval is:
2.84 - (1.96)
0.8
to
100
2.84 + (1.96)
0.8
100
[2.6832, 2.9968]
Since this interval does not contain the hypothesized mean (3.0), we reject the null hypothesis at α = 0.05
37
---‫לא מסווג‬--Example:
A local telephone company believes that the average length of a phone call is 8 minutes.
H0: µ = 8
Ha: µ ≠ 8
In a random sample of 58 phone calls, the sample mean was 7.8 minutes and the standard deviation was 0.5 minutes. Is there enough evidence to reject the Null at
α = 0.05?
38
---‫לא מסווג‬---
0.025
0.025
z
−z0 = −1.96
0
z0 = 1.96
At a significance level of 5% for the test of a
difference there is 2.5% in each tail.
Using function NORMSINV in Excel this gives a
critical value of z of 1.96.
39
---‫לא מסווג‬---
0.025
0.025
z
−z0 = −1.96
The standardized test statistic is z = x − µ = 7.8 − 8
σ n 0.5 58
≈ −3.05.
0
z0 = 1.96
The test statistic falls in the rejection region, so H0 is rejected.
At the 5% level of significance, there is enough evidence to reject the claim that the average length of a phone call is 8 minutes.
40
---‫לא מסווג‬---
Example: Right‐Tail Z Test for Mean A phone industry manager thinks that customer monthly cell phone bills have increased, and now average over $52 per month. The company wishes to test this claim. (Assume σ = 10 is known)
Form hypothesis test:
H0: μ ≤ 52 the average is not over $52 per month
H1: μ > 52 the average is greater than $52 per month
(i.e., sufficient evidence exists to support the manager’s claim)
41
---‫לא מסווג‬---
Suppose that α = 0.10 is chosen for this test
Find Rejection Region
α = 0.10
0
1.28
For a one‐tail test, at a significance level of 10% for the test there is 10% in the right tail. The area of the curve for the upper level is 100% ‐ 10% or 90.00%. Using [function NORMSINV] in Excel this gives
a critical value of z of 1.28.
42
---‫לא מסווג‬---
Find Rejection Region
Reject H0
α = 0.10
Do not reject H0
0
1.28
Reject H0
Reject H0 if Z > 1.28
43
---‫לא מסווג‬---
Obtain sample and compute the test statistic
Suppose a sample is taken with the following results: n = 64, X = 53.1 (σ=10 was assumed known)
– Then the test statistic is:
X−µ
53.1 − 52
=
= 0.88
Z=
σ
10
n
64
44
---‫לא מסווג‬---
Reach a decision and interpret the result:
Reject H0
α = 0.10
Do not reject H0
1.28
0
Reject H0
Z = 0.88
Do not reject H0 since Z = 0.88 ≤ 1.28
i.e.: there is not sufficient evidence that the
mean bill is over $52
45
---‫לא מסווג‬---
t-Test for a Mean µ (n < 30, σ Unknown)
The t-test can be used when the population is normal or nearly normal, σ is unknown, and n < 30. t =x −µ
s n
The degrees of freedom are d.f. = n – 1 .
46
---‫לא מסווג‬---
Example:
Find the critical values t0 and −t0 for a two‐tailed test given α = 0.10 and n = 12.
The degrees of freedom are d.f. = n – 1 = 12 – 1 = 11.
Because the test is a two‐tail test, one critical value is negative and one is positive.
−t0 = − 1.796 and t0 = 1.796
47
---‫לא מסווג‬--Example:
Find the critical value t0 for a right‐tailed test given
α = 0.05 and n = 11.
The degrees of freedom are d.f. = n – 1 = 11 – 1 = 10.
Because the test is a right‐tail test, the critical value is positive.
Using function TINV from Excel the t‐value is 1.81.
t0 = 1.81
48
---‫לא מסווג‬---
TINV function returns the two‐tailed inverse of the t‐distribution.
A one‐tailed t‐value can be returned by replacing probability with 2*probability.
For a probability of 0.05 and degrees of freedom of 10, the two‐tailed value is calculated with TINV(0.05,10), which returns 2.28139. The one‐tailed value for the same probability and degrees of freedom can be calculated with TINV(2*0.05,10), which returns 1.812462. 49
---‫לא מסווג‬---
Example:
The average cost of a hotel room in Tel Aviv is said to be $168 per night.
A random sample of 25 hotels resulted in X = $172.50 and S = $15.40.
Test at the α = 0.05 level.
(Assume the population distribution is normal)
H0: μ = 168 H1: μ ≠ 168
50
• α = 0.05
---‫לא מסווג‬---
• n = 25
• σ is unknown, n<30 so use a t statistic
• Critical Value: t24 = ± 2.0639
α/2=.025
α/2=.025
Reject H0
‐t n‐1,α/2
‐2.0639
Do not reject H0
0
Reject H0
t n‐1,α/2
2.0639
51
---‫לא מסווג‬---
t n−1 =
X −µ
172.50 − 168
=
= 1.46
S
15.40
n
25
α/2=.025
α/2=.025
Reject H0
‐t n‐1,α/2
‐2.0639
Do not reject H0
0
Reject H0
t n‐1,α/2
2.0639
Do not reject H0: not sufficient evidence that true mean cost is different than $168
52
---‫לא מסווג‬---
Connection to Confidence Intervals
For X = 172.5, S = 15.40 and n = 25, the 95% confidence interval is:
172.5 ‐ (2.0639) 15.4/ 25 to 172.5 + (2.0639) 15.4/ 25
[166.14 ,178.86]
Since this interval contains the Hypothesized mean (168), we do not reject the null hypothesis at α = 0.05
53
---‫לא מסווג‬---
Example:
A certain country has made its budget on the bases that the average individual average tax payments for the year will be $30,000. The financial controller takes a random sample of annual tax returns and these amounts in dollars are as follows.
34,000 12,000 16,000 10,000
2,000 39,000 7,000 72,000
24,000 15,000 19,000 12,000
23,000 14,000 6,000 43,000
54
---‫לא מסווג‬---
At a significance level, α, of 5% is there evidence
that the average tax returns of the state will be
different than the budget level of $30,000 in
this year?
The null and alternative hypotheses are as follows:
Null hypothesis: H0: μ = $30,000.
Alternative hypothesis: H1: μ ≠ $30,000.
Since we have no information of the population
standard deviation, and the sample size is
less than 30, we use a t distribution (assuming the population is normally distributed).
55
---‫לא מסווג‬---
Sample size, n, is 16.
Degrees of freedom, (n‐1) are 15.
Using [function TINV] from Excel the t value is 2.1315. Therefore, ±2.1315 are the critical values.
From Excel, using [function AVERAGE]:
Mean value of this sample data is $21,750.00.
56
---‫לא מסווג‬---
From [function STDEV] in Excel, the sample
standard deviation, s, is $17,815.72
Estimate of the standard error is,
s
n = 17,815.72 = 4,453.93
16
From equation the test statistic is,
t = x − µ = -1.8523
s n
57
---‫לא מסווג‬---
Since the sample statistic, 1.8523, is not less than the test statistic of 2.1315,
there is no reason to reject the null hypothesis and so
we accept that there is no evidence that the
average of all the tax receipts will be significantly
different from $30,000.
58
---‫לא מסווג‬---
Example:
A local telephone company claims that the average length of a phone call is 8 minutes. In a random sample of 18 phone calls, the sample mean was 7.8 minutes and the standard deviation was 0.5 minutes. Is there enough evidence to reject this claim at α = 0.05?
H0: µ = 8
Ha: µ ≠ 8
The level of significance is α = 0.05. The test is a two-tailed test.
Degrees of freedom are d.f. = 18 – 1 = 17.
59
The critical values are −t0 = −2.110 and t0 = 2.110
---‫לא מסווג‬---
z
−t0 = −2.110
The standardized test statistic is t = x − µ = 7.8 − 8
0.5 18
s n
0
t0 = 2.110
The test statistic falls in the nonrejection region, so H0 is not rejected.
≈ −1.70.
At the 5% level of significance, there is not enough evidence to reject the claim that the average length of a phone call is 8 minutes.
60
---‫לא מסווג‬---
6 Steps in Hypothesis Testing
1. State the null hypothesis, H0 and the alternative hypothesis, H1
2. Choose the level of significance, α, and the sample size, n
3. Determine the appropriate test statistic and sampling distribution
4. Determine the critical values that divide the rejection and nonrejection regions
61
---‫לא מסווג‬---
6 Steps in Hypothesis Testing
5. Collect data and compute the value of the test statistic.
6. Make the statistical decision. If the test statistic falls into the nonrejection region, do not reject the null hypothesis H0. If the test statistic falls into the rejection region, reject the null hypothesis. 62
---‫לא מסווג‬---
APPENDIX
63
---‫לא מסווג‬---
Types of Errors
No matter which hypothesis represents the claim,
always begin the hypothesis test assuming that the null hypothesis is true.
g
At the end of the test, one of two decisions will be made:
1. reject the null hypothesis, or
2. fail to reject the null hypothesis.
A Type I error occurs if the null hypothesis is rejected when it is true.
A Type II error occurs if the null hypothesis is not rejected when it is false.
64
---‫לא מסווג‬---
Actual Truth of H0
Decision
H0 is true
H0 is false
Do not reject H0 Correct Decision Type II Error
Reject H0
Correct Decision
Type I Error
The probability of Type I Error is α
65
---‫לא מסווג‬---
Example:
The Haifa Technion claims that 94% of their graduates find employment within six months of graduation. What will a type I or type II error be?
H0: p = 0.94 (Claim)
H1: p ≠ 0.94
A Type I error is rejecting the null when it is true. The population proportion is actually 0.94, but is rejected. (We believe it is not 0.94.) A Type II error is failing to reject the null when it is false. The population proportion is not 0.94, but is not rejected. (We believe it is 0.94.) 66
Related documents