Anda di halaman 1dari 76

Week 12 & 13: Chapter 8

Hypothesis Testing

C
h
a
p
t
e
r

Tests of Hypotheses
Section 8.1: The Elements of a Test of Hypotheses
Section 8.2: Formulating Hypotheses and Setting Up the
rejection Region
Section 8.3: Test of Hypothesis about a Population Mean:
Normal (z) Statistic
Section 8.4: Observed Significance Levels: p-Values
Section 8.5: Test of a Hypothesis about a Population Mean:
Students t-Statistic
Section 8.6: Large-Sample Test of a Hypothesis about a
Population Proportion

8
2

C
h
a
p
t
e
r

Hypotheses
Hypothesis:
A hypothesis is a statement that something is true.
Example: The statement the mean weight of all bags of
pretzels packaged differs from the advertised weights of
454 grams is a hypothesis.

Statistical Hypothesis:
A statistical hypothesis is a conjecture about a population
parameter.
Hypotheses are always in terms of the parameter (eg., , ,
etc. ) NOT the statistic (eg. x , p , etc.)

C
h
a
p
t
e
r

Terminology
Null Hypothesis ( )

The hypothesis to be tested

If the original claim includes equality (, =, ), it is the


null hypothesis.

If the original claim does not include equality (<, , >),


then the null hypothesis is the complement of the
original claim.

The null hypothesis always includes the equal sign.

8
4

C
h
a
p
t
e
r

Terminology
Alternative Hypothesis ( or .)

A statement which is true if the null hypothesis is false.

Determines the type of test used (left-tail, right-tail, or


two-tail)

Also called research hypothesis.

8
5

C
h
a
p
t
e
r

The form of a Null Hypothesis


The form of a null hypothesis is:

0 : =
(. . 0 : = 21)
where the hypothesized value is a specific number
determined by the problem context.

The alternative hypothesis will have one of the


following forms:

: >
(e. g. : > 21 )

: <
(. . : < 21 )

:
(. . : 21 )
6

C
h
a
p
t
e
r

The form of a Null Hypothesis


The null hypothesis
is usually stated as
an equality

0: = 0

: < 0

: 0

: > 0

the alternative is an inequality.

8
7

C
h
a
p
t
e
r

Identifying Hypotheses
Accidents Involving Teen Drivers

Teenagers (age 15 to 20) make up 7% of the driving


population

14% of accidents studied involved teenage drivers


Does the study provide convincing
evidence that the proportion of
accidents involving teenage drivers
differs from .07, the proportion of
teens in the driving population?
Use = .05.

C
h
a
p
t
e
r

Identifying Hypotheses
Accidents Involving Teen Drivers
Let p represent the proportion of accidents involving teenage
drivers.

0 : = 0.07; the proportion of accidents involving teenage


drivers is equal to the proportion of teens in the driving
population.

: 0.07; the proportion of


accidents involving teenage
drivers is not equal to the
proportion of teens in the
driving population.

8
9

C
h
a
p
t
e
r

Identifying Hypotheses
Cholesterol in Children
Cholesterol levels in children is normally distributed
=15
= 190

A sample of 100 children yields


sample mean cholesterol of 196.2.
Do these children have mean
cholesterol levels higher than the
national average at a significance
level of = 0.01?

10

C
h
a
p
t
e
r

Identifying Hypotheses
Cholesterol in Children

0 = 190; the average cholesterol level of children is


equal to the average cholesterol level of the nations
population.

> 190; the average cholesterol level of children is


higher than the average cholesterol level of the nations
population.

8
11

C
h
a
p
t
e
r

Statistical Test
A statistical test is:
a. Left-tailed if 1 states that
the parameter is less than
the value claimed in 0
b. Right-tailed if 1 states that
the parameter is greater
than the value claimed in 0
c. Two-tailed if 1 states that
the parameter is different
from (or not equal to) the
value claimed in 0
12

C
h
a
p
t
e
r

Scenarios for the Null and


Alternative Hypotheses
Null Hypothesis

