18
AP Statistics Chapter 26: Comparing Counts

AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Embed Size (px)

Citation preview

Page 1: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

AP Statistics

Chapter 26: Comparing Counts

Page 2: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Test for Goodness of Fit:

To analyze categorical data, we construct two-way tables and examine the counts or percents of the explanatory and response variables.

Hershey Activity:Kind Milk

ChocolateMr.

Goodbar Krackel Special Dark

Claimed % 40% 21% 21% 18%

Page 3: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Proportion of Hershey Miniatures

KIND ObservedCount, O

ExpectedCount, E

Milk Chocolate

Mr. Goodbar

Krackel

Special Dark

2O E

E

Page 4: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

We want to compare the observed counts to the expected counts.

The null hypothesis is that there is no difference between the observed and expected counts.

The alternative hypothesis is that there is a difference between the observed and expected counts.

Page 5: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

is called the

chi-square test statistic . It measures how well the observed counts fit the expected counts, assuming that the null hypothesis is true.

22 O E

E

Page 6: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

The distribution of the chi-square statistic is called the chi-square distribution, 2. This distribution is a density curve.

The total area under the curve is 1 .

The curve begins at zero on the horizontal axis and is skewed right .

As the degrees of freedom increase, the shape of the curve becomes more symmetric .

Page 7: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Using the Hershey’s Miniatures chi-square statistic, find the probability of obtaining a 2 value at least this extreme assuming the null hypothesis is true.

 This is known as the “Goodness of Fit

Test.”  Graph the chi-square distribution with (k

– 1) = 3 degrees of freedom, where k = # of categories:

 

Page 8: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

TI-83+: 2pdf (X, 5)

We would expect to obtain a 2 value at least this extreme in about _____ out of every _____ samples, assuming the null hypothesis is true.

Page 9: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

CONDITIONS: The Goodness of Fit Test may be used when:SRSwe are working with counts .all counts are at least 1 and most (at least 80%) of the counts are at least 5 .

 *Following the Goodness of Fit Test,

check to see which component made the greatest contribution to the chi-square statistic to see where the biggest changes occurred.

Page 10: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Inference for Two Way Tables:

To compare two proportions, we use a 2-Proportion Z Test. If we want to compare three or more proportions, we need a new procedure.

 The first step in the overall test for comparing

several proportions is to arrange the data in a 2-way table.

 Think of the counts as elements of a matrix with r

rows and c columns. This is called an r x c table with (r)(c) cells.

 Our null hypothesis is that there is no difference

among the proportions. The alternative hypothesis is that there are some difference among the proportions.

Page 11: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

We will use the chi-square test to measure how far the observed values are from the expected values.

To calculate the expected counts, multiply the row total by the column total, and divide by the table total : row total column total

expected counttable total

Page 12: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

The chi-square statistic is the sum over all r x c cells in the table:

 

 The degrees of freedom is (r – 1)

(c – 1) .  The P-value is the area to the

right of the statistic under the chi-square density curve. 

Page 13: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

In Summary:Use a chi-square goodness of fit

test when you want to show that the distribution of counts in one categorical variable matches the distribution predicted by a model.

( one categorical variable, one -way table)H0: The distribution of Hershey Miniatures is the same as the advertised distribution.

Page 14: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Use a chi-square test for homogeneity when you want to show that the distribution of counts for two or more groups is the same.

“Are the groups homogeneous?”; more than one population; split, then sample

( one categorical variable, two -way table)

H0: The distribution of X is the same as the distribution of Y.

Page 15: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Use a chi-square test for independence when you want to show that two categorical variables are independent for one group of individuals.

“Are the variables independent?”; one population; sample, then split

( two categorical variables, two -way table)

H0: X and Y are independent.

Page 16: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Slide 26 - 16

What Can Go Wrong?

Don’t use chi-square methods unless you have counts.

Just because numbers are in a two-way table doesn’t make them suitable for chi-square analysis.

Beware large samples.With a sufficiently large sample size, a chi-square test can always reject the null hypothesis.

Don’t say that one variable “depends” on the other just because they’re not independent.

Association is not causation.

Page 17: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Slide 26 - 17

What have we learned?We’ve learned how to test hypotheses about categorical variables.All three methods we examined look at counts of data in categories and rely on chi-square models.

Goodness-of-fit tests compare the observed distribution of a single categorical variable to an expected distribution based on theory or model.Tests of homogeneity compare the distribution of several groups for the same categorical variable.Tests of independence examine counts from a single group for evidence of an association between two categorical variables.

Page 18: AP Statistics Chapter 26: Comparing Counts. Test for Goodness of Fit: To analyze categorical data, we construct two-way tables and examine the counts

Slide 26 - 18

What have we learned? (cont.)

Mechanically, these tests are almost identical.While the tests appear to be one-sided, conceptually they are many-sided, because there are many ways that the data can deviate significantly from what we hypothesize.When we reject the null hypothesis, we know to examine standardized residuals to better understand the patterns in the data.