Chapter 5 Hypothesis Testing. 5.1 - Introduction Definition 5.1.1 Hypothesis testing is a formal...

Preview:

Citation preview

Chapter 5 Hypothesis Testing

5.1 - Introduction

Definition 5.1.1 Hypothesis testing is a formal approach for determining if data from a sample support a claim about a population.

1. State the null and alternative hypotheses

2. Calculate the test statistic

3. Find the critical value (or calculate the P-value)

4. State the technical conclusion

5. State the final conclusion

The Process

Claim: More than half the students at a particular university are from out of state

Step 1: State the null and alternative hypotheses– Define the parameter

p = The proportion of all students at the university who are from out of state

– State the hypotheses

H0: p = 0.50 H1: p > 0.50

The Process

Step 2: Calculate the test statistic– For a claim about a single proportion

– sample proportion– sample size

– number in H0

0

0 0

ˆ

1 /

p pz

p p n

ˆ 0.621 and 95

0.621 0.

Supp

52.36

0.5 1 0

o

.

se

5 / 95

p n

z

The Process

Step 3: Find the critical value

– At the 95% confidence level,

0.05 1.645 [1.645, )z z

The Process

Step 4: State the technical conclusion– One of two statements:

Reject H0 or Do not reject H0

– Reject H0 if the test statistic falls into the critical region and do not reject H0 otherwise

– z = 2.36, critical region: [1.645, ∞)• Reject H0

The Process

Step 5: State the final conclusion

– The data support the claim

P-value Method

Criteria1. Reject H0 if P-value ≤ α

2. Do not reject H0 if P-value > α

P-value Method

5.2 – Testing Claims about a Proportion

1-Proportion Z-Test

Purpose: To test a claim about a single population proportion where the null hypothesis is of the form H0: p = p0. Let

– x be the number of “successes” in a sample of size n and

– be the sample proportion.

1-Proportion Z-Test

The test statistic is

The critical value is a z-score and the P-value is an area under the standard normal density curve.

0

0 0

ˆ

1 /

p pz

p p n

1-Proportion Z-Test

Requirements1. The sample is random

2. The conditions for a binomial distribution must be met (at least approximately)

3. The conditions and are both met

Example 5.2.1

A student claims that less than 25% of plain M&M candies are red. A random sample of 195 candies contains 37 red candies. Use this data to test the claim at the 0.05 significance level.

1. The parameter about which the claim is made is

p = The proportion of all M&M candies that are red

Example 5.2.1

2. The claim in mathematical notation is p < 0.25

H0: p = 0.25 H1: p < 0.25

3. The sample proportion is

4. The critical value is – The P-value is the area to the left of z = −1.93 which is

0.0268.

0

0 0

ˆ 0.190 0.251.93

1 / 0.25 1 0.25 /195

p pz

p p n

Example 5.2.1

5. Critical region: – z lies in this region– P-value

– Technical conclusion: Reject H0

6. Final conclusion: The data support the claim

Types of Errors

5.3 – Testing Claims about a Mean

T-Test for a Claim About a Single Population Mean

Purpose: To test a claim about the mean of a single population where the null hypothesis is of the form H0: , and a sample of size has a mean of and standard deviation The test statistic is

The critical value is a t-score with n − 1 degrees of freedom and the P-value is an area under the corresponding Student-t density curve.

0

/

xt

s n

T-Test

Requirements1. The sample is random

2. Either the population is normally distributed or n > 30

Example 5.3.3

A manufacturer of cheese claims that the mean weight of all its 12 oz packages of shredded cheddar is greater than 12 oz. They collect a random sample of n = 36 packages, weigh each, and calculate a sample mean of and a sample standard deviation of s = 0.15. Use this data to test the claim at the 0.05 significance level.

1. The parameter about which the claim is made is

μ = The mean weight of all 12 oz packages

Example 5.3.3

The claim in mathematical notation is µ > 12

H0: µ = 12 H1: µ > 12

2. The test statistic is