Alternative Hypotheses & Type of Test

Claim about or
historical value of

You believe that


is less than the
value stated in 0

You believe that


is more than
the value stated
in 0

You believe that


is different
from the value
stated in 0

: = 0

1 : < 0

1 : > 0

1 : 0

Left-tailed test

Right-tailed test

Two-tailed test

8
13

C
h
a
p
t
e
r

Test Statistic
If the test statistic has
a high probability when
0 is true, then 0 is
not rejected.

If the test statistic has


a (very) low probability
when 0 is true, then
0 is rejected.
14

C
h
a
p
t
e
r

Errors in Hypothesis Testing


A Jury Trial

Null hypothesis: Defendant is innocent.

Alternative hypothesis: Defendant is guilty

8
15

C
h
a
p
t
e
r

Courtroom Analogy
Potential Choices and Errors

Choice 1: We cannot rule out that defendant is


innocent, so he or she is set free without penalty.
Potential error: A criminal has been erroneously freed.

Choice 2: We believe enough


evidence to conclude the
defendant is guilty.
Potential error: An innocent
person is falsely convicted and
guilty party remains free.

16

C
h
a
p
t
e
r
8

Courtroom Analogy

Each trial actually has 4 potential decisions two are


correct decisions, two are errors.

Possible decisions are based on:


the evidence of the defendants innocence or guilt;
the decision that the jury makes based on the evidence
Defendant is Actually

Jurys
Decision

Innocent

Guilty

Not Guilty

Correct

Error

Guilty

Worse Error

Correct

17

C
h
a
p
t
e
r

Hypothesis Testing
The reasoning of Hypothesis Testing is Similar
Each test has 4 potential decisions two are
correct decisions, two are errors.
Possible decisions are based on:
the reality about the null hypothesis;
your decision based on the evidence from the sample.
Null Hypothesis is Actually

Your
Decision

True

False

Dont Reject
the Null

Correct

Type II Error

Reject the
Null

Type I Error

Correct

18

C
h
a
p
t
e
r

Type I & Type II Errors


Type I error:
We reject 0 when in fact 0 is true.
Type II error:
We fail to reject 0 when in fact 0 is false.

8
19

C
h
a
p
t
e
r

Errors and their Consequences


A current cancer treatment has a remission rate of
40%. Is the new treatment more eective?

0 = .4 . : > .4
Type I error: you conclude that the
new treatment is more eective
than the current treatment when it
really isnt.
Type II error: you conclude that the
new treatment is not more
eective than the current
treatment when it really is.
20

C
h
a
p
t
e
r

Steps to do Hypothesis Testing


1. Label the parameter
2. Formulate the null and alternative hypotheses
3. Identify the test statistic and explain why you would use it.
4. State the level of significance
5. Describe the rejection region
6. Calculate the test statistic
7. Decide whether or not to reject the null hypothesis
8. Provide a conclusion in the context of the problem and that
answers the original research question

21

Week 12 & 13: Chapter 8.3-8.4


z-tests and p-values

22

C
h
a
p
t
e
r

Tests of Hypotheses
Section 8.1: The Elements of a Test of Hypotheses
Section 8.2: Formulating Hypotheses and Setting Up the
Rejection Region
Section 8.3: Test of Hypothesis about a Population Mean:
Normal (z) Statistic
Section 8.4: Observed Significance Levels: p-Values
Section 8.5: Test of a Hypothesis about a Population Mean:
Students t-Statistic
Section 8.6: Large-Sample Test of a Hypothesis about a
Population Proportion

8
23

C
h
a
p
t
e
r

Steps to do Hypothesis Testing


1. Label the parameter
2. Formulate the null and alternative hypotheses
3. Identify the test and its conditions
4. State the level of significance
5. Describe the rejection region
6. Calculate the test statistic
7. Decide whether or not to reject the null hypothesis
8. Provide a conclusion in the context of the problem and that
answers the original research question

24

C
h
a
p
t
e
r

Procedure
Label the parameter:

Let be the population mean.

