section 10.6

31
HAWKES LEARNING SYSTEMS Students Matter. Success Counts. Copyright © 2013 by Hawkes Learning Systems/Quant Systems, Section 10.6 Chi-Square Test for Goodness of Fit

Upload: paytah

Post on 25-Feb-2016

65 views

Category:

Documents


0 download

DESCRIPTION

Section 10.6. Chi-Square Test for Goodness of Fit. Objectives. Perform a chi-square test for goodness of fit. Chi-Square Test for Goodness of Fit . Null and Alternative Hypotheses for a Chi‑Square Test for Goodness of Fit - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Section 10.6

Chi-Square Test for Goodness of Fit

Page 2: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Objectives

o Perform a chi-square test for goodness of fit.

Page 3: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Null and Alternative Hypotheses for a Chi Square Test ‑for Goodness of Fit

When the theoretical probabilities for the various outcomes are all the same, the null and alternative hypotheses for a chi square test for goodness of fit are ‑as follows.

0 1 2: : There is some difference amongst the probabilities.

k

a

H p p pH

Page 4: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Null and Alternative Hypotheses for a Chi Square Test ‑for Goodness of Fit (cont.)

If the theoretical probabilities for the various outcomes are not all the same, each probability must be stated in the null hypothesis, so in that case, the hypotheses are as follows.

Page 5: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Null and Alternative Hypotheses for a Chi Square Test ‑for Goodness of Fit (cont.)

k is the number of possible outcomes for each trial.

0 1

2th

: probability of first outcome,probability of second outcome, ...,

probability of outcome: There is some difference from the stated probabilities.

k

a

H pp

p kH

Page 6: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Test Statistic for a Chi-Square Test for Goodness of Fit The test statistic for a chi square test for goodness of fit ‑is given by

where Oi is the observed frequency for the ith possible outcome and Ei is the expected frequency for the ith possible outcome.

22 i i

i

O EE

Page 7: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Degrees of Freedom in a Chi-Square Test for Goodness of Fit

In a chi square test for goodness of fit, the number of ‑degrees of freedom for the chi square distribution of ‑the test statistic is given by

df = k −1where k is the number of possible outcomes for each trial.

Page 8: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Chi-Square Test for Goodness of Fit

Rejection Region for a Chi Square Test for ‑Goodness of Fit

Reject the null hypothesis, H0, if:2 2

Page 9: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit

A local bank wants to evaluate the usage of its ATM. Currently the bank manager assumes that the ATM is used consistently throughout the week, including weekends. She decides to use statistical inference with a 0.05 level of significance to test a customer’s claim that the ATM is much busier on some days of the week than it is on other days. During a randomly selected week, the bank recorded the number of times the ATM was used on each day.

Page 10: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

ATM UsageNumber of Times Used

Monday 38Tuesday 33Wednesday 41Thursday 25Friday 22Saturday 38Sunday 45

The results are listed in the following table.

Page 11: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

SolutionStep 1: State the null and alternative hypotheses.

When stating the hypotheses to be tested, we take the null hypothesis to be that the

proportions of customers are the same for every day of the week.

0: The proportions of customers who use theATM do not vary by the day of the week.

: The proportions of customers who use theATM do vary by the day of the week.

a

H

H

Page 12: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Mathematically, we can write the null and alternative hypotheses as follows.

0 1 2 3 4 5 6 7: : There is some difference amongst the probabilities.a

H p p p p p p pH

Page 13: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Step 2: Determine which distribution to use for the test statistic, and state the level of significance.

We are looking to see whether the observed values of ATM usage match the expected values for ATM usage at the bank. Remember that we can safely assume that the necessary conditions

are met for examples in this section, so the chi square ‑test for goodness of fit is the appropriate choice for this scenario. Note that the level of significance given in the problem is = 0.05.

Page 14: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Step 3: Gather data and calculate the necessary sample statistics.

Before we begin to calculate the test statistic, let’s calculate the expected value for each day of the week. Since we are assuming that the number of times the ATM is used does not vary for each day, then the probability will be the same for every day, so the expected number of customers for each day of the week is

calculated as follows.

Page 15: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Note that n = 38 + 33 + 41 + 25 + 22 + 38 + 45 = 242 (the total number of times the ATM was used).

1242

7242

7

i iE np

Page 16: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Let’s calculate the 2-test statistic.

2 2 2 2

2 2

22

2

242 242 242 24238 33 41 257 7 7 7

242 242 242 2427 7 7 7

242 242 24222 38 457 7 7

242 242 2427 7 7

12.314

i i

i

O EE

Page 17: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Step 4: Draw a conclusion and interpret the decision.

The number of degrees of freedom for the chi square distribution for this test is ‑ df = 7 – 1 = 6, and = 0.05. Using the table, we find that the critical value is

