CHAPTER 14

INFERENCE FOR DISTRIBUTIONS

OF CATAGORICAL VARIABLES:

CHI-SQUARE PROCEDURES

In chapter 4 we began to look at methods for studying the relationship between two or more CATEGORICAL variables. We computed some special percents to describe the association, called ______. In Chapter 14 we learn inference techniques for analyzing count data.

There are three tests described in the text:

1.  Goodness of Fit Test: this test is for assessing if a particular ______model is a good fitting model for a ______characteristic, based on a random sample from the population.

2.  Test of Homogeneity: this test is for assessing if ______populations are homogeneous (alike) with respect to the distribution of some discrete (______) variable.

3.  Test of Independence: this test helps us to assess if ______(categorical) variables are ______for a population, or if there is an ______between the two variables.

The first test in the text is the ______test for count data. The other two tests are actually the same test. Although the hypotheses are stated ______and the underlying ______about how the data is gathered are different. The steps for doing the two tests are ______.

All of these tests are based on a test statistic which, if the corresponding is true and the assumptions hold, follows a chi-square distribution with some degrees of freedom, written . So our first discussion is to learn about the chi-square distribution – what it looks like, some facts, how to use Table D.

The Chi-Square Distribution

General Shape:

The ______are a family of distributions take on ______and are ______. A chi-square distribution is specified by one parameter called the ______.

The BIG IDEA

·  The data consists of ______counts.

·  We compute ______counts under the , - these counts are what we would expect (on average) if the corresponding were true.

·  Compare the observed and ______counts using the test statistic. The statistic will be a measure of how close the ______counts are to the ______counts under . If this distance is ______, we have ______the alternative .

With this in mind, we turn to our first chi-square test of goodness of fit. We will derive the methodology for the test through an example. An overall summary of the test will be presented at the end.

Test of Goodness of Fit: this test is for assessing if a particular discrete model is a good fitting model for a discrete characteristic, based on a random sample from the population.

Note: tests are always ______since we only care if the value is “too” large. In this case, the ______are the number of observations ______. To decide if the statistic is significant, we compare it to the appropriate critical value for the -distribution with the df that we are using. For example, at a level of significance of =.05, the critical value for a with df = 10 is = ______, but the critical value for a with df = 30 is ______. For a particular distribution, the ______the statistic, the ______the fit.

Goodness of Fit Test

Scenario: We have one population of interest – say all cars exiting a toll road that has 4 booths at the exit.

Question: Are the 4 booths used equally often?

Data: 1 random sample of 100 cars, we record one variable X = Booth used (1, 2, 3, 4)

The table below summarizes the data in terms of the observed counts.

Observed Counts

Booth 1 / Booth 2 / Booth 3 / Booth 4
Observed # of cars / 26 / 20 / 28 / 26

Note: This is only a one-way frequency table – not a two-way tables as in the homogeneity and independence tests. We use the notation K = # of categories or cells, here k = 4.

The null hypothesis:

Let = proportion of cars using booth i.

The null hypothesis specifies a particular discrete model (mass function) by listing the proportions (or probabilities) for each of the k outcome categories.

The one-way table provides the OBSERVED counts.

Our next step is to compute the EXPECTED counts, under the assumption that is true.

How to find the expected counts?

There were 100 cars in the sample and 4 booths.

If the booths are used equally often, is true, then we would expect

…_____cars to use Booth #1

…_____cars to use Booth #2

…_____cars to use Booth #3

…_____cars to use Booth #4

Expected Counts =

Enter these expected counts in the parentheses in the table below.

Observed Counts (Expected Counts)

Booth 1 / Booth 2 / Booth 3 / Booth 4
Observed # of cars / 26 ( ) / 20 ( ) / 28 ( ) / 26 ( )

The test statistic

Next we need our test statistic, our measure of how close the observed counts are to what we expect under the null hypothesis.

=

Do you think a value of = ______is large enough to reject ?

Let’s find the p-value – the probability of getting an test statistic value ______or larger than the one we______, assuming is true. To do this we need to know the distribution if is true, then has the distribution with degrees of freedom =

Find the p-value for our toll booth example:

Observed test statistic value = ______df = ______

Are the results statistically significant at the 5% significance level?

Conclusion at a 5% level: It appears that …

Aside: Using the following frame of reference for chi-square distributions, if we have a chi-square distribution with df = degrees of freedom, then the mean is equal to _____, and the standard deviation is equal to .

So, if were true, we would expect the test statistic to be about _____ give or take about _____.

Since we reject for large values of , and we only observed a value of ______(even less than what we expected to see under ), we certainly do not have enough evidence to reject .

Goodness of Fit Test Summary

Assume:

We have 1 random sample of size n.

We measure 1 discrete response X which has k possible outcomes.

Test: A specified discrete probability distribution for X

Test Statistic: where expected =

If is true, then has a distribution with (k – 1) degrees of freedom, where k is the number of categories.

Follow-up Analysis

If we find ______, we can conclude that our variable has a distribution ______from the specified one. In this case, it’s always a good idea to determine ______of the variable provide the ______between the observed and expected counts. To do this, need to look at the individual calculations for . The one that is the largest and contributes the most to the statistic is called the ______of the chi-square statistic.

14.2 Inference for Two-Way Tables

