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

Psychometrics wikipedia , lookup

Foundations of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Statistical hypothesis testing wikipedia , lookup

Misuse of statistics wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript





Introduction
Hypothesis testing
Hypothesis testing
Hypothesis testing
Hypothesis testing
(difference)
for
for
for
for
one mean
one proportion
two mean (difference)
two proportion


We test a certain given theory / belief about population
parameter.
We may want to find out, using some sample information,
whether or not a given claim / statement about population is
true.
Hypothesis and Test Procedures
A statistical test of hypothesis consist of :
H0
(H0 & H1)
1. Develop Hypothesis Statement
H1 p-value
2. Calculate test statistic or using
3. Find Critical value
4. Determine rejection region
5. Make a conclusion
2
Definition 9.1:
Hypothesis testing : can be used to determine whether a statement
about the value of a population parameter should or should not
be rejected.
Null hypothesis, H0 : A null hypothesis is a claim (or statement)
about a population parameter that is assumed to be true.
(the null hypothesis is either rejected or fails to be rejected.)
Alternative hypothesis, H1 : An alternative hypothesis is a claim
about a population parameter that will be true if the null
hypothesis is false.
Test Statistic : is a function of the sample data on which the
decision is to be based.
p-value: is the probability calculated using the test statistic. The
smaller the p-value, the more contradictory is the data to H0.
Critical point: It is the first (or boundary) value in the critical region.
Rejection region: It is a set of values of the test statistics for which the null
hypothesis will be rejected.
3
It
is not always obvious how the null and alternative hypothesis
should be formulated.

1)
2)
3)
4)
5)
When formulating the null and alternative hypothesis, the nature or
purpose of the test must also be taken into account. We will
examine:
The claim or assertion leading to the test.
The null hypothesis to be evaluated.
The alternative hypothesis.
Whether the test will be two-tail or one-tail.
A visual representation of the test itself.
In some cases it is easier to identify the alternative hypothesis first.
In other cases the null is easier.
9.1.1 Alternative Hypothesis as a Research Hypothesis
•
Many applications of hypothesis testing involve
an attempt to gather evidence in support of a
research hypothesis.
•
In such cases, it is often best to begin with the
alternative hypothesis and make it the conclusion
that the researcher hopes to support.
•
The conclusion that the research hypothesis is true
is made if the sample data provide sufficient
evidence to show that the null hypothesis can be
rejected.
Example 9.1:
A new drug is developed with the goal
of lowering blood pressure more than the existing drug.
•
•
Alternative Hypothesis H1 :
The new drug lowers blood pressure more than
the existing drug.
Null Hypothesis H0 :
The new drug does not lower blood pressure more
than the existing drug.
9.1.2 Null Hypothesis as an Assumption to be Challenged
•
We might begin with a belief or assumption that
a statement about the value of a population
parameter is true.
•
We then using a hypothesis test to challenge the
assumption and determine if there is statistical
evidence to conclude that the assumption is
incorrect.
•
In these situations, it is helpful to develop the null
hypothesis first.
Example 9.2 :
The label on a soft drink bottle states
that it contains at least 67.6 fluid ounces.
•
•
Null Hypothesis H0 :
The label is correct. µ > 67.6 ounces.
Alternative Hypothesis H1 :
The label is incorrect. µ < 67.6 ounces.
Example 9.3:
Average tire life is 35000 miles.
• Null Hypothesis H0 :
µ = 35000 miles
• Alternative Hypothesis H1: µ  35000 miles

Rule to develop H0 and H1:
Two-Tailed
Test
H0
=
H1

Left-Tailed Right-Tailed Test
Test
= or 
<
= or 
>



1. Coca Cola claim that on average, the cans
contain less than 12 ounces of soda.
2. The mean family size in UK was 3.18 in
1998. Test whether the claim is true.
The mean starting salary of school teachers in
Kangar is RM2800. Test whether the current
mean starting salary of all teachers in Kangar
is higher than RM2800.
9.1.3 How to decide whether to reject or accept H 0 ?
The entire set of values that the test statistic may assume is
divided into two regions. One set, consisting of values that
support the H1 and lead to reject H 0 , is called the rejection
region. The other, consisting of values that support the H 0 is
called the acceptance region. H0 always gets “=“.
Rule to Reject H0:
Tails of a Test
Sign in
Sign in
H0
H1
Rejection Region
Two-Tailed
Test
=

In both tail
Left-Tailed
Test
= or 
<
In the left
tail
Right-Tailed
Test
= or 
>
In the right
tail
12

Given:
H 0 :   45
H1 :   45
H 0 :   23
H1 :   23
H 0 :   7.12
H1 :   7.12
 Because hypothesis tests are based on sample data,
