Download BEG_10_6

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
no text concepts found
Transcript
Section 10.6
Chi-Square Test for Goodness of Fit
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.
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.
H0 : p1  p2 
 pk
Ha : There is some difference amongst the probabilities.
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.
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.)
H0 : p1  probability of first outcome,
p2  probability of second outcome, ...,
pk  probability of k outcome
Ha : There is some difference from the
stated probabilities.
th
k is the number of possible outcomes for each trial.
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
 
2
Oi  Ei 
2
Ei
where Oi is the observed frequency for the ith possible
outcome and Ei is the expected frequency for the ith
possible outcome.
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 −1
where k is the number of possible outcomes for each
trial.
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
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.
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.)
The results are listed in the following table.
ATM Usage
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
HAWKES LEARNING SYSTEMS
Students Matter. Success Counts.
Number of Times Used
38
33
41
25
22
38
45
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.)
Solution
Step 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.
H0 : The proportions of customers who use the
ATM do not vary by the day of the week.
Ha : The proportions of customers who use the
ATM do vary by the day of the week.
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.
H0 : p1  p2  p3  p4  p5  p6  p7
Ha : There is some difference amongst the probabilities.
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.
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.
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).
Ei  npi
1
 242 
7
242

7
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
 Oi  Ei 
2
Ei
2
2
2
242 
242 
242 
242 




 38 

 33 

 41 

 25 

7
7
7
7 




242
242
242
242
7
7
7
7
2
2
2
2
242 
242 
242 



 22 

 38 

 45 

7
7
7



 12.314
242
242
242
7
7
7
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.
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.)
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
2
2



have 12.314 < 12.592 so
0.050 , 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.
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.
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.)
Buffalo Wing Sales
Spicy Garlic
Classic Medium
Teriyaki
Hot BBQ
Asian Zing
Number Sold
251
630
115
141
121
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?
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.
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.
p1  0.20, p2  0.50, p3  0.10, p4  0.10, p5  0.10
Therefore, the null and alternative hypotheses are
stated as follows.
H0 : p1  0.20, p2  0.50, p3  0.10, p4  0.10, p5  0.10
Ha : There is some difference from the stated probabilities.
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.
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).
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.)
E  Spicy Garlic   E1  np1  1258  0.20   251.6
E  Classic Medium  E2  np2  1258  0.50   629
E  Teriyaki  E3  np3  1258 0.10  125.8
E Hot BBQ   E4  np4  1258 0.10  125.8
E  Asian Zing   E5  np5  1258  0.10   125.8
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.
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
.
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.
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.
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.
HAWKES LEARNING SYSTEMS
Students Matter. Success Counts.
Copyright © 2013 by Hawkes Learning
Systems/Quant Systems, Inc.
All rights reserved.