Big Ideas

1.  The relationship between two categorical variables measured ______individuals is displayed in a ______of counts.

2.  The ______assesses whether the relationship between two categorical variables is ______. The test is based on comparing the ______in the two-way table to the ______we would ______if knowing the value of one variable gives ______about the other.

3.  ______values of the chi-square statistic are evidence ______the null hypothesis of ______relationship. That is, the test is always ______. P-values come from the ______distributions.

4.  Because the chi-square test does not look for any particular form of ______, be sure to describe the ______relationship along with the test.

Read Example 14.4 Page 850

Note:

Read pages 851-853

Stating Hypotheses

: The distribution of the response variable is the same in all c populations

Read Example 14.6 Page 854

Note:

Let’s do Exercise 14.12 Page 856

Let’s run through a Test of Homogeneity

Scenario: We have two populations of interest – say preschool boys and preschool girls.

Question: Is Ice Cream Preference the same for boys and girls?

Data: 1 random sample of 75 preschool boys, 1 random sample of 75 preschool girls; the two random samples are independent.

The table below summarizes the data in terms of the observed counts.

Observed Counts:

Ice Cream Preference / Boys / Girls
Vanilla (V) / 25 / 26
Chocolate (C) / 30 / 23
Strawberry (S) / 20 / 26

Note: The column totals here were ______, even before the ice cream preferences were measured. This is a key idea for how to distinguish between the test of ______and the test of ______.

The null hypothesis (is that there is ______the row variables and column variables.):

The distribution of ice cream preference is the same for the two populations, boys and girls.

As we can see, the null hypothesis is stating that the distribution of ice cream preference does not depend on (is ______) the population we select from since the two distributions are the ______. The null hypothesis looks like: P(A| B) = P(A), which is one definition of independent events, from our previous discussion of independence. This is why the test of homogeneity (comparing several populations) is ______as the test of independence. The ______are different however. For our ______(comparing ______populations) test, we assume we have ______, one from each population, and we measure ______(categorical) response. For the independence test (discussed later) we will assume we have ______, but we measure ______(categorical) responses.

Getting back to our ICE CREAM …

The two-way table provides the OBSERVED counts. Our next step is to compute the EXPECTED counts, under the assumption that is true.

How to find the expected counts?

Let’s look at those who preferred Strawberry first.

Since there were _____ children who preferred Strawberry overall,

if the distributions for boys and girls are the same ( is true),

then we would expect _____ of these children to be boys

and the remaining _____ of these children to be girls.

Note that our sample sizes were the same, 75 boys and 75 girls.

Do the same for the Vanilla and Chocolate preferences.

Chocolate: Since there were _____ children who preferred Chololate overall,

if the distributions for boys and girls are the same ( is true),

then we would expect _____ of these children to be boys

and the remaining _____ of these children to be girls.

Vanilla: Since there were _____ children who preferred Vanilla overall,

if the distributions for boys and girls are the same ( is true),

then we would expect _____ of these children to be boys

and the remaining _____ of these children to be girls.

Enter these expected counts in the parentheses in the table below.

Observed Counts (Expected Counts):

Ice Cream Preference / Boys / Girls
Vanilla (V) / 25 ( ) / 26 ( )
Chocolate (C) / 30 ( ) / 23 ( )
Strawberry (S) / 20 ( ) / 26 ( )

A Closer Look at the Expected Counts:

Let’s look at how we actually computed an expected count so we can develop a general rule:

Expected number of boys preferring vanilla =

This quick recipe for computing the expected counts under the null hypothesis is called the Cross-Product Rule.

The test statistic

Next we need our test statistic, our measure of how close the observed counts are to what we expect under the null hypothesis.

Let’s compute it for our ice cream example:

The larger the test statistic, the “bigger” the difference between what we observed and what we would expect to see if were true. So the larger the test statistic, ______evidence we have ______the null hypothesis. Is a value of = ______large enough to reject ?

We need to find the p-value – the probability of getting an test statistic value as ______than the one we observed, assuming is true. To do this we need to know the distribution of the test statistic under the null hypothesis.

If is true, then has the distribution with degrees of freedom = ______

Find the p-value for our ice cream example:

Observed test statistic value = _____ df = ______

Decision at a 5% significance level: (circle one) Reject Fail to reject

Conclusion: It appears that …

Aside: Using our frame of reference for chi-square distributions.

Recall that if we have a chi-square with df = degrees of freedom, then the mean is equal to df, and the standard deviation is equal to .

So, if were true, we would expect the test statistic to be about _____ give or take about ______.

Since we reject for large values of , and we only observed a value of ______(even less than what we expected to see under ), we certainly do not have enough evidence to reject .)

Test of Homogeneity (Comparison of Several Populations) Summary

Assume:

We have C random samples of size from C populations.

We measure 1 discrete response X which has r possible outcomes.

Test: : The distribution for the response variable X is the same for all populations.

Test Statistic:

Where expected =

If is true, then has a distribution with (r – 1)(c – 1) degrees of freedom.

Try It!

For a chi-square test of homogeneity, there are 3 populations and 4 possible values of the discrete characteristic.

If is true, that is, the distribution for the response is the same for all 3 populations, what is the expected value of the test statistic?

Back to the book:

The Chi-Square Test for Homogeneity of Populations