we must allow for the possibility of errors.
 A Type

I error is rejecting H0 when it is true
The probability of making a Type I error when the
null hypothesis is true as an equality is called the
level of significance ().
 Applications
of hypothesis testing that only control
the Type I error are often called significance tests.
9.2.2 Type II Error
 A Type
II error is accepting H0 when it is false.

It is difficult to control for the probability of making
a Type II error, .

Statisticians avoid the risk of making a Type II
error by using “do not reject H0” and not “accept H0”.
Type I and Type II Errors
Population Condition
Conclusion
Do not reject H0
Reject H0
H0 True
H0 False
Correct
Decision
Type II Error
Type I Error
Correct
Decision


Null Hypothesis : HH
0 : :
0 

0
0
Test Statistic :
Z
x

• any population,  is known and n is large
Or n is small
n
Z  x s 
• any population,  is unknown and n is large
n
t  x s 
n
• normal population,  is unknown and n is
small
v  n 1
17
Alternative hypothesis
Rejection Region ( Reject H0)
H1 :   0
Both tail:
H1 :   0
Right tail:
Z  z
H1 :   0
Left tail:
Z<  z
Z   z 2 or Z  z 2
18
Definition 9.2: p-value
The p-value is the smallest significance level at which the null
hypothesis is rejected.
Using the p  value approach, we reject the null hypothesis, H 0 if
p  value   for one  tailed test
p  value 

2
for two  tailed test
and we do not reject the null hypothesis, H 0 if
p  value   for one  tailed test
p  value 

2
for two  tailed test
19
Example 9.4:
The average monthly earnings for women in managerial and
professional positions is RM 2400. Do men in the same positions
have average monthly earnings that are higher than those for women ?
A random sample of n  40 men in managerial and professional
positions showed x  RM 3600 and s  RM 400. Test the appropriate
hypothesis using   0.01
20
Solution:
1.The hypothesis to be tested are,
H 0 :   2400
H1 :   2400
2. Test Statistic
x   3600  2400
Z

 18.97
s
400
n
40
3. Critical Value: z  z0.01  2.33
4. Rejection Region : Z  z because right-tailed test.
Since 18.97  2.33, falls in the rejection region, we reject H 0
5. We conclude that average monthly earnings for men in managerial
and professional positions are significantly higher than those for women.
21
Exercise:
A teacher claims that the student in Class A put in more hours
studying compared to other students. The mean numbers of
hours spent studying per week is 25hours with a standard
deviation of 3 hours per week. A sample of 27 Class A students
was selected at random and the mean number of hours spent
studying per week was found to be 26hours. Can the teacher’s
claim be accepted at 5% significance level?
Null Hypothesis :
Test Statistic
:
H 0 : p  p0
pˆ  p0
Z
p0 q0
n
Alternative hypothesis
Rejection Region
H1 : p  p0
Both tail : Z   z

H1 : p  p0
H1 : p  p0
Right tail:
Left tail:
2
or Z  z
2
Z  z
Z<  z
23
Example 9.5:
When working properly, a machine that is used to make chips for
calculators does not produce more than 4% defective chips.
Whenever the machine produces more than 4% defective chips it
needs an adjustment. To check if the machine is working
properly, the quality control department at the company often
takes sample of chips and inspects them to determine if the
chips are good or defective. One such random sample of 200
chips taken recently from the production line contained 14
defective chips. Test at the 5% significance level whether or not
the machine needs an adjustment.
24
Solution:
The hypothesis to be tested are ,
H 0 : p  0.04
H1 : p  0.04
Test statistic is
pˆ  p0
0.07  0.04
Z

 2.17
p0 q0
0.04(0.96)
200
n
Rejection Region : Z  z
; z  z0.05  1.65
Since 2.17  1.65, falls in the rejection region, we can reject H 0
and conclude that the machine needs an adjustment.
25
Exercise
A manufacturer of a detergent claimed that his detergent is at
least 95% effective is removing though stains. In a sample of 300
people who had used the detergent, n 279 people claimed that
they were satisfied with the result.
Determine whether the manufacturer’s claim is true at 1%
significance level.
1  2
H 0 : 1  2  0
Null Hypothesis :
Test statistics:
x  x      

Z
1
2

1
2
1
n1

2
2
2
n2
x  x      

Z
1
2
1
2
1
2
2
s
s
 2
n1 n2
x  x      

Z
1
2
Sp
with S p 
•
1
2
1 1

n1 n2
 n1  1 s12   n2  1 s22