Formulate the Hypotheses:

Null Hypothesis
0 : = 0 , a specified value; (in words)

Alternative hypothesis
: > 0 , a specified value; (in words)

: < 0 , a specified value; (in words)


: 0 , a specified value; (in words)
25

C
h
a
p
t
e
r

Procedure
Identify the test and its conditions:

Test
Large sample z-test for

Conditions
A random sample is selected from the target population.
The sample size is large.

State the level of significance:

= ??? (usually given, if not choose =.05)

26

C
h
a
p
t
e
r

Procedure
Describe the rejection region:

> if upper tailed test (or : > 0 )


< if lower tailed test (or : < 0 )
< 2 > 2 if two-tailed test (or : 0 )

Rejection regions for common values of for large sample


-test
Lower
Tailed

Upper
Tailed

Two tailed

= .10

z - 1.28

z > 1.28

z-1.645 or z > 1.645

= .05

z - 1.645

z > 1.645

z -1.96 or z > 1.96

= .01

z - 2.33

z > 2.33

z-2.575 or z > 2.575


27

C
h
a
p
t
e
r

Rejection Regions
Example
=.05 (Upper Tailed Test)

=.01 (Two Tailed Test)

8
28

C
h
a
p
t
e
r

Procedure
Calculate the test statistic:
x 0 x 0
zcal

x
/ n

Provide the decision and conclusion:

If the calculated value of the proposed test


statistic belongs to the rejection region, we reject
0 ; otherwise we fail to reject 0 .

Write the conclusion in the context.


29

C
h
a
p
t
e
r

How to write the conclusion?


Conclusions are based on the original claim, which
may be the null or alternative hypotheses.
Original Claim
Decision

H0
Reject

Ha
Support

Reject H0
sufficient

We conclude that there is


sufficient evidence at %
level of significance to
reject the claim that

We conclude that there is


sufficient evidence at %
level of significance to
support the claim that

Fail to reject H0
insufficient

We conclude that there is


insufficient evidence at %
level of significance to
reject the claim that

We conclude that there is


insufficient evidence at %
level of significance to
support the claim that

30

C
h
a
p
t
e
r

Example: Response Time

n=100 rats
Sample mean = 1.05 seconds
Standard deviation = .5 second
Control mean = 1.2 seconds

Does the mean response


time for drug-injected rats
differ from 1.2 seconds at
= .01.

31

C
h
a
p
t
e
r

Example: Response Time


Label the parameter:

Let represent the mean response time for druginjected rats.

Hypotheses:

: = 1.2; that is, mean response time is 1.2


seconds.
: 1.2; that is, mean response time less than
1.2 or greater than 1.2 seconds.

8
32

C
h
a
p
t
e
r

Example: Response Time


Test:
We will perform a large sample z-test for the mean
response time for drug-injected rats.
Conditions:
Assume that 100 rats are selected randomly.

The sample size n=100 is large.

8
33

C
h
a
p
t
e
r

Example: Response Time


Level of Significance:
= 0.01
Rejection Region:
< 2.575 > 2.575

Calculation of test statistic:

zcal

x 0

x 0 1.05 1.2

3.0
/ n .5 / 100
34

C
h
a
p
t
e
r

Example: Response Time


Decision and Conclusion:

Since = 3.0 is less than 2.572 we


reject the null hypothesis.

Conclusion ???

35

C
h
a
p
t
e
r

How to write the conclusion


Conclusions are based on the original claim, which
may be the null or alternative hypotheses.
Original Claim
Decision

0
Reject

Support

Reject 0
sufficient

We conclude that there is


sufficient evidence at %
level of significance to
reject the claim that

We conclude that there is


sufficient evidence at % level
of significance to support the
claim that

Fail to reject 0
insufficient

We conclude that there is


insufficient evidence at %
level of significance to
reject the claim that

We conclude that there is


insufficient evidence at %
level of significance to support
the claim that

36

C
h
a
p
t
e
r

Example: Response Time


Decision and Conclusion:

