Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two...

26
Section 10.2 Independence

Transcript of Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two...

Page 1: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Section 10.2

Independence

Page 2: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Section 10.2 Objectives

• Use a chi-square distribution to test whether two variables are independent

• Use a contingency table to find expected frequencies

Page 3: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Contingency Tables

r × c contingency table • Shows the observed frequencies for two variables. • The observed frequencies are arranged in r rows and

c columns. • The intersection of a row and a column is called a

cell.

Page 4: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Contingency Tables

Example:• The contingency table shows the number of times a

random sample of former smokers tried to quit smoking before they were habit free. They are classified by gender.

Number of times tried to quit before habit-free

Gender1 2-3 4 or

more

Male 271 257 149

Female 146 139 80

Page 5: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Finding the Expected Frequency

• Assuming the two variables are independent, you can use the contingency table to find the expected frequency for each cell.

• The expected frequency for a cell Er,c in a contingency table is

,(Sum of row ) (Sum of column )Expected frequency

Sample sizer cr cE

Page 6: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Example: Finding Expected Frequencies

Find the expected frequency for each cell in the contingency table. Assume that the variables, favorite way to eat ice cream and gender, are independent.

Number of times tried to quit

Gender1 2-3 4 or

more Total

Male 271 257 149 677

Female 146 139 80 365

Total 417 396 229 1042

marginal totals

Page 7: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Number of times tried to quit

Gender1 2-3 4 or

more Total

Male 271 257 149 677

Female 146 139 80 365

Total 417 496 229 1042

,(Sum of row ) (Sum of column )

Sample sizer cr cE

E1,1= 270.93

Page 8: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Number of times tried to quit

Gender1 2-3 4 or

more Total

Male 271 257 149 677

Female 146 139 80 365

Total 417 496 229 1042

,(Sum of row ) (Sum of column )

Sample sizer cr cE

= 322.26 = 148.78

Page 9: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Number of times tried to quit

Gender1 2-3 4 or

more Total

Male 271 257 149 677

Female 146 139 80 365

Total 417 496 229 1042

,(Sum of row ) (Sum of column )

Sample sizer cr cE

= 322.26 = 173.74 = 80.22

Page 10: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Example: Finding Expected Frequencies

Find the expected frequency for each cell in the contingency table. Assume that the variables, favorite way to eat ice cream and gender, are independent.

Favorite way to eat ice cream

GenderCup Cone Sundae Sandwich Other Total

Male 600 288 204 24 84 1200

Female 410 340 180 20 50 1000

Total 1010 628 384 44 134 2200

marginal totals

Page 11: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Favorite way to eat ice cream

GenderCup Cone Sundae Sandwich Other Total

Male 600 288 204 24 84 1200

Female 410 340 180 20 50 1000

Total 1010 628 384 44 134 2200

,(Sum of row ) (Sum of column )

Sample sizer cr cE

1,1

1200 1010550.91

2200E

Page 12: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Favorite way to eat ice cream

GenderCup Cone Sundae

Sandwich

Other Total

Male600 288 204 24 84 1200

Female 410 340 180 20 50 1000

Total 1010 628 384 44 134 2200

1,2

1200 628342.55

2200E

1,3

1200 384209.45

2200E

1,4

1200 4424

2200E

1,5

1200 13473.09

2200E

Page 13: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Finding Expected Frequencies

Favorite way to eat ice cream

GenderCup Cone Sundae Sandwich Other Total

Male 600 288 204 24 84 1200

Female 410 340 180 20 50 1000

Total 1010 628 384 44 134 2200

2,2

1000 628285.45

2200E

2,4

1000 4420

2200E

2,5

1000 13460.91

2200E

2,1

1000 1010459.09

2200E

2,3

1000 384174.55

2200E

Page 14: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Chi-Square Independence Test

Chi-square independence test• Used to test the independence of two variables. • Can determine whether the occurrence of one variable

affects the probability of the occurrence of the other variable.

Page 15: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Chi-Square Independence Test

For the chi-square independence test to be used, the following must be true.

1.The observed frequencies must be obtained by using a random sample.

2.Each expected frequency must be greater than or equal to 5.

Page 16: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Chi-Square Independence Test

• If these conditions are satisfied, then the sampling distribution for the chi-square independence test is approximated by a chi-square distribution with (r – 1)(c – 1) degrees of freedom, where r and c are the number of rows and columns, respectively, of a contingency table.