3. The critical value is – The P-value is the area to the right of t = 2 – By software: P-value = 0.027

0 12.05 122

/ 0.15 / 36

xt

s n

Example 5.3.3

4. Critical region: [1.690, ∞)– t lies in this region– P-value

– Technical conclusion: Reject H0

5. Final conclusion: The data support the claim

5.4 – Comparing Two Proportions

2-Proportion Z-Test

Purpose: To test a claim comparing proportions from two independent populations where the null hypothesis is of the form H0: . The test statistic is

sample sizes

numbesr of “successes”

sample proportions

1 2

1 2

ˆ ˆ

ˆ ˆ1 1 / 1/

p pz

p p n n

1 2

1 2

ˆx x

pn n

2-Proportion Z-Test

Requirements1. Both samples are random and independent

2. In both samples, the conditions for a binomial distribution are satisfied

3. In both samples, there are at least 5 successes and 5 failures

Example 5.4.1

In a survey of voters in the 2008 Texas Democrat primary, 54% of the 1167 females voted for Hillary Clinton while 47% of the 881 males voted for Clinton (data from www.CNNPolitics.com, March 5, 2008). Use this data to test the claim that of the voters in the 2008 Texas Democrat primary, the proportion of females who voted for Clinton is higher than the proportionof males who voted for Clinton.

Example 5.4.1

1. The parameters about which the claim is made areThe proportion of all females who voted for Clinton

The proportion of all males who voted for Clinton

The claim is

H0: H1:

2. Test statistic:

1 20.54(1167) 630 0.47 881 414

630 414ˆ 0.510

1167 881

x x

p

Example 5.4.1

3. Critical value: – P-value = area to the right of which is 0.0008

4. Critical region: [1.645, ∞)– Technical conclusion: Reject H0

5. Final conclusion: The data support the claim

0.54 0.47

3.140.510 1 0.510 1/1167 1/ 881

z

5.5 – Comparing Two Variances

F-Test

Purpose: To test a claim comparing the variances of two independent populations where the null hypothesis is of the form H0: . The test statistic is

2122

21

1 2

is the larger of the two sample variances

and are the sample size

e

s

wher

s

s

n

fs

n

F-Test

The critical value is an F-value with and degrees of freedom

Requirements1. Both samples are random and independent

2. Both populations are normally distributed (strict requirement)

Example 5.5.1

Among the subjects who followed

diet A, their mean weight loss was lb with a standard deviation of lb. Among the subjects who followed diet B, their mean weight loss was lb with a standard deviation of lb. Test the claim that the two populations have the same variance.

Example 5.5.1

1. The parameters about which the claim is made are

2. Test statistic:2

2

6.52.09

4.5f

21

22

2 21 2

2 2 2 20 1 2 1 21

The variance of the weight loss for all those on diet

The variance of the weight loss for all those on diet

The cl

:

aim is

:

A

B

H H

Example 5.5.1

3. Critical value: – P-value area to the right of – Using software: P-value = 0.288

4. Critical region: [4.03, ∞)– Technical conclusion: Do not reject H0

5. Final conclusion: There is not sufficient evidence to reject the claim

5.6 – Comparing Two Means

2-Sample T-Tests

Purpose: To test a claim regarding the means of two independent populations where the null hypothesis is of the form H0: .

– Select random and independent samples from each population

– Calculate the mean and variance of each sample

Equal Population Variances

Test statistic:

– Critical value: t-score with degrees of freedom – P-value is an area under the Student-t density

curve with this number of degrees of freedom.

1 2

1 2

2 21 1 2 2

1 2

1/ 1/

where

1 1

2

p

p

x x ct

s n n

n s n ss

n n

Unequal Population Variances

Test statistic:

The critical value is a t-score with r degrees of freedom where r is

If r is not an integer, then round it down to the nearest whole number

1 2

2 21 1 2 2/ /

x x ct

s n s n

22 21 2

1 22 22 2

1 2

1 1 2 2

1 11 1

s s

n nr

s s

n n n n

Requirements

1. Both samples are random