Since = 3.0 is less than 2.572 we reject


the null hypothesis.

We conclude that there is sufficient evidence at


1% level of significance to support the claim that
the mean response time for drug-injected rats
differ from the control mean of 1.2 seconds.
37

C
h
a
p
t
e
r

Example: Internet Use

n=676 parents of Canadian teens


Sample mean = 6.5
Sample standard deviation = 8.6
Do the sample data
provide convincing
evidence that the mean
number of hours that
parents think their teens
spend online is less than
10 hours per week at
=.05?
38

C
h
a
p
t
e
r

Example: Internet Use


Label the parameter:
Let = mean number of hours per week that
parents think their Canadian teens spend online.

Hypotheses:

: = 10 ; the mean number of hours that


parents think their teens spend online is equal to
10 hours per week.
: < 10 ; the mean number of hours that
parents think their teens spend online is less than
10 hours per week.
39

C
h
a
p
t
e
r

Example: Internet Use


Test:
We will perform a large sample z-test for the mean
number of hours per week that parents think their
Canadian teens spend online.
Conditions:
It is reported that a sample of 676 parents of
Canadian teens were selected randomly.
The sample size n=676 is large.

8
40

C
h
a
p
t
e
r

Example: Internet Use


Level of Significance:
= 0.05
Rejection Region:
< 1.645
Calculation of test statistic:

We are given: = 676, = 6.5, = 8.6

zcal

x 0

x 0
6.5 10

10.58
/ n 8.6 / 676
41

C
h
a
p
t
e
r

Example: Internet Use


Decision and Conclusion:
Since = 10.58 is less than 1.645, that is,
= 10.58 belongs to the rejection region, so
we reject the null hypothesis.

We conclude that there is sufficient evidence at


5% level of significance to support the claim that
the mean number of hours that parents think their
teens spend online is less than 10 hours per
week.

42

C
h
a
p
t
e
r

Terminology
The -Value (Short for Probability value)
The probability of obtaining a test statistic from the
sampling distribution that is as extreme or more extreme (as
specified by ) than the observed test statistic (computed
from the sample data) under the assumption that 0 is true.
Calculated instead of the rejection region
Decision based on the -value

8
43

C
h
a
p
t
e
r

Determining the -value when


the test statistic is normal
Upper-tailed test:

: > 0 (hypothesized value)

8
44

C
h
a
p
t
e
r

Determining the -value when


the test statistic is normal
Lower-tailed test:

: < 0 (hypothesized value)


P-value = area in lower tail = P(z zcal)

8
45

C
h
a
p
t
e
r

Determining the -value when


the test statistic is normal
Two-tailed test:

: 0 (hypothesized value)
P-value = sum of area in two tails
= P(z - zcal or z zcal) = 2 P(z | zcal |)

8
46

C
h
a
p
t
e
r

Decision rules based on the -value

If the p-value < , we reject 0

If the p-value , we do not reject 0

8
47

Week 12 & 13: Chapter 8.5


t-test for a Population Mean

48

C
h
a
p
t
e
r

Tests of Hypotheses
Section 8.1: The Elements of a Test of Hypotheses
Section 8.2: Formulating Hypotheses and Setting Up the
Rejection Region
Section 8.3: Test of Hypothesis about a Population Mean:
Normal (z) Statistic
Section 8.4: Observed Significance Levels: p-Values
Section 8.5: Test of a Hypothesis about a Population Mean:
Students t-Statistic
Section 8.6: Large-Sample Test of a Hypothesis about a
Population Proportion

8
49

C
h
a
p
t
e
r

Using a t-test for hypothesis testing


Label the parameter
Let be the population mean.

Hypotheses
Null Hypothesis
0 : = 0 a specified value; (in words)
Alternative Hypothesis
: > 0 a specified value; (in words)
: < 0 a specified value; (in words)

: 0 a specified value; (in words)

50

C
h
a
p
t
e
r

Using a t-test for hypothesis testing


Test
We will perform a small sample t-test for the population
mean.