• The test statistic for the chi-square independence test is

where O represents the observed frequencies and E represents the expected frequencies.

22 ( )O E

E The test is always a

right-tailed test.

Page 17: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Chi-Square Independence Test

1. Identify the claim. State the null and alternative hypotheses.

2. Specify the level of significance.

3. Determine the degrees of freedom.

4. Determine the critical value.

State H0 and Ha.

Identify α.

Use Table 6 in Appendix B.

d.f. = (r – 1)(c – 1)

In Words In Symbols

Page 18: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Chi-Square Independence Test

If χ2 is in the rejection region, reject H0. Otherwise, fail to reject H0.

5. Determine the rejection region.

6. Calculate the test statistic.

7. Make a decision to reject or fail to reject the null hypothesis.

8. Interpret the decision in the context of the original claim.

22 ( )O E

E

In Words In Symbols

Page 19: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Example: Performing a χ2 Independence Test

Using the gender/favorite way to eat ice cream contingency table, can you conclude that the adults favorite ways to eat ice cream are related to gender? Use α = 0.01. Expected frequencies are shown in parentheses.

Favorite way to eat ice cream

GenderCup Cone Sundae Sandwich Other Total

Male600

(550.91)288

(342.55)204

(209.45)24

(24)84

(73.09)1200

Female410

(459.09)340

(285.45)180

(174.55)20

(20)50

(60.91)1000

Total 1010 628 384 44 134 2200

Page 20: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Performing a Goodness of Fit Test

• H0:

• Ha:

• α =• d.f. = • Rejection Region

• Test Statistic: • Decision:

0.01(2 – 1)(5 – 1) = 4

The adults’ favorite ways to eat ice cream are independent of gender. The adults’ favorite ways to eat ice cream are dependent on gender. (Claim)

Page 21: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Performing a Goodness of Fit Test

O E (O-E) (O-E)2 (O-E)2/E

600 550.91 49.09 2409.8281 4.3743

288 342.55 -54.55 2975.7025 8.6869

204 209.45 -5.45 29.7025 0.1418

24 24 0 0 0

84 73.09 10.91 119.0281 1.6285

410 459.09 -49.09 2409.8281 5.2491

340 285.45 54.55 2975.7025 10.4246

180 174.55 5.45 29.7025 0.1702

20 20 0 0 0

50 60.91 -10.91 119.0281 1.95422

2 ( )O E

E

4.3743+8.6869+.1418+0+1.6285+5.2491+10.4246+.1702+0+1.9542 = 32.630

Page 22: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Performing a Goodness of Fit Test

• H0:

• Ha:

• α =

• d.f. =

• Rejection Region

• Test Statistic:

• Decision:

0.01

(2 – 1)(5 – 1) = 4

The adults’ favorite ways to eat ice cream are independent of gender.The adults’ favorite ways to eat ice cream are dependent on gender. (Claim)

χ2 ≈ 32.630

There is enough evidence at the 1% level of significance to conclude that the adults’ favorite ways to eat ice cream and gender are dependent.

Reject H0

Page 23: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Section 10.2 Summary

• Used a contingency table to find expected frequencies• Used a chi-square distribution to test whether two

variables are independent

Page 24: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Contingency Tables

Example:• The contingency table shows the results of a random

sample of 2200 adults classified by their favorite way to eat ice cream and gender.

Favorite way to eat ice cream

GenderCup Cone Sundae Sandwich Other

Male 600 288 204 24 84

Female 410 340 180 20 50

Page 25: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Solution: Performing a Goodness of Fit Test

2 2 2 2 2

2 2 2 2 2

(600 550.91) (288 342.55) (204 209.45) (24 24) (84 73.09)

550.91 342.55 209.45 24 73.09

(410 459.09) (340 285.45) (180 174.55) (20 20) (50 60.91)

459.09 285.45 174.55 20 60.9132.630

22 ( )O E

E

Page 26: Section 10.2 Independence. Section 10.2 Objectives Use a chi-square distribution to test whether two variables are independent Use a contingency table.

Example: Performing a χ2 Independence Test

Using the gender/times to quit contingency table, can you conclude that the number of times they tried to quit are related to gender? Use α = 0.05. Expected frequencies are shown in parentheses.