20.050 12.592.

Page 18: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Page 19: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.30: Performing a Chi-Square Test for Goodness of Fit (cont.)

Comparing the test statistic to the critical value, we have 12.314 < 12.592 so and thus we must fail to reject the null hypothesis. In other words, at the 0.05 level of significance, there is not sufficient evidence to support the customer’s claim that the ATM is used significantly more on any particular day of the week.

2 20.050 ,

Page 20: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator‑

A local fast-food restaurant serves buffalo wings. The restaurant’s managers notice that they normally sell the following proportions of flavors for their wings: 20% Spicy Garlic, 50% Classic Medium, 10% Teriyaki, 10% Hot BBQ, and 10% Asian Zing. After running a campaign to promote their nontraditional specialty wings, they want to know if the campaign has made an impact. The results after 10 days are listed in the following table.

Page 21: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑

Is there sufficient evidence at the 0.05 level of significance to say that the promotional campaign has made any difference in the proportions of flavors sold?

Buffalo Wing Sales

Number SoldSpicy Garlic 251Classic Medium 630Teriyaki 115Hot BBQ 141Asian Zing 121

Page 22: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Solution Step 1: State the null and alternative hypotheses.

The null hypothesis here is that the proportions of the flavors sold are the same as they were before the promotional campaign and the

alternative is that they are different. To write this mathematically, we need to state the theoretical probabilities for the five different flavors sold.

Page 23: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Let p1, p2, p3, p4, and p5 be the probabilities for Spicy Garlic, Classic Medium, Teriyaki, Hot BBQ, and Asian Zing, respectively. Then we have the following.

Therefore, the null and alternative hypotheses are stated as follows.

1 2 3 4 50.20, 0.50, 0.10, 0.10, 0.10p p p p p

0 1 2 3 4 5: 0.20, 0.50, 0.10, 0.10, 0.10: There is some difference from the stated probabilities.a

H p p p p pH

Page 24: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Step 2: Determine which distribution to use for the test statistic, and state the level of significance.

We are evaluating whether the observed proportions of wing flavors sold match the expected proportions for the five flavors. Remember that we can safely assume that the conditions are met for examples in this section, so the chi square test for ‑goodness of fit is again the appropriate choice. Note that the level of significance given in the problem is = 0.05.

Page 25: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Step 3: Gather data and calculate the necessary sample statistics.

Next, in order to calculate the 2-test statistic for the data given, let’s begin by calculating the expected value of the number of orders for each

flavor since they are not all the same. Here, n = 251 + 630 + 115 + 141 + 121 = 1258 (the total number of orders of wings sold).

Page 26: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑

1 1

2 2

3 3

4 4

5 5

Spicy Garlic 1258 0.20 251.6

Classic Medium 1258 0.50 629

Teriyaki 1258 0.10 125.8

Hot BBQ 1258 0.10 125.8

Asian Zing 1258 0.10 125.8

E E np

E E np

E E np

E E np

E E np

Page 27: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Some TI 84 Plus calculators can calculate the ‑ 2-test statistic as well as the p value for a chi square test for ‑ ‑goodness of fit. Begin by pressing and then choose option 1:Edit. Enter the observed values in L1 and the expected values in L2, as shown in the screenshot.

Page 28: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Next, press , scroll to TESTS, and then choose option D:2GOF‑Test. The calculator will prompt you for the following: Observed, Expected, and df, as shown in the screenshot on the left below. Enter L1 for Observed since that is the list where you entered the observed values. Enter L2 for Expected and enter the number of degrees of freedom for df. The number of degrees of freedom for this test is df = 5 – 1 = 4, so enter 4 for df. Finally, select Calculate and press .

Page 29: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑

The output screen, shown above on the right, displays the 2-test statistic and the p value, and reiterates the ‑number of degrees of freedom that was entered.

Page 30: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑Step 4: Draw a conclusion and interpret the decision.

We see that 2 ≈ 2950.and the p value ≈ ‑0.5662. This p value can be compared to the ‑ level of significance, = 0.05, to draw a conclusion. Remember that if p value ≤ ‑ , then the conclusion is to reject the null hypothesis. In this case, p value > ‑, so the conclusion is to fail to reject the null hypothesis.

Page 31: Section 10.6

HAWKES LEARNING SYSTEMS

Students Matter. Success Counts.

Copyright © 2013 by Hawkes Learning

Systems/Quant Systems, Inc.

All rights reserved.

Example 10.31: Performing a Chi-Square Test for Goodness of Fit Using a TI 84 Plus Calculator (cont.)‑In other words, the evidence does not support the claim that the proportions of wing flavors sold have changed. The restaurant cannot say that the promotional campaign has made any difference based on this evidence.