2. The samples are independent

3. Both populations are normally distributed or both sample sizes are greater than 30

Example 5.6.1

Among the subjects who followed

diet A, their mean weight loss was lb with a standard deviation of lb. Among the subjects who followed diet B, their mean weight loss was lb with a standard deviation of lb. Test the claim that the mean weight loss on diet A is higher than that on diet B.

Example 5.6.1

1. The parameters about which the claim is made are

2. Assume equal population variances. Test statistic:

(4.5 3.2) 0

5.59 1/10 1/100.52

t

1

2

1 2

0 1 212 1

The mean weight loss for all those on diet

The mean weight loss for all those on diet

The c

:

laim is

:

A

B

H H

2 210 1 6.5 10 1 4.5

10 10 25.59

ps

Example 5.6.1

3. Critical value: – P-value area to the right of – Using software: P-value = 0.305

4. Critical region: [1.734, ∞)– Technical conclusion: Do not reject H0

5. Final conclusion: The data do not support the claim

Paired T-Test

Purpose: To test the claim that a set of paired data come from a population in which the differences have a mean less than, greater than, or equal to 0.

1. Let denote the population mean of the differences.

2. The null hypothesis is H0:

3. Calculate the differences

4. Use the differences from step 3 and the T-test from Section 5.3 to test the claim.

Example 5.6.3

At a large university, freshman students are required to take an introduction to writing class. Students are given a survey on their attitudes toward writing at the beginning and end of the class. Each student receives a score between 0 and 100 (the higher the score, the more favorable his or her attitude toward writing). Test the claim that the scores improve from the beginning to the end.

Example 5.6.3

These data come in “matched pairs”– They are not independent–We cannot use a 2-sample T-test

If scores improve, then the differences (End – Beginning) would be positive–We test the claim

Example 5.6.3

1. State the hypotheses– population mean of (end beginning)

H0: H1:

2. Test statistic: Mean and standard deviation of sample differences:

3. Critical value: – P-value: Area to the right of 2.32 which is 0.025

3.256 02.32

4.215 / 9t

Example 5.6.3

4. Critical region: [1.860, ∞)– Reject H0

5. Final conclusion: The data support the claim

5.7 – Goodness-of-fit Test

Chi-square Goodness-of-fit Test

Purpose: To test the claim that a random variable X has some particular distribution.

1. Divide the range of X into k categories

2. Observe values of X and record frequencies of the categories,

3. Calculate expected frequencies of the categories,

4. Calculate the test statistic 2

1

ki i

i i

O Ec

E

Chi-square Goodness-of-fit Test

5. Critical value: – P-value = Area to the right of c under the density curve

6. If or P-value , then reject the claim that X has the claimed distribution

Requirements

1. The data have been randomly chosen

2. Each expected frequency is at least 5

Example 5.7.3

A student simulated dandelions in a lawn by randomly placing 300 dots on a piece of paper with an area of 100 in2. He then randomly chose 75 different 1 in2 sections of paper and counted the number of dots in each section.

Example 5.7.3

Let X = number of dots in a 1 in2 section– Claim: X has a Poisson distribution with

Let – If the claim were true, then, for instance

– Denote this number

133

( 1) 0.1491!

P X e

Example 5.7.3

Critical value:–

– Do not reject H0

Final conclusion: It is reasonable to assume that X has Poisson distribution with

0 0 1 6

1

: 0.050, 0.149, , 0.084

: At least one probabilit

Hypothese

y is not as claim d

s:

e

p p p H

H

5.8 – Test of Independence

Two students want to determine if their university men’s basketball team benefits from home-court advantage. They randomly select 205 games played by the team and record if each one was played at home or away and if the team won or lost (data collected by Emily Hudgins and Courtney Santistevan, 2009).

“Contingency Table”

Chi-square Test of Independence

Purpose: To test if the row events of a contingency table are independent of the column events. Let– total number of observations– number of rows– number of columns– sum of the i th row– sum of the j th column– frequency in the i th row and j th column

