24
AP Statistics 13.2 Inference for Two Way Tables

13.2 Inference for Two Way Tables. Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Embed Size (px)

Citation preview

Page 1: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

AP Statistics13.2 Inference for Two Way Tables

Page 2: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Learning Objective:

Page 3: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Goodness of Fit

Homogeneity

Independence

1 variable

-distribution

2 variables (2 way table) -distribution-proportions

2 variables (2 way table)

-association-dependent upon-relationship-influences

Three Types of Chi-Squared Distributions

Page 4: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Is there evidence the wheel is unbalanced?

(one variable- prize you get)

Example of Chi-Squared(Goodness of Fit) Test

Prize Teddy Bear

Goldfish T-shirt Poster

# of winners

34 41 39 27

Page 5: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Is there evidence that proportion of kids who attend regular MGS is different for each grade level.

Notice it is a 2-way table with two categorical variables:

Grade level and whether you attend MGS

Example of Chi-Squared(Homogeneity) Test

Freshmen

Sophomore

Junior Senior

Attend MGS

45 61 99 81

Does Not

Attend MGS

97 86 64 72

Page 6: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

This is the same thing as a test of homogeneity except the wording of the question will use key words such as association or relationship. We complete the same steps in our calculator, we just use a different name for our test and word our Ho and Ha different.

Is there evidence of a relationship between grade level and kids who attend MGS regularly?

Example of Chi-Squared(Independence) Test

Page 7: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Expected Counts=

Degrees of freedom

(r-1)(c-1)

Chi-Squared Test Statistic

totaltable

totalcolumntotalrow

Page 8: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Find the expected counts: First you need to find the row and column totals above. I did the first example-you fill in the rest!

Expected Freshmen Sophomore Junior Senior

Attend MGS (286*142)/605=67.13

Does Not Attend MGS

Observed

Freshmen

Sophomore

Junior

Senior

Total

Attend MGS

45 61 99 81 286

Does Not Attend MGS

97 86 64 72 319

Total 142 147 163 153 605

Page 9: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Expected counts complete! Now let’s try the quick way. Follow along!

Go to your calculator. Matrix-Edit-enter [A] Matrix[A] r x c (so change it to 2 x 4). Then input your observed

counts. Then hit: stat-tests-x² test. Just hit calculate. It gives you your calculations but we can worry about those later!!

Go back to matrix and hit enter on matrix [B]. When you hit enter again scroll through the matrix and notice your

calculator did all the expected counts and they should match what you just did by hand!

Expected Freshmen Sophomore Junior Senior

Attend MGS (286*142)/605=67.13

69.49 77.05 72.32

Does Not Attend MGS

74.87 77.51 85.95 80.67

X²-testObserved:[A]Expected: [B]Calculate

Page 10: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

df =(r-1)(c-1) =(2-1)(4-1)

=1*3=3

Degrees of freedom

Observed

Freshmen

Sophomore

Junior

Senior

Total

Attend MGS

45 61 99 81 286

Does Not Attend MGS

97 86 64 72 319

Total 142 147 163 153 605

Page 11: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀:the proportion of ________ is the SAME as __________

Ha: the proportion of ________ is DIFFERENT than __________

(these are just template sentences, remember whatever the question is asking is your Ha)

Chi-Squared (Homogeneity)-

Page 12: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Example 1: Do the boys’ preferences for the following TV programs differ significantly from the girls’ preferences? Use a 5% significance level.

House Grey’sAnatomy

AmericanIdol

CSI

Boys 66 78 67 105

Girls 48 130 123 61

Page 13: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀:the boys preference for TV programs is the SAME as the girls

Ha: the boys preference for TV programs is DIFFERENT than the girls

Assumptions:-random sample-all expected counts are ≥ 1-no more than 20% of the expected counts

<5 House Grey’sAnatomy

AmericanIdol

CSI

Boys 53.1 96.9 88.6 77.4

Girls 60.9 111.1 101.4 88.6

Page 14: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Chi-Squared Test (Homogeneity) w/ α=0.05

P(x²>41.08)=0.000000006 df=3

Since p< α, it is statistically significant. Therefore we reject H₀. There is enough evidence to say the preference of TV programs for boys is different than girls.

Page 15: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Example 2: The following data is an SRS of 650 patients at a local hospital. Does the effect of aspirin significantly differ from a placebo for these medical conditions?

Aspirin Placebo

Fatal Heart Attacks

20 60

Non-Fatal Heart Attacks

125 220

Strokes 75 150

Page 16: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀:the effects of aspirin is the same as the placebo

Ha: the effects of aspirin is different than the placebo

Assumptions:-random sample-all expected counts are ≥ 1-no more than 20% of the expected counts

<5 Aspirin Placebo

Fatal Heart Attacks

27.1 52.9

Non-Fatal Heart Attacks

116.8 228.2

Strokes 76.2 148.8

Page 17: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Chi-Squared Test (Homogeneity) w/ α=0.05

P(x²>3.70)=0.1573 df=2

Since p∡ α, it is not statistically significant. Therefore we do not reject H₀. There is not enough evidence to say the effect of aspirin differs from the placebo.

Page 18: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀: There is no relationship (association) between ________ and ________.

Ha: There is a relationship (association) between ________ and ________.

Chi-Squared (Independence)-

Page 19: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Example 3: An SRS of 1000 was taken

Is there a relationship between gender and political parties?

Republican Democrat Independent

Male 200 150 50

Female 250 300 50

Page 20: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀: There is no relationship between gender and political party

Ha: There is a relationship between gender and political party

Assumptions:-random sample-all expected counts are ≥ 1-no more than 20% of the expected counts

<5 Republican Democrat Independent

Male 180 180 40

Female 270 270 60

Page 21: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Chi-Squared Test (Independence) w/ α=0.05

P(x²>16.2)=0.0003 df=2

Since p< α, it is statistically significant. Therefore we reject H₀. There is enough evidence to say there is a relationship between gender and political party

Page 22: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Example 4: An SRS of 592 people were taken comparing their hair and eye color.

Is there an association between hair color and eye color?

Black Brown Red Blonde

Brown 68 119 26 7

Green 20 84 17 94

Blue 15 54 14 10

Hazel 8 29 14 16

Page 23: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

H₀: There is no association between hair color and eye color

Ha: There is an association between hair color and eye color

Assumptions:-random sample-all expected counts are ≥ 1-no more than 20% of the expected counts

<5 Black Brown Red Blonde

Brown 41.0 105.7 26.3 47.0

Green 40.1 103.3 25.7 45.9

Blue 17.3 44.7 11.1 19.9

Hazel 12.5 32.2 8.0 14.3

Page 24: 13.2 Inference for Two Way Tables.  Analyze Two Way Tables Using Chi-Squared Test for Homogeneity and Independence

Chi-Squared Test (Independence) w/ α=0.05

P(x²>134.98)≈0 df=9

Since p< α, it is statistically significant. Therefore we reject H₀. There is enough evidence to say there is an association between hair color and eye color