•
For two large and independent samples
and  1 and  2 are known.
For two large and independent samples
and  1 and  2 are unknown.
(Assume  1   2 )
•
For two large and independent samples
and  1 and  2 are unknown.
(Assume  1   2 )
n1  n2  2
28
x  x      

t
1
2
Sp
1
2
1 1

n1 n2
v  n1  n2  2
x  x      

t
1
2
1
2
s12 s2 2

n1 n2
For two small and independent samples
• and  1 and  2 are unknown.
(Assume  1   2 )
• For two small and independent samples
taken from two normally distributed
populations.
2
 s12 s2 2 
 

n1 n2 

v
2
2
1  s12 
1  s2 2 
  


n1  1  n1  n2  1  n2 
29
Alternative hypothesis
Rejection Region
H1 : 1  2  0
Z   z 2 or Z  z 2
H1 : 1  2  0
Z  z
H1 : 1  2  0
Z<  z
30
Example 9.7:
A university conducted an investigation to determine whether
car ownership affects academic achievement was based on two
random samples of 100 male students, each drawn from the
student body. The grade point average for the n1  100 non
owners of cars had an average and variance equal to x1  2.70
and s12  0.36 as opposed to x 2  2.54 and s2 2  0.40 for the
n2  100 car owners. Do the data present sufficient evidence to
indicate a difference in the mean achievements between car owners
and non owners of cars ? Test using   0.05
31
Solution:
The hypothesis to be tested are ,
H 0 : 1  2  0
H1 : 1  2  0
Therefore, test statistic is
x  x      

Z
Z 
1
2
1
s12 s2 2

n1 n2
2
2.70  2.54
 1.84
0.36 0.40

100 100
32
Rejection Region : Z   z 2 or Z  z 2 ; z0.05 2  z0.025  1.96
Do Not
Reject H
Reject H

0
Reject H
0

z=-1.96
0

z=+1.96
Since 1.84 does not exceed 1.96 and not less than  1.96, we fail to reject H 0
and that is, there is not sufficient evidence to declare that there is a difference
in the average academic achievement for the two groups.
Exercise:
The mean lifetime of 30 batteries produced by company A is 50
hours and the mean lifetime of 35 bulbs produced by company B
is 48 hours. If the standard deviation of all bulbs produced by
company A is 3 hour and the standard deviation of all bulbs
produced by company B is 3.5 hours.
Test at 1 % significance level that the mean lifetime of bulbs
produced by Company A is better than that of company B
(claim).
p1  p2
Null Hypothesis :
Test Statistics
Z
H 0 : p1  p2  0
:
 pˆ1  pˆ 2    p1  p2 
x1  x2
where pˆ 
n1  n2
pˆ (1  pˆ ) pˆ (1  pˆ )

n2
n1
pˆ1  pˆ 2    p1  p2 

Z
1 1
ˆ ˆ  
pq
 n1 n2 
35
Alternative hypothesis
Rejection Region
H1 : p1  p2  0
Z   z 2 or Z  z 2
H1 : p1  p2  0
Z  z
H1 : p1  p2  0
Z<  z
36
Example:
A researcher wanted to estimate the difference between the percentages of
two toothpaste users who will never switch to other toothpaste. In a sample
of 500 users of toothpaste A taken by the researcher, 100 said that they will
never switched to another toothpaste. In another sample of 400 users of
toothpaste B taken by the same researcher, 68 said that they will never
switched to other toothpaste.
At the significance level 1%, can we conclude that the proportion of users of
toothpaste A who will never switch to other toothpaste is higher than the
proportion of users of toothpaste B who will never switch to other
toothpaste?
Solution:
The hypothesis to be tested are ,
H 0 : p1  p2  0
H1 : p1  p2  0
 p1 is not greater than p2 
 p1 is greater than p2 
Therefore, test statistic is
Z
 pˆ1  pˆ 2    p1  p2   Z 
1
1 
ˆ ˆ  
pq
 n1 n2 
Rejection Region : Z  z
0.20  0.17  0
1 
 1
(0.187)(0.813) 


 500 400 
 1.15
; z0.01  2.33
Since 1.15  2.33, we fail to reject H 0 and therefore, we conclude that the
proportions of users of Toothpaste A who will never switch to another toothpaste
is not greater than the proportion of users of Toothpaste B who will never switch
to another toothpaste.
38
Exercise:
In a process to reduce the number of death due the dengue fever,
two district, district A and district B each consists of 150 people
who have developed symptoms of the fever were taken as
samples. The people in district A is given a new medication in
addition to the usual ones but the people in district B is given
only the usual medication. It was found that, from district A and
from district B, 120 and 90 people respectively recover from the
fever.
Test the hypothesis that the new medication helps to cure the
fever using a level of significance of 5% (claim).