– H0: The rows are independent of the columns

Test of Independence

Test statistic:

Critical value: – P-value area to the right of

– Reject H0 if c.v.

Requirements1. The data in the table represent frequency counts and are

randomly selected

2. All expected frequencies are at least 5

2

1 1

where a b

ij ij i jij

i j ij

O E R Cc E

E n

Example

Critical value:

– Reject H0

Final Conclusion– The result is not independent of the location

5.9 – One-way ANOVA

A seed company plants four types of new corn seed on several plots of land and records the yield (in bushels/acre) of each plot as shown below. Test the claim that the four types of seed produce the same mean yield.

One-way ANOVA

Purpose: To test for equality of two or more populations means– Null hypothesis: H0:

– total number of data values– Test statistic

2 2

1 1

MS(treatment) where

MS(error)

1MS(treatment) and MS(error)

1

k k

i i i ii i

F

n x x n s

k N k

One-way ANOVA

Critical region: – P-value: area to the right of F under the F-distribution

density curve with k − 1 and N − k degrees of freedom

Requirements (“loose” requirements)

1. The populations are normally distributed

2. The populations have the same variance

3. The samples are random and independent

Definition: Treatment (or factor)– A characteristic that distinguishes the different populations

(or groups) from each other

Example 5.9.3

Let mean yield of Type A, etcH0: H1: At least one mean is different

2 2

2 2

3(64.75 66.07) 4(58.47 66.07)MS(treatment) 206.93

4 1

(3 1)4.60 (4 1)2.42MS(error) 15.55

14 4206.93

13.3115.55

F

Critical region

- Reject H0

Final conclusion: The data do not support the claim of equal means

5.10 – Two-way ANOVA

Randomized Block Design

A statistics professor is comparing four different delivery methods for her introduction to statistics class: face-to-face, online, hybrid, and video (called the treatments).

– She divides the population of students into three groups according to their overall GPA: high, middle, and low. (called blocks)

– She randomly chooses four students from each block and randomly assigns each one to a class using one of the delivery methods

– At the end of the semester she records each student’s overall grade

Two-way ANOVA

Two questions: 1. Do the four treatments have the same population

mean?

2. Do the blocks have any affect on the scores?

Two-way ANOVA

Parameters– ith treatment mean– jth “block effect” (a measure of the effect that

block i has on the score)

Null hypotheses

0 1 2

1 2

: (the treatment means are all the same)

: (the block effects are all the same)k

B b

H

H

ANOVA Table

P-value = 0.271 – Do not reject H0

– There is not a statistically significant difference between the treatment means

P-value = 0.008 – Reject HB

– There is a statistically significant difference in the block effects

Factorial Experiment

The statistics professors randomly chooses 16 students from each GPA level, randomly assigns four to each delivery method, and records their scores at the end of the semester.

Three questions: 1. Is there any difference between the population mean

scores of the delivery methods?

2. Does the GPA level affect the scores?

3. Does the interaction of the delivery method and GPA level affect the scores?

Factorial Experiment

• factorial experiment with 4 replications per treatment

• Factors– GPA (factor A)– Delivery Method (factor B)

• Levels– 3 levels of GPA– 4 levels of Delivery Method

Factorial Experiment

Factorial Experiment

Parameters– population mean of the jth delivery method– effect of the ith GPA level on the score– “interaction effect” of the ith GPA level on the jth

delivery method

Null hypotheses

1 2

1 2

11 12

: (the delivery methods all have the same mean)

: (the effects of the GPA levels are all the same)

: (the interaction effects are all the same)

B b

A a

AB ab

H

H

H

ANOVA Table

P-value = 0.176 – Do not reject HB

– There is not a statistically significant difference between the means of the delivery methods

P-value = 0.000 – Reject HA

– There is a statistically significant difference in the effects of the GPA levels

ANOVA Table

P-value = 0.004 – Reject HAB

– There is a statistically significant difference in the interaction effects

Overall– There is not a “best” method– Consider certain delivery methods to certain GPA levels