Chapter 7 Hypothesis Testing

Download Report

Transcript Chapter 7 Hypothesis Testing

Chapter 7
Hypothesis Testing
7-1 Basics of Hypothesis Testing
7-2 Testing a Claim about a Mean: Large Samples
7-3 Testing a Claim about a Mean: Small Samples
7-4 Testing a Claim about a Proportion
7- 5 Testing a Claim about a Standard
Deviation (will cover with chap 8)
1
7-1
Basics of
Hypothesis Testing
2
Definition
Hypothesis
in statistics, is a statement regarding a
characteristic of one or more populations
3
Steps in Hypothesis Testing
1. Statement is made about the population
2. Evidence in collected to test the
statement
3. Data is analyzed to assess the
plausibility of the statement
4
Components of a
Formal Hypothesis
Test
5
Components of a Hypothesis Test
1. Form Hypothesis
2. Calculate Test Statistic
3. Choose Significance Level
4. Find Critical Value(s)
5. Conclusion
6
Null Hypothesis: H0
A hypothesis set up to be nullified or
refuted in order to support an
alternate hypothesis. When used, the
null hypothesis is presumed true until
statistical evidence in the form of a
hypothesis test indicates otherwise.
7
Null Hypothesis: H0
 Statement about value of population
parameter like m, p or s
 Must contain condition of equality
 =, , or 
 Test the Null Hypothesis directly
 Reject H0 or fail to reject H0
8
Alternative Hypothesis: H1
 Must be true if H0 is false
 , <, >
 ‘opposite’ of Null