Required Conditions
The sample was randomly selected from the population of
interest or there is some other indication that it was
representative (implying randomness).
The original population is known to be normal.
Population standard deviation () is unknown.

Sample size is small.

51

C
h
a
p
t
e
r

Using a t-test for hypothesis testing


Level of Significance
=? ? ? (usually given, if not choose = .05)

Rejection Region
> if upper tailed test (or : > 0 )
< if lower tailed test (or : < 0 )
<

>

if two-tailed test (or : 0 )

Calculation of test statistic


x 0
tcal

s/ n

~ t( n 1) df

52

C
h
a
p
t
e
r

Using a t-test for hypothesis testing


Decision and conclusion
If the calculated value of the proposed test statistic belongs
to the rejection region, we reject H0; otherwise we fail to
reject H0.
Write the conclusion in the context.

8
53

C
h
a
p
t
e
r

Finding -Values for a Test

: >

2. Lower-tailed test

: <

3. Two-tailed test

= P (t > tcal)

1. Upper-tailed test

= P (t < tcal)

= 2 *P (t > |tcal|)

Decision Rule
If < , we reject 0
54

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


A random sample of 10 bags of Dogspal dog food:
37.25

38.25

40.10

40.50

41.25

39.45

37.00

39.25

38.00

40.75

Conduct a test of significance


to test the claim that Dogspal
40lb bags have less than 40.5
pounds of dog food in their
bags at a significance level of
=.05
55

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


1.

Label the parameter

2.

Formulate the hypotheses

3.

Identify the test and its conditions

4.

State the level of significance

5.

Describe the rejection region

6.

Calculate the test statistic

7.

State the decision and


conclusion

8
56

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


1. Label the target parameter
, the true mean weight of 40 lb bags

2. State the hypotheses:


o

0 : = 40.5; the mean of all 40 pound bags from


Dogspal is 40.5 pounds, as stated by the company.

: < 40.5; the mean of all 40 pound bags from


Dogspal is less than the 40.5 pounds stated by the
company.

8
57

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


3. State the test
o We will perform a one sample t- test for the population
mean.

4. Verify the required conditions:


We are told that the sample of 10 was a random
sample.
The distribution of weights packaged by Dogspal is
normal based on the boxplot we saw in Chapter 7.
? The standard deviation of weights packaged by Dogspal
is unknown.
Sample size n=10, is small.
58

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


5. State the level of
significance
o = 0.05

6. Define the rejection


region:
o < 1.833

7. Calculate the test statistic:


We are given:
= 10
= 39.18
= 1.4963

df n 1 10 1 9

tcal

x 0 39.18 40.5

2.79
s / n 1.4963 / 10
59

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


P-value
p-value = area of t-curve under 9 df to the left of -2.79
= area of t-curve under 9 df to the right of 2.79
=?

OR
p-value = < 2.79 = > 2.79 = ?

8
60

C
h
a
p
t
e
r

.010 p-value .025

8
2.79

61

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


P-value
p-value = area of t-curve under 9 df to the left of -2.79
= area of t-curve under 9 df to the right of 2.79
= . < <.

OR
p-value = < 2.79 = > 2.79 = . < <.

8
62

C
h
a
p
t
e
r

Example: 40lb bags of Dog Food


Decision and Conclusion
Decision Using Rejection Region
Since = 2.79 is less than 1.833 so we reject the null
hypothesis.

Decision Using p-value


We get .01 < < .025, that is, p-value is between .01
and .025, not inclusive.
Since < = .05, so we reject the null hypothesis.

We conclude that there is sufficient evidence at 5% level of


significance to support the claim that the mean of all 40
pound bags from Dogspal is less than the 40.5 pounds
stated by the company.
63

Week 12 & 13: Chapter 8.6


Large-Sample Test for a Population Proportion

64

C
h
a
p
t
e
r

