Download Hypt. tests - application

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

Bootstrapping (statistics) wikipedia , lookup

Taylor's law wikipedia , lookup

Foundations of statistics wikipedia , lookup

Psychometrics wikipedia , lookup

Omnibus test wikipedia , lookup

Misuse of statistics wikipedia , lookup

Student's t-test wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Transcript
STATISTICAL INFERENCE
PART VII
HYPOTHESIS TESTING –
APPLICATIONS – ONE POPULATION
TESTS
1
HYPOTHESIS TEST FOR POPULATION
MEAN, 
•  KNOWN AND X~N(, 2) OR LARGE
SAMPLE CASE:
Two-sided Test
H0:  = 0
HA:   0
Test Statistic
z
Rejecting Area
x  0
/ n
/2
-z/2
• Reject H0 if z < z/2 or z > z/2.
/2
1-
z/2
Reject H0
Reject H0
Do not reject H0
2
HYPOTHESIS TEST FOR POPULATION
MEAN, 
One-sided Tests
1. H0:  = 0
HA:  > 0
Test Statistic
z
x  0

1-
/ n
• Reject H0 if z > z.
2. H0:  = 0
x  0
z
HA:  < 0
/ n
• Reject H0 if z < z.
Rejecting Area
z
Do not reject H0 Reject H0

1-
- z
Reject H0
Do not reject H0
3
POWER OF THE TEST AND
P-VALUE
• 1- = Power of the test
= P(Reject H0|H0 is not true)
• p-value = Probability of obtaining a test statistics at
least as extreme as the one that you observed by
chance
4
P-VALUE
• http://labstats.net/articles/pvalue.html
• Ex: toss a fair coin 20 times and count the
number of heads, and then repeat this 10000
times (Or simulate data)
• Ho: Coin is fair (i.e. p=0.5)
5
P-VALUE
10 heads out of 20 tosses was the most frequent outcome
6
P-VALUE
• Suppose we toss the coin and observe that it lands
heads on 16 out of 20 tosses. We expect 10 heads
but observe 16, what do we make of this value? Is it
very large, or unusual?
• P-value=probability of getting the observed results
(16 heads) or more extreme results (17, 18, 19, or 20
heads)
• 61 out of 10000 trials ended up with 16 or more
heads  p = 0.0061
• If the unknown coin were fair, then one would
expect to obtain 16 or more heads only 0.61% of the
time
7
CALCULATION OF P-VALUE
x  0
• Determine the value of the test statistics, z 0 
/ n
• For One-Tailed Test:
p-value
p-value= P(z > z0) if HA: >0
p-value= P(z < z0) if HA: <0
• For Two-Tailed Test
p=p-value = 2.P(z>z0)
p=p-value = 2.P(z<-z0)
z0
p-value
z0
p/2
p/2
-z0
z0
8
DECISION RULE BY USING P-VALUES
• REJECT H0 IF p-value < 

p-value
• DO NOT REJECT H0 IF p-value  
9
Example
• Do the contents of bottles of catsup have a
net weight below an advertised threshold of
16 ounces?
• To test this 25 bottles of catsup were selected.
They gave a net sample mean weight of X  15.9
. It is known that the standard deviation is   .4
. We want to test this at significance levels 1%
and 5%.
10
CALCULATIONS
The z-score is:
15.9  16
Z
 1.25
.4
25
 
The p-value is the probability of getting a score worse
than this (relative to the alternative hypothesis) i.e.,
P(Z  1.25)  .1056
Compare the p-value to the significance level. Since
it is bigger than both 1% and 5%, we do not reject
the null hypothesis.
11
P-value for this one-tailed Test
• The p-value for this test is 0.1056
0.1056
0.10
0.05
-1.25
reject H0 at
• Thus, do not
1% and 5% significance level.
We do not have enough evidence to say that the
contents of bottles of catsup have a net weight of less
than 16 ounces.
12
Test of Hypothesis for the Population
Mean ( unknown)
• For samples of size n drawn from a Normal
Population, the test statistic:
x-
t
s/ n
has a Student t-distribution with n1 degrees
of freedom
13
EXAMPLE
• 5 measurements of the tar content of a
certain kind of cigarette yielded 14.5, 14.2,
14.4, 14.3 and 14.6 mg per cigarette. Show
the difference between the mean of this
sample x  14.4 and the average tar content
claimed by the manufacturer, =14.0, is
significant at =0.05.
5
 ( xi  x )
s 2  i 1
n 1
s  0.158
2
( 14.5  14.4 )2  ...  ( 14.6  14.4 )2

 0.025
5 1
14
SOLUTION
• H0:  = 14.0
HA:   14.0
x  0 14.4  14.0
t

 5.66
s / n 0.158 / 5
t / 2 ,n1  t0.025 ,4  2.766
Decision Rule: Reject Ho if t<-t/2 or t> t/2.
15
CONCLUSION
• Reject H0 at  = 0.05. Difference is significant.
0.025
0.95
-2.766
Reject H0
0.025
2.766
5.66
Reject H0
16
P-value of This Test
• p-value = 2.P(t > 5.66) = 2(0.0024)=0.0048
Since p-value = 0.0048 <  = 0.05, reject H0.
Minitab Output
T-Test of the Mean
Test of mu = 14.0000 vs mu not = 14.0000
Variable
C1
N Mean StDev SE Mean
5 14.4000 0.1581 0.0707
T P-Value
5.66 0.0048
17
CONCLUSION USING THE CONFIDENCE
INTERVALS
MINITAB OUTPUT:
Confidence Intervals
Variable
C1
N Mean StDev SE Mean
95.0 % C.I.
5 14.4000 0.1581 0.0707 ( 14.2036, 14.5964)
• Since 14 is not in the interval, reject H0.
18
EXAMPLE
Problem: At a certain production facility that assembles
computer keyboards, the assembly time is known (from
experience) to follow a normal distribution with mean ()
of 130 seconds and standard deviation () of 15 seconds.
The production supervisor suspects that the average time
to assemble the keyboards does not quite follow the
specified value. To examine this problem, he measures
the times for 100 assemblies and found that the sample
mean assembly time ( x) is 126.8 seconds. Can the
supervisor conclude at the 5% level of significance that
the mean assembly time of 130 seconds is incorrect?
19
• We want to prove that the time required to
do the assembly is different from what
experience dictates: H A :   130
X  126.8
• The sample mean is
• The standard deviation is   15
• The standardized test statistic value is:
126.8  130
Z
 2.13
15
100
 
20
Two-Tail Hypothesis:
H0: 130
Type I Error
Probability
HA: 130

-z
z=test statistic values
Reject H0
(z<-z)
1-
0
Do not Reject
H0
(-zz<z)

z

Reject H0
(z>z)
21
Test Statistic:
z=
X-
126.8 - 130
=
= -2.13
15
n
100

Rejection Region
.90
.9
0
-z0
1
0
0
z0
1
Z
22
CONCLUSION
• Since –2.13<-1.96, it falls in the rejection
region.
• Hence, we reject the null hypothesis that
the time required to do the assembly is 130
seconds. The evidence suggests that the task
now takes either more or less than 130
seconds.
23
DECISION RULE
• Reject Ho if z < -1.96 or z > 1.96.
In terms of X , reject H0 if
15
X  130  1.96
= 127.6 06
100
15
or X  130  1.96
=132.94
100
24
P-VALUE
• In our example, the p-value is
p  value  2.P(Z  2.13)  2(0.0166)  0.0332
So, since 0.0332 < 0.05, we reject the null.
25
Calculating the Probability of Type II Error
Ho:  = 130
HA: 130
• Suppose we would like to compute the probability of not
rejecting H0 given that the null hypothesis is false (for
instance =135 instead of 130), i.e.
=P(not rejecting Ho|Ho is false).
Assuming =135 this statement becomes:
P(127.06  x  132.94|  135)
127.06-135
132.94-135
 P(
Z 
)
15/ 100
15/ 100
 P(-5.29  Z  -1.37)  .0853
26
TESTING HYPOTHESIS ABOUT
POPULATION PROPORTION, p
• ASSUMPTIONS:
1. The experiment is binomial.
2. The sample size is large enough.
x: The number of success
The sample proportion is
x
pq
p̂  ~ N(p, )
n
n
approximately for large n (np  5 and nq  5 ).
27
HYPOTHESIS TEST FOR p
Two-sided Test
H0: p = p0
HA: p  p0
Test Statistic
Rejecting Area
p̂  p
z
/2
pq / n
1-
- z/2
/2
z/2
Reject H0 Do not reject H0 Reject H0
• Reject Ho if z < -z/2 or z > z/2.
28
HYPOTHESIS TEST FOR p
One-sided Tests
1. H0: p= p0
HA: p > p0
Test Statistic
p̂  p
z
pq / n
Rejecting Area

1-
z
• Reject Ho if z > z.
p̂  p
2. H0: p = p0
z
pq / n
HA: p < p0
Do not reject H0

Reject H0
1-
-z
• Reject Ho if z < - z.
Reject H0
Do not reject H0
29
EXAMPLE
• Mom’s Home Cokin’ claims that 70% of the
customers are able to dine for less than $5.
Mom wishes to test this claim at the 92% level
of confidence. A random sample of 110
patrons revealed that 66 paid less than $5 for
lunch.
Ho: p = 0.70
HA: p  0.70
30
ANSWER
• x = 66, n = 110 and p = 0.70
x 66
 p̂  
 0.6
n 110
•  = 0.08, z/2 = z0.04 = 1.75
• Test Statistic:
0.6  0.7
z
 2.289
(0.7)(0.3) /110
31
CONCLUSION
• DECISION RULE:
Reject H0 if z < -1.75 or z > 1.75.
• CONCLUSION: Reject H0 at  = 0.08. Mom’s
claim is not true.
/2
/2
-2.289 -1.75 1.75
32
P-VALUE
• p-value = 2. P(z < -2.289) =2(0.011) = 0.022
The smallest value of  to reject H0 is 0.022.
Since p-value = 0.022 <  = 0.08, reject H0.
0.011
-2.289
33
CONFIDENCE INTERVAL APPROACH
• Find the 92% CI for p.
p̂q̂
(0.6)(0.4)
p̂  z / 2
 0.6  1.75
n
110
92% CI for p: 0.52  p  0.68
• Since p  0.7 is not in the above interval, reject
H0. Mom has overestimated the percentage of
customers that pay less than 5$ for a meal.
What happens with wider confidence intervals? Exercise:
Calculate the 95% and 99% CIs for p.
34
SAMPLING DISTRIBUTION OF s2
• The statistic
(n  1)s
 
2
is chi-squared distributed with n-1 d.f. when
the population random variable is normally
distributed with variance 2.
2
2
35
CHI-SQUARE DISTRIBUTION
f(2)
A
A
2
0

2
1-A

2
A
36
Inference about the Population
Variance (2)
• Test statistic
(n  1)s
 
2
2
2
which is chi-squared distributed with n - 1
degrees of freedom
2
LCL =
(n - 1) s
2/2
UCL =
(n - 1) s2
21 - /2
Confidence interval estimator:
37
Testing the Population Variance (2)
EXAMPLE
• Proctor and Gamble told its customers that the
variance in the weights of its bottles of Pepto-Bismol
is less than 1.2 ounces squared. As a marketing
representative for P&G, you select 25 bottles and
find a variance of 1.7. At the 10% level of
significance, is P&G maintaining its pledge of product
consistency?
H0: 2 = 1.2
HA: 2 < 1.2
38
ANSWER
2
• n=25, s2=1.7, =0.10, 0.90,24
 15.659
• Test Statistics:
(n  1)s
(24)1.7
 

 34
2
1.2

2
2
2
2
• Decision Rule: Reject H0 if    ,n 1  15.6587
• Conclusion: Because 2=34 > 15.6587, do not reject
H0.
• We don’t have enough evidence that suggests the
variability in product weights less than 1.2 ounces
squared.
39
EXAMPLE
• A random sample of 22 observations from a
normal population possessed a variance equal
to 37.3. Find 90% CI for 2.
90% CI for 2:
2
(n  1)s 2
(n

1)s
2


 2
2
0.05,21
0.95,21
(21)37.3
(21)37.3
2
 
32.6705
11.5913
23.9757   2  67.5765
40