Ha sometimes used instead of H1
9
Note about Forming Your Own Claims
(Hypotheses)
• If you are conducting a study and want to
use a hypothesis test to support your
claim, the claim must be worded so that it
becomes the alternative hypothesis.
• The null hypothesis must contain the
condition of equality
10
Examples
Set up the null and alternative hypothesis
1. The packaging on a lightbulb states that the
bulb will last 500 hours. A consumer
advocate would like to know if the mean
lifetime of a bulb is different than 500 hours.
2. A drug to lower blood pressure advertises
that it drops blood pressure by 20%. A
doctor that prescribes this medication
believes that it is less. Set up the null and
alternative hypothesis. (see hw # 1)
11
Test Statistic
a value computed from the sample data that is
used in making the decision about the
rejection of the null hypothesis
Testing claims about the population proportion
Z* =
x-µ
σ
n
12
• Critical Region - Set of all values of the test
statistic that would cause a rejection of the null
hypothesis
• Critical Value - Value or values that separate
the critical region from the values of the test
statistics that do not lead to a rejection of the
null hypothesis
13
Critical Region and Critical
Value
One Tailed Test
Critical
Region
Critical Value
( z score )
14
Critical Region and Critical
Value
One Tailed Test
Critical
Region
Critical Value
( z score )
15
Critical Region and Critical
Value
Two Tailed Test
Critical
Regions
Critical Value
( z score )
Critical Value
( z score )
16
Significance Level
 Denoted by 
 The probability that the test
statistic will fall in the critical
region when the null hypothesis is
actually true.
 Common choices are 0.05, 0.01,
and 0.10
17
Two-tailed,Right-tailed,
Left-tailed Tests
The tails in a distribution are the
extreme regions bounded
by critical values.
18
Two-tailed Test
H0: µ = 100
 is divided equally between
the two tails of the critical
region
H1: µ  100
Means less than or greater than
Reject H0
Fail to reject H0
Reject H0
100
Values that differ significantly from 100
19
Right-tailed Test
H0: µ  100
H1: µ > 100
Points Right
Fail to reject H0
100
Reject H0
Values that
differ significantly
from 100
20
Left-tailed Test
H0: µ  100
H1: µ < 100
Points Left
Reject H0
Values that
differ significantly
from 100
Fail to reject H0
100
21
Conclusions
in Hypothesis Testing
1. Traditional Method

Reject H0 if the test statistic falls in the critical region

Fail to reject H0 if the test statistic does not fall in the critical
region
2. P-Value Method

Reject H0 if the P-value is less than or equal 

Fail to reject H0 if the P-value is greater than the 
22
P-Value Method
of Testing Hypotheses
Finds the probability (P-value) of getting a
result and rejects the null hypothesis if
that probability is very low
Uses test statistic to find the probability.
Method used by most computer programs
and calculators.
Will prefer that you use the traditional
method on HW and Tests
23
Finding P-values
Two tailed test
 p(z>a) + p(z<-a)
One tailed test (right)
Where “a” is the
value of the
calculated test
statistic
 p(z>a)
One tailed test (left)
 p(z<-a)
Used for HW # 3 – 5 – see example on next two slides
24
Determine P-value
Sample data:
x = 105
or
z* = 2.66
Fail to Reject
H0: µ = 100
Reject
H0: µ = 100
*
µ = 73.4
z = 1.96
or z = 0
z* = 2.66
Just find p(z > 2.66)
25
Determine P-value
Sample data:
x = 105
or
z* = 2.66
Reject
H0: µ = 100
Fail to Reject
H0: µ = 100
Reject
H0: µ = 100
*
z = - 1.96
µ = 73.4
z = 1.96
or z = 0
z* = 2.66
Just find p(z > 2.66) + p(z < -2.66)
26
Conclusions
in Hypothesis Testing
Always test the null hypothesis
Choose one of two possible conclusions
1. Reject the H0
2. Fail to reject the H0
27
Accept versus Fail to Reject
Never “accept the null hypothesis, we
will fail to reject it.
 Will discuss this in more detail in a moment
We are not proving the null hypothesis
Sample evidence is not strong enough
to warrant rejection (such as not
enough evidence to convict a suspect –
guilty vs. not guilty)
28
Accept versus Fail to Reject
Justice System - Trial
Defendant
Innocent
Defendant
Guilty
Reject
Presumption of
Innocence
(Guilty Verdict)
Error
Correct
Fail to Reject
Presumption of
Innocence (Not
Guilty Verdict)
Correct
Error
29
Conclusions
in Hypothesis Testing
Need to formulate correct wording of final
conclusion
30
Conclusions
in Hypothesis Testing
 Wording of final conclusion
1. Reject the H0
Conclusion: There is sufficient evidence to
conclude……………………… (what ever H1 says)
2. Fail to reject the H0
Conclusion: There is not sufficient evidence to
conclude ……………………(what ever H1 says)
31
Example
State a conclusion
1. The proportion of college graduates
how smoke is less than 27%. Reject
Ho:
2. The mean weights of men at FLC is
different from 180 lbs. Fail to Reject
Ho:
Used for #6 on HW
32
Type I Error
The mistake of rejecting the null hypothesis
when it is true.
 (alpha) is used to represent the probability
of a type I error
Example: Rejecting a claim that the mean
body temperature is 98.6 degrees when the
mean really does equal 98.6 (test question)
33
Type II Error
the mistake of failing to reject the null
hypothesis when it is false.
ß (beta) is used to represent the probability of
a type II error
Example: Failing to reject the claim that the
mean body temperature is 98.6 degrees when
the mean is really different from 98.6 (test
question)
34
Type I and Type II Errors
True State of Nature
H0 True
Reject H0
Decision
Fail to
Reject H0
H0 False
Type I error

Correct
decision
Correct
decision
Type II error

In this class we will focus on controlling a Type I
error. However, you will have one question on the
exam asking you to differentiate between the two.
35
Type I and Type II Errors
 = p(rejecting a true null hypothesis)
 = p(failing to reject a false null
hypothesis)
n,  and  are all related
36
Example
Identify the type I and type II error.
The mean IQ of statistics teachers is
greater than 120.
Type I: We reject the mean IQ of statistics teachers
is 120 when it really is 120.
Type II: We fail to reject the mean IQ of statistics
teachers is 120 when it really isn’t 120.
37
Controlling Type I and Type II Errors
For any fixed sample size n , as 
decreases,  increases and conversely.
To decrease both  and , increase the
sample size.
38
Definition
Power of a Hypothesis Test
is the probability (1 -  ) of rejecting a
false null hypothesis.
Note: No exam questions on this. Usually covered in a
more advanced class in statistics.
39
7-2
Testing a claim about
the mean
(large samples)
40
Traditional (or Classical) Method of
Testing Hypotheses
Goal
Identify a sample result that is significantly
different from the claimed value
By
Comparing the test statistic to the critical
value
41
Traditional (or Classical) Method of Testing Hypotheses
(MAKE SURE THIS IS IN YOUR NOTES)
1.
Determine H0 and H1. (and  if necessary)
2.
Determine the correct test statistic and calculate.
3.
Determine the critical values, the critical region and sketch a
graph.
4.
Determine Reject H0 or Fail to reject H0
5.
State your conclusion in simple non technical terms.
42
Test Statistic for Testing a Claim
about a Proportion
Can Use
Traditional method
Or
P-value method
43
Three Methods Discussed
1) Traditional method
2) P-value method
3) Confidence intervals
44
Assumptions
for testing claims about population means
1) The sample is a random sample.
2) The sample is large (n > 30).
a) Central limit theorem applies
b) Can use normal distribution
3) If s is unknown, we can use sample
standard deviation s as estimate for s.
45
Test Statistic for Claims about µ
when n > 30
Z* =
x - µx
s
n
46
Decision Criterion
Reject the null hypothesis if the test
statistic is in the critical region
Fail to reject the null hypothesis if the test
statistic is not in the critical region
47
Example: A newspaper article noted that the mean life span for
35 male symphony conductors was 73.4 years, in contrast to the mean
of 69.5 years for males in the general population. Test the claim that
there is a difference. Assume a standard deviation of 8.7 years.
Choose your own significance level.
Step 1: Set up Claim, H0, H1
Claim: m = 69.5 years
H0 : m = 69.5
H1 : m  69.5
Select if necessary  level:

= 0.05
48
Step 2: Identify the test statistic
and calculate
z* = x - µ =
s n
73.4 – 69.5
8.7
35
= 2.65
49
Step 3: Determine critical region(s) and
critical value(s) & Sketch
 = 0.05
/2 = 0.025 (two tailed test)
0.4750
0.4750
0.025
z = - 1.96
0.025
1.96
Critical Values - Calculator
50
Step 4: Determine reject or fail to reject H0:
Sample data:
x = 73.4
or
z = 2.66
Reject
H0: µ = 69.5
Fail to Reject
H0: µ = 69.5
Reject
H0: µ = 69.5
*
z = - 1.96
µ = 73.4
z = 1.96
or z = 0
P-value = P(z > 2.66) x 2 = .0078
z = 2.66
REJECT H0
51
Step 5: Restate in simple nontechnical terms
Claim: m = 69.5 years
REJECT H0 : m = 69.5
H1 : m  69.5
1)
There is sufficient evident to conclude that the mean
life span of symphony conductors is different from the
general population.
OR
2) There is sufficient evidence to conclude that mean life
span of symphony conductors is different from 69.5
years.
52
TI-83 Calculator
Hypothesis Test using z (large sample)
1. Press STAT
2. Cursor to TESTS
3. Choose ZTest
4. Choose Input: STATS
5. Enter σ and x and two tail, right tail or left tail
6. Cursor to calculate or draw
*If your input is raw data, then input your raw data in
L1 then use DATA
53
Testing Claims with
Confidence Intervals
• We reject a claim that the population
parameter has a value that is not included in
the confidence interval
• Typically only used for two-tailed tests
• For one-tailed test the degree of confidence
would be 1 – 2 (don’t worry about this)
54
Testing Claims
with Confidence Intervals
Claim: mean age = 69.5 years,
where n = 35, x = 73.4 and s = 8.7
 95% confidence interval of 35 conductors (that is,
95% of samples would contain true value µ )
 70.5 < µ < 76.3
 69.5 is not in this interval
 Therefore it is very unlikely that µ = 69.5
 Thus we reject claim µ = 69.5 (same conclusion as
previously stated)
55
7- 3
Testing a claim about
the mean
(small samples)
56
Assumptions
for testing claims about population means
(student t distribution)
1) The sample is a random sample.
2) The sample is small (n  30).
3) The value of the population standard deviation
s is unknown.
4) population is approximately normal.
57
Test Statistic
for a Student t-distribution
x -µx
t* = s
n
Critical Values
Found in Table A-3
Degrees of freedom (df) = n -1
Critical t values to the left of the mean are
negative
58
Choosing between the Normal and Student
t-Distributions when Testing a Claim about a Population Mean µ
Start
Use normal distribution with
Is
n > 30
?
Z
Yes
(If s is unknown use s instead.)
No
Is the
distribution of
the population essentially
normal ? (Use a
histogram.)
x - µx
s/ n
No
Yes
Is s
known
?
No
Use nonparametric methods,
which don’t require a normal
distribution.
Use normal distribution with
Z
x - µx
s/ n
(This case is rare.)
Use the Student t distribution
with
x - µx
t  s/
n
59
Easier Decision Tree
1. Use z if
s known or n is large
2. Use t if
s is unknown and n is small and
population is approximately normal
MAKE SURE THIS IS IN YOUR NOTES
60
P-Value Method
Table A-3 includes only selected values
of 
Specific P-values usually cannot be
found from table
Use Table to identify limits that contain
the P-value – very confusing
Some calculators and computer
programs will find exact P-values
61
TI-83 Calculator
Hypothesis Test using t (small sample)
1. Press STAT
2. Cursor to TESTS
3. Choose TTest
4. Choose Input: STATS
5. Enter s and x and two tail, right tail or left tail
6. Cursor to calculate or draw
*If your input is raw data, then input your raw data in
L1 then use DATA
62
Example
Sample statistics of GPA include n=20,
x=2.35 and s=.7
1. Test the claim that the GPA is greater
than 2.0
a.
Use traditional method
b.
Use Calculator
2. Find exact p-value (see excel – TDIST
function)
63
7-4
Testing a claim about a
proportion
64
Assumptions
for testing claims about population proportions
1) The sample observations are a random
sample.
2) The conditions for a binomial experiment are
satisfied
3) If np  5 and nq  5 are satisfied we
•
Use normal distribution to approximate binomial
with µ = np and s = npq
65
Notation
n = number of trials

p = x/n (sample proportion)
p = population proportion (used in the
null hypothesis)
q=1-p
66
Test Statistic for Testing a Claim
about a Proportion

p
p
* =
pq
n
z
67

p sometimes is given directly
“10% of the observed sports cars are red”
is expressed as

p = 0.10

p sometimes must be calculated
“96 surveyed households have cable TV
and 54 do not” is calculated using

p
x
96
=n =
= 0.64
(96+54)
(determining the sample proportion of households with cable TV)
68
CAUTION

 When the calculation of p results in a
decimal with many places, store the
number on your calculator and use all
the decimals when evaluating the z test
statistic.

 Large errors can result from rounding p
too much.
69
Test Statistic for Testing a Claim
about a Proportion
Z* =
x-µ
z = s =

p-p
pq
n
x - np
npq
=
x
n
np
n
npq
n

=
p-p
pq
n
70
TI-83 Calculator
Hypothesis Test using z (proportions)
1. Press STAT
2. Cursor to TESTS
3. Choose 1-PropZTest
4. Enter x and n and two tail, right tail or left tail
5. Cursor to calculate or draw
71