Tests of Hypotheses
Section 8.1: The Elements of a Test of Hypotheses
Section 8.2: Formulating Hypotheses and Setting Up the
Rejection Region
Section 8.3: Test of Hypothesis about a Population Mean:
Normal (z) Statistic
Section 8.4: Observed Significance Levels: p-Values
Section 8.5: Test of a Hypothesis about a Population Mean:
Students t-Statistic
Section 8.6: Large-Sample Test of a Hypothesis about a
Population Proportion

8
65

C
h
a
p
t
e
r

Using a Large-Sample z-Test


Label the parameter
Let be the proportion of success.

Hypotheses
Null Hypothesis
0 : = 0 a specified value; (in words)
Alternative Hypothesis
: > 0 a specified value; (in words)
: < 0 a specified value; (in words)

: 0 a specified value; (in words)

66

C
h
a
p
t
e
r

Using a Large-Sample z-Test


Test
We will perform a large sample z-test for the population
proportion (p).

Required Conditions
o Random sample
o The sample size is large
(0 15, and (1 0 ) 15)
Verification of these assumptions makes it reasonable to
assume the approximate normality of the sampling distribution
of sample proportion,. Therefore, we can perform the z-test.

67

C
h
a
p
t
e
r

Using a Large-Sample z-Test


Level of Significance
=? (usually given, if not choose = .05)

Rejection Region
> if upper tailed test (or : > 0 )
< if lower tailed test (or : < 0 )
<

>

if two-tailed test (or : 0 )

Calculation of test statistic


zcal

p p0
N (0,1)
p0 (1 p0 )
n

68

C
h
a
p
t
e
r

Using a Large-Sample z-Test


Decision and conclusion
If the calculated value of the proposed test statistic belongs
to the rejection region, we reject 0 ; otherwise we fail to
reject 0 .
Write the conclusion in the context.

8
69

C
h
a
p
t
e
r

Determination of the -Value when


the test statistic is
Upper-tailed test
o : >

Lower-tailed test

= P (z > zcal)

= P (z < zcal)

o : <

Two-tailed test
o :

= 2 *P (z > |zcal |)

Decision Rule
If < , we reject 0
70

C
h
a
p
t
e
r

Example: Auto Accidents


Teenagers = 7% of the driving population
In a study of accidents:
n = 500 randomly selected accidents
Teenagers involved in sampled accidents = 14%

Does the study provide convincing


evidence that the proportion of
accidents involving teenage
drivers differs from .07, the
proportion of teens in the driving
population? Use =.05.
71

C
h
a
p
t
e
r

Example: Auto Accidents


Label the parameter:
Let represent the proportion of accidents involving
teenage drivers.

Hypotheses:
o 0 : = 0.07; the proportion of accidents involving
teenage drivers is equal to the proportion of teens in the
driving population.
o : 0.07; the proportion of accidents involving
teenage drivers is not equal to the proportion of teens in
the driving population.

8
72

C
h
a
p
t
e
r

Example: Auto Accidents


Test:
We will perform a large sample -test for the population
proportion ().

Conditions:
o The sample was a random sample of all accidents.
o 0 = 500 0.07 = 35 > 15, and
o 1 0 = 500 0.93 = 465 > 15

8
73

C
h
a
p
t
e
r

Example: Auto Accidents


Level of significance
We are given, = .05

Rejection Region
< 1.96 or > 1.96

Calculation of test statistic


zcal

p p0

p0 (1 p0 )
n

.14 .07
6.13
.07 (1 .07 )
500

74

C
h
a
p
t
e
r

Example: Auto Accidents


P-value
= 2 (area under the z-curve to the right of 6.13)
20=0

OR
= 2 ( > )
= 2 > 6.13
20
=0

75

C
h
a
p
t
e
r

Example: Auto Accidents


Decision and Conclusion
Decision Using Rejection Region
Since = 6.13 is greater than 1.96 so we reject the
null hypothesis.

Decision Using p-value


Since = 0 < = .05, so we reject the null
hypothesis.
We conclude that there is sufficient evidence at 5% level of
significance to support the claim that the proportion of all
accidents involving teenage drivers is different the proportion
of teens in the driving population.
76

Anda mungkin juga menyukai