## 5 Steps to a 5 AP Statistics 2017 (2016)

### STEP __4__

### Review the Knowledge You Need to Score High

### CHAPTER 14

### Inference for Categorical Data: Chi-square

**IN THIS CHAPTER**

**Summary:** In this final chapter, we will look at inference for categorical variables. Up until now, we have studied primarily data analysis and inference only for one or two numerical variables (those whose outcomes we can measure), and proportions, which are categorical variable with only two possible values (success and failure). The material in this chapter opens up for us a wide range of research topics, allowing us to compare categorical variables across several values. For example, we will ask new questions like, “Is there an association between gender and political party preference?”

**Key Ideas**

Chi-Square Goodness-of-Fit Test

Chi-Square Test for Independence

Chi-Square Test for Homogeneity of Proportions (Populations)

χ^{2} versus *Z* ^{2}

**Chi-Square Goodness-of-Fit Test**

The following are the approximate percentages for the different blood types among white Americans: A: 40%; B: 11%; AB: 4%; O: 45%. A random sample of 1000 black Americans yielded the following blood type data: A: 270; B: 200; AB: 40; O: 490. Does this sample provide evidence that the distribution of blood types among black Americans differs from that of white Americans, or could the sample values simply be due to sampling variation? This is the kind of question we can answer with the chi-square **goodness-of-fit test** . (“Chi” is the Greek letter *χ* ; chi-square is, logically enough, *χ* ^{2} .) With the chi-square goodness- of-fit test, we note that there is one categorical variable (blood type) and one population (black Americans). In this chapter we will also encounter a situation in which there is one categorical variable measured across two or more populations (called a chi-square test for homogeneity of proportions) and a situation in which there are two categorical variables measured across a single population (called a chi-square test for independence).

To answer this question, we need to compare the **observed values** in the sample with the **expected values** we would get *if* the sample of black Americans really had the same distribution of blood types as white Americans. The values we need for this are summarized in the following table.

It appears that the numbers vary noticeably for types A and B, but not as much for types AB and O. The table can be rewritten as follows.

Before working through this problem, a note on symbolism. Often in this book, and in statistics in general, we use English letters for statistics (measurements from data) and Greek letters for parameters (population values). Hence, is a sample mean and *μ* is a population mean; *σ* is a sample standard deviation and σ is a population standard deviation, etc. We follow this same convention in this chapter: we will use *χ* ^{2} when referring to a population value or to the name of a test and use *X* ^{2} when referring to the chi-square statistic.

The chi-square statistic (*X* ^{2} ) calculates the squared difference between the observed and expected values relative to the expected value for each category. The *X* ^{2} statistic is computed as follows:

The chi-square distribution is based on the number of degrees of freedom, which equals, for the goodness-of-fit test, the number of categories minus 1 (df = *c* – 1). The *X* ^{2} statistic follows approximately a unique chi-square distribution, assuming a random sample and a large enough sample, for each different number of degrees of freedom. The probability that a sample has a *X* ^{2} value as large as it does can be read from a table of *X* ^{2} critical values or determined from a calculator. There is a *X* ^{2} table in the back of this book, and you will be supplied a table like this on the AP exam. We will demonstrate both the use of tables and the calculator in the examples and problems that follow.

A hypothesis test for χ^{2} goodness-of-fit follows the by now familiar pattern. The essential parts of the test are summarized in the following table.

Now, let”s answer the question posed in the opening paragraph of this chapter. We will use the by now familiar four-step hypothesis-testing procedure introduced in __Chapter 11__ .

**example:** The following are the approximate percentages for the different blood types among white Americans: A: 40%; B: 11%; AB: 4%; O: 45%. A random sample of 1000 black Americans yielded the following blood type data: A: 270; B: 200; AB: 40; O: 490. Does this sample indicate that the distribution of blood types among black Americans differs from that of white Americans?

**solution:**

**I** . Let *p* _{A} = proportion of black Americans with type A blood; *p* _{B}_{ }= proportion with type B blood; *p* _{AB}_{ }= proportion with type AB blood; *p* _{O}_{ }= proportion with type O blood. *H* _{0} : *p* _{A}_{ }= 0.40, *p* _{B}_{ }= 0.11, *p* _{AB}_{ }= 0.04, *p* _{0} = 0.45.

*H* _{A}_{ }: at least one of these proportions is incorrect.

**II** . We will use the χ^{2} goodness-of-fit test. The problem states that the sample is a random sample. The expected values are type A: 400; type B: 110; type AB: 40; type O: 450. Each of these is greater than 5. The conditions needed for the test are satisfied.

**III** . The data are summarized in the table:

From the *X* ^{2} table (Table C, which is read very much like Table B), we see that 119.44 is much larger than any value for df = 3. Hence, the *P-* value < 0.0005. (A calculator gives a *P* -value of 1.02 × 10^{−25} —more about how to do this coming up next.)

**IV** . Because the *P* -value is so small, we reject the null hypothesis. We have very strong evidence that the proportions of the various blood types among black Americans differ from the proportions among white Americans.

**Calculator Tip:** The computations in part III of the above hypothesis test can be done on the TI-83/84 as follows: put the *observed* values in L1 and the *expected* values in L2 . Let L3=(L1-L2)^{2} /L2 . Quit the lists and compute LIST MATH sum(L3) . This will return the value of *X* ^{2} . Alternatively, you could do STAT CALC 1-Var Stats L3 and note the value of Σx .

To find the probability associated with a value of *X* ^{2} , do the following: DISTR *χ* ^{2} cdf(lower bound, upper bound, df) . In the above example, that might look like *χ* ^{2} cdf(119.44,1000,3)=1.01868518 × 10^{−25} .

The TI-83/84 and early versions of the TI-84 do not have a χ^{2} goodness-of-fit test built in. Newer versions of the TI-83/84 do have it, however. It is found in the STAT TESTS menu and is identified as χ^{2} GOF–Test .

**example:** The statistics teacher, Mr. Hinders, used his calculator to simulate rolling a die 96 times and storing the results in a list L1 . He did this by entering MATH PRB randInt(1,6,96) →(L1) . Next he sorted the list (STAT SortA(L1) ). He then counted the number of each face value. The results were as follows (this is called a one-way table).

Does it appear that the teacher”s calculator is simulating a fair die? (That is, are the observations consistent with what you would expect to get *if* the die were fair?)

**solution:**

**I** . Let *p* _{1} , *p* _{2} ,...,*p* _{6} be the population proportion for each face of the die to appear on repeated trials of a roll of a fair die.

*H* _{A}_{ }: Not all of the proportions are equal to 1/6.

**II** . We will use a χ^{2} goodness-of-fit test. If the die is fair, we would expect to get

of each face. Because all expected values are greater than 5, the conditions are met for this test.

*X* ^{2} = 4.75 (calculator result), df = 6 – 1 = 5 *P* -value > 0.25 (Table C) or *P* -value = 0.45 (calculator).

(*Remember* : To get *X* ^{2} on the calculator, put the Observed values in L1 , the Expected values in L2 , let L3=(L1-L2 )^{2} /L2, then LIST MATH SUM (L3) will be *X* ^{2} . The corresponding probability is then found by DISTR χ^{2}cdf(4.75,100,5 ). This can also be done on a TI-84 that has the *χ* ^{2} GOF–Test .)

**IV** . Because *P* > 0.25, we fail to reject the null hypothesis. We do not have convincing evidence that the calculator is failing to simulate a fair die.

**Inference for Two-Way Tables**

**Two-Way Tables (Contingency Tables) Defined**

A **two-way table** , or **contingency table** , for categorical data is simply a rectangular array of cells. Each cell contains the frequencies for the joint values of the row and column variables. If the row variable has *r* values, then there will be *r* rows of data in the table. If the column variable has *c* values, then there will be *c* columns of data in the table. Thus, there are *r* × *c* cells in the table. (The **dimension** of the table is *r* × *c* .) The **marginal totals** are the sums of the observations for each row and each column.

**example:** A class of 36 students is polled concerning political party preference. The results are presented in the following *two-way* table.

The values of the row variable (Gender) are “Male” and “Female.” The values of the column variable (Political Party Preference) are “Democrat,” “Republican,” and “Independent.” There are *r* = 2 rows and *c* = 3 columns. We refer to this as a 2 × 3 table (the number of rows always comes first). The row marginal totals are 20 and 16; the column marginal totals are 18, 15, and 3. Note that the sum of the row and column marginal totals must both add to the total number in the sample.

In the example above, we had one population of 36 students and two categorical variables (gender and party preference). In this type of situation, we are interested in whether or not the variables are independent in the population. That is, does knowledge of one variable provide you with information about the other variable? Another study might have drawn a simple random sample of 20 males from, say, the senior class and another simple random sample of 16 females. Now we have two populations rather than one, but only one categorical variable. Now we might ask if the proportions of Democrats, Republicans, and Independents in each population are the same. Either way we do it, we end up with the same contingency table given in the example. We will look at how these differences in design play out in the next couple of sections.

**Chi-Square Test for Independence**

A random sample of 400 residents of a large western city are polled to determine their attitudes concerning the affirmative action admissions policy of the local university. The residents are classified according to ethnicity (white, black, Asian) and whether or not they favor the affirmative action policy. The results are presented in the following table.

We are interested in whether or not, in the population of this large city, ethnicity and attitude toward affirmative action are associated (note that, in this situation, we have one population and two categorical variables). That is, does knowledge of a person”s ethnicity give us information about that person”s attitude toward affirmative action? Another way of asking this is, “Are the variables *ethnicity* and *attitude toward affirmative action* independent in the population?” As part of a hypothesis test, the null hypothesis is that the two variables are independent, and the alternative is that they are not: *H* _{0} : the variables *ethnicity* and *attitude toward affirmative action* are independent among all residents of this city *vs. H* _{A}_{ }: the variables are not independent among all residents of this city. Alternatively, we could say *H* _{0} : the variables *ethnicity* and *attitude toward affirmative action* are not associated among all residents of this city *vs. H* _{A}_{ }: the variables *ethnicity* and *attitude toward affirmative action* are associated among all residents of this city.

The test statistic for the independence hypothesis is the same chi-square statistic we saw for the goodness-of-fit test:

For a two-way table, the number of degrees of freedom is calculated as (*number of rows* – 1)(*number of columns* – 1) = (*r* – 1)(*c* – 1). As with the goodness-of-fit test, we require that we are dealing with a random sample and that the number of expected values in each cell be at least 5 (or some texts say there are no empty cells and at least 80% of the cells have more than 5 expected values).

Calculation of the expected frequencies for chi-square can be labor intensive if there are many cells, but it is *usually* done by technology (see the next Calculator Tip for details). However, you should know how expected frequencies are arrived at.

**example** (calculation of expected frequency): Suppose we are testing for independence of the variables (ethnicity and opinion) in the previous example. For the two-way table with the given marginal values, find the expected frequency for the cell marked “Exp.”

**solution:** There are two ways to approach finding an expected value, but they are numerically equivalent and you can use either. The first way is to find the probability of being in the desired location by chance and then multiplying that value times the total in the table (as we found an expected value with discrete random variables). The probability of being in the “Black” row is and the probability of being in the “Do Not Favor” column is . Assuming independence, the probability of being in “Exp” by chance is then . Thus, .

The second way is to argue, under the assumption that there is no relation between ethnicity and opinion, that we”d expect each cell in the “Do Not Favor” column to show the same proportion of outcomes. In this case, each row of the “Do Not Favor” column would contain of the row total. Thus, . Most of you will probably find using the calculator easier.

**Calculator Tip:** The easiest way to obtain the expected values is to use your calculator. To do this, let”s use the data from the previous examples:

In mathematics, a rectangular array of numbers such as this is called a matrix. Matrix algebra is a separate field of study, but we are only concerned with using the matrix function on our calculator to find a set of expected values (which we”ll need to check the conditions for doing a hypothesis test using the chi-square statistics).

Go to MATRIX EDIT [A] . Note that our data matrix has three rows and two columns, so make the dimension of the matrix (the numbers right after MATRIX [A] ) read 3×2. The calculator0 expects you enter the data by rows, so just enter 130, 120, 75, 35, 28, 12 in order and the matrix will be correct. Now, QUIT the MATRIX menu and go to STAT TESTS *χ* ^{2} -Test (Note: Technically we don”t yet know that we have the conditions present to do a χ^{2} -test, but this is the way we”ll find our expected values.) Enter [A ] for Observed and [B ] for Expected (you can paste “[A ]” by entering MATRIX NAMES [A ]). Then choose Calculate . The calculator will return some things we don”t care about yet (*X* ^{2} = 10.748, *p* = 0.0046, and df = 2). Now return to the MATRIX menu and select NAMES [B ] and press ENTER . You should get the following matrix of expected values:

Note that the entry in the second row and second column, 45.925, agrees with our hand calculation for “Exp” in the previous example.

The χ^{2} -test for independence can be summarized as follows.

**example:** A study of 150 randomly selected cities was conducted to determine if crime rate is associated with outdoor temperature. The results of the study are summarized in the following table:

Do these data provide evidence, at the 0.02 level of significance, that the crime rate is associated with the temperature at the time of the crime?

**solution:**

*H* _{0} : The crime rate is independent of temperature (or, *H* _{0} : Crime Rate and Temperature are not associated).

*H* _{A}_{ }: The crime rate is not independent of temperature (or, *H* _{A}_{ }: Crime Rate and Temperature are associated).

**II** . We will use a chi-square test for independence.

The cities were randomly selected.

A matrix of expected values (using the TI-83/84 as explained in the previous Calculator Tip) is found to be:

. Since all expected values are greater than 5, the conditions

are present for a chi-square test.

**III.** , df = (3 – 1)(3 – 1) = 4

⇒ 0.01 < *P* -value < 0.02 (from Table C; or *P-* value = DISTR χ^{2} cdf(12.92,1000,410)=0.012 ).

(Note that the entire problem could be done by entering the observed values in MATRIX [A] and using STAT TESTS χ^{2} -Test .]

**IV** . Since *P* < 0.02, we reject *H* _{0}_{ }. We have strong evidence that the number of crimes committed is related to the temperature at the time of the crime.

**Chi-Square Test for Homogeneity of Proportions (or Homogeneity of Populations)**

In the previous section, we tested for the independence of two categorical variables measured on a single population. In this section we again use the chi-square statistic but will investigate whether or not the values of a single categorical variable are proportional among two or more populations. In the previous section, we considered a situation in which a sample of 36 students was selected and were then categorized according to gender and political party preference. We then asked if gender and party preference are independent in the population. Now suppose instead that we had selected a random sample of 20 males from the population of males in the school and another, independent, random sample of 16 females from the population of females in the school. Within each sample we classify the students as Democrat, Republican, or Independent. The results are presented in the following table, which you should notice is *exactly* the same table we presented earlier when gender was a category.

Because “Male” and “Female” are now considered separate populations, we do not ask if gender and political party preference are independent in the population of students. We ask instead if the proportions of Democrats, Republicans, and Independents are the same within the populations of Males and Females. This is the test for homogeneity of proportions (or homogeneity of populations). Let the proportion of Male Democrats be *p* _{1} ; the proportion of Female Democrats be *p* _{2} ; the proportion of Male Republicans be *p* _{3} ; the proportion of Female Republicans be *p* _{4} ; the proportion of Independent Males be *p* _{5} ; and the proportion of Independent Females be *p* _{6} . Our null and alternative hypotheses are then

*H* _{0} : *p* _{1} = *p* _{2} , *p* _{3} = *p* _{4} , *p* _{5} = *p* _{6} .

*H* _{A}_{ }: Not all of the proportions stated in the null hypothesis are true.

It works just as well, and might be a bit easier, to state the hypotheses as follows.

*H* _{0} : The proportions of Democrats, Republicans, and Independents are the same among Male and Female students.

*H* _{A}_{ }: Not all of the proportions stated in the null hypothesis are equal.

For a given two-way table the expected values are the same under a hypothesis of homogeneity or independence.

**example:** A university dean suspects that there is a difference between how tenured and nontenured professors view a proposed salary increase. She randomly selects 20 nontenured instructors and 25 tenured staff to see if there is a difference. She gets the following results.

Do these data provide good statistical evidence that tenured and nontenured faculty differ in their attitudes toward the proposed salary increase?

**solution:**

- Let
*p*_{1}= the proportion of tenured faculty who favor the plan and let*p*_{2}= the proportion of nontenured faculty who favor the plan.

*H* _{0} : *p* _{1} = *p* _{2} .

*H* _{A}_{ }: *p* _{1} ≠ *p* _{2} .

**II** . We will use a chi-square test for homogeneity of proportions. The samples of tenured and nontenured instructors are given as random. We determine that the expected values are given by the matrix Because all expected values are greater than 5, the conditions for the test are present.

**III** . *X* ^{2} = 1.78, df = (2 – 1)(2 – 1) = 1 ⇒ 0.15 < *P* -value < 0.20 (from Table C; on the TI-83/84: *P* = χ^{2} cdf(1.78,1000,1) = 0.182 ).

**IV** . The *P* -value is not small enough to reject the null hypothesis. These data do not provide strong statistical evidence that tenured and nontenured faculty differ in their attitudes toward the proposed salary plan.

*X* ^{2} = *z* ^{2}

The example just completed could have been done as a two-proportion *z* -test where *p* _{1} and *p* _{2} are defined the same way as in the example (that is, the proportions of tenured and nontenured staff that favor the new plan). Then

and

Computation of the *z* -test statistics for the two-proportion *z* -test yields *z* = 1.333. Now, *z* ^{2} = 1.78. Because the chi-square test and the two-proportion *z* -test are testing the same thing, it should come as little surprise that *z* ^{2}equals the obtained value of *X* ^{2} in the example. For a 2 × 2 table, the *X* ^{2} test statistic and the value of *z* ^{2} obtained for the same data in a two-proportion *z* -test are the same. Note that the *z* -test is somewhat more flexible in the case that a one-sided test allows us to consider a particular direction of difference, whereas the chi-square test has only one tail and does not allow us to test for a particular direction of the difference. However, this advantage only holds for a 2 × 2 table since there is no way to use a simple *z* -test for situations with more than two rows and two columns.

**Digression:** You aren”t required to know these, but you might be interested in the following (unexpected) facts about a χ^{2} distribution with *k* degrees of freedom:

- The
*mean*of the χ^{2}distribution =*k*. - The
*median*of the χ^{2}distribution (*k*> 2) ≈*k*– ⅔. - The
*mode*of the χ^{2}distribution =*k*– 2. - The
*variance*of the χ^{2}distribution = 2*k*.

** Rapid Review**

- A study yields a chi-square statistic value of 20 (
*X*^{2}= 20). What is the*P*-value of the test if - the study was a goodness-of-fit test with
*n*= 12? - the study was a test of independence between two categorical variables, the row variable with 3 values and the column variable with 4 values?

*Answer:*

*n*= 12 ⇒ df = 12 – 1 = 11 ⇒ 0.025 <*P*< 0.05.

(Using the TI-83/84: *χ* ^{2} cdf(20,1000,11) = 0.045.)

*r*= 3,*c*= 4 ⇒ df. = (3 – 1)(4 – 1) = 6 ⇒ 0.0025 <*P <*0.005.

(Using the TI-83/84: *χ* ^{2} cdf(20,1000,6) = 0.0028.)

2–4. The following data were collected while conducting a chi-square test for independence:

- What null and alternative hypotheses are being tested?

*Answer:*

*H* _{0} : Gender and Preference are independent (or: *H* _{0} : Gender and Preference are not associated).

*H* _{A}_{ }: Gender and Preference are not independent (*H* _{A}_{ }: Gender and Preference are associated).

- What is the expected frequency of the cell marked with the X?

*Answer:* Identifying the marginals on the table we have

Since there are 34 values in the column with the X, we expect to find of each row total in the cells of the first column. Hence, the expected value for the cell containing *X* is .

- How many degrees of freedom are involved in the test?

*Answer:* df = (2 – 1)(3 – 1) = 2.

- The null hypothesis for a chi-square goodness-of-fit test is given as:

*H* _{0} : *p* _{1} = 0.2, *p* _{2} = 0.3, *p* _{3} = 0.4, *p* _{4} = 0.1. Which of the following is an appropriate alternative hypothesis?

*H*_{A}_{ }:*p*_{1}≠ 0.2,*p*_{2}≠ 0.3,*p*_{3}≠ 0.4,*p*_{4}≠ 0.1.*H*_{A}_{ }:*p*_{1}=*p*_{2}=*p*_{3}=*p*_{4}.*H*_{A}_{ }: Not all of the proportions stated in*H*_{0}are correct.*H*_{A}_{ }:*p*_{1}≠*p*_{2}≠*p*_{3}≠*p*_{4}.

*Answer:* c

**Practice Problems**

**Multiple-Choice**

__Find the expected frequency of the cell marked with the “***” in the following 3 × 2 table (the bold face values are the marginal totals):__- 74.60
- 18.12
- 12.88
- 19.65
- 18.70
__A__*χ*^{2}goodness-of-fit test is performed on a random sample of 360 individuals to see if the number of birthdays each month is proportional to the number of days in the month.*X*^{2}is determined to be 23.5. The*P*-value for this test is- 0.001 <
*P*< 0.005 - 0.02 <
*P*< 0.025 - 0.025 <
*P*< 0.05 - 0.01 <
*P*< 0.02 - 0.05 <
*P*< 0.10 __Two random samples, one of high school teachers and one of college teachers, are selected and each sample is asked about their job satisfaction. Which of the following are appropriate null and alternative hypotheses for this situation?__*H*_{0}: The proportion of each level of job satisfaction is the same for high school teachers and college teachers.

*H* _{A}_{ }: The proportions of teachers highly satisfied with their jobs is higher for college teachers.

*H*_{0}: Teaching level and job satisfaction are independent.

*H* _{A}_{ }: Teaching level and job satisfaction are not independent.

*H*_{0}: Teaching level and job satisfaction are associated.

*H* _{A}_{ }: Teaching level and job satisfaction are not associated.

*H*_{0}: The proportion of each level of job satisfaction is the same for high school teachers and college teachers.

*H* _{A}_{ }: Not all of the proportions of each level of job satisfaction are the same for high school teachers and college teachers.

*H*_{0}: Teaching level and job satisfaction are independent.

*H* _{A}_{ }: Teaching level and job satisfaction are not associated.

__A group separated into men and women are asked their preference toward certain types of television shows. The following table gives the results.__

Which of the following statements is (are) true?

- The variables gender and program preference are independent.
- For these data,
*X*^{2}= 0.

III. The variables gender and program preference are related.

- I only
- I and II only
- II only
- III only
- II and III only
__For the following two-way table, compute the value of__*X*^{2}.- 2.63
- 1.22
- 1.89
- 2.04
- 1.45
__The main difference between a__*χ*^{2}test for independence and a*χ*^{2}test for homogeneity of proportions is which of the following?- They are based on a different number of degrees of freedom.
- One of the tests is for a two-sided alternative and the other is for a one-sided alternative.
- In one case, two variables are compared within a single population. In the other case, two populations are compared in terms of a single variable.
- For a given value of
*X*^{2}, they have different*P*-values. - There are no differences between the tests. They measure exactly the same thing.
__A study is to be conducted to help determine if ethnicity is related to blood type. Ethnic groups are identified as White, African-American, Asian, Latino, or Other. Blood types are A, B, O, and AB. How many degrees of freedom are there for a chi-square test of independence between Ethnicity and Blood Type?__- 5 × 4 = 20
- 5 × 3 = 15
- 4 × 4 = 16
- 5 + 4 – 2 = 7
- 4 × 3 = 12
__Which of the following statements is (are) correct?__- A condition for using a
*χ*^{2}test is that most expected frequencies must be at least 5 and that all must be at least 1. - A
*χ*^{2}test for goodness of fit tests the degree to which a categorical variable has a specific distribution.

III. Expected cell frequencies are computed in the same way for goodness of fit tests and tests of independence.

- I only
- II only
- I and II only
- II and III only
- I, II and III

**Free-Response**

__An AP Statistics student noted that the probability distribution for a binomial random variable with__*n*= 4 and*p*= 0.3 is approximately given by:

(Note: Σ*p* = 1.001 rather than 1 due to rounding.)

The student decides to test the randBin function on her TI-83/84 by putting 500 values into a list using this function (randBin(4,0.3,500) → L1 ) and counting the number of each outcome. (Can you think of an efficient way to count each outcome?) She obtained

Do these data provide evidence that the randBin function on the calculator is correctly generating values from this distribution?

**Calculator Tip:** It”s a bit of a digression, but if you actually wanted to do the experiment in question 1, you would need to have an efficient way of counting the number of each outcome. You certainly don”t want to simply scroll through all 500 entries and tally each one. Even sorting them first and then counting would be tedious (more so if *n* were bigger than 4). One easy way is to draw a histogram of the data and then TRACE to get the totals. Once you have your 500 values from randBin in L1 , go to STAT PLOTS and set up a histogram for L1 . Choose a WINDOW something like [–0.5,4.5,1,–1,300,1,1 ]. Be sure that Xscl is set to 1. You may need to adjust the Ymax from 300 to get a nice picture on your screen. Then simply TRACE across the bars of the histogram and read the value of *n* for each outcome off of the screen. The reason for having *x* go from –0.5 to 4.5 is so that the (integer) outcomes will be in the middle of each bar of the histogram.

__A chi-square test for the homogeneity of proportions is conducted on three populations and one categorical variable that has four values. Computation of the chi-square statistic yields__*X*^{2}= 17.2. Is this result significant at the 0.01 level of significance?__Which of the following best describes the difference between a test for independence and a test for homogeneity of proportions? Discuss the correctness of each answer.__- There is no difference because they both produce the same value of the chi-square test statistic.
- A test for independence has one population and two categorical variables, whereas a test for homogeneity of proportions has more than one population and only one categorical variable.
- A test for homogeneity of proportions has one population and two categorical variables, whereas a test for independence has more than one population and only one categorical variable.
- A test for independence uses count data when calculating chi-square and a test for homogeneity uses percentages or proportions when calculating chi-square.
__Compute the expected frequency for the cell that contains the frog. You are given the marginal distribution.____Restaurants in two parts of a major city were compared on customer satisfaction to see if location influences customer satisfaction. A random sample of 38 patrons from the Big Steak Restaurant in the eastern part of town and another random sample of 36 patrons from the Big Steak Restaurant on the western side of town were interviewed for the study. The restaurants are under the same management, and the researcher established that they are virtually identical in terms of decor, service, menu, and food quality. The results are presented in the following table.__

Do these data provide good evidence that location influences customer satisfaction?

__A chi-square test for goodness of fit is done on a variable with 15 categories. What is the minimum value of__*X*^{2}necessary to reject the null hypothesis at the 0.02 level of significance?__The number of defects from a manufacturing process by day of the week are as follows:__

The manufacturer is concerned that the number of defects is greater on Monday and Friday. Test, at the 0.05 level of significance, the claim that the proportion of defects is the same each day of the week.

__A study was done on opinions concerning the legalization of marijuana at Mile High College. One hundred fifty-seven respondents were randomly selected from a large pool of faculty, students, and parents at the college. Respondents were given a choice of favoring the legalization of marijuana, opposing the legalization of marijuana, or favoring making marijuana a legal but controlled substance. The results of the survey were as follows.__

Do these data support, at the 0.05 level, the contention that the type of respondent (student, faculty, or parent) is related to the opinion toward legalization? Is this a test of independence or a test of homogeneity of proportions?

**Cumulative Review Problems**

Use the computer output given below to answer Questions 1 and 2.

__Based on the computer output above, what conclusion would you draw concerning__*H*_{0}:*β*= 0? Justify your answer.__Use the computer output above to construct a 99% confidence interval for the slope of the regression line (__*n*= 8). Interpret your interval.__If you roll two dice, the probability that you roll a sum of 10 is approximately 0.083.__- What is the probability that you first roll a 10 on the 10th roll?
- What is the average number of rolls until you first roll a 10?
__An experiment is conducted by taking measurements of a personality trait on identical twins and then comparing the results for each set of twins. Would the analysis of the results assume two independent populations or proceed as though there were a single population? Explain.____The lengths and widths of a certain type of fish were measured and the least-squares regression line for predicting width from length was found to be: 0.193 (__*length*). The graph that follows is a residual plot for the data:- The fish whose width is 3.8 had a length of 25.5. What is the residual for this point?
- Based on the residual plot, does a line seem like a good model for the data?

**Solutions to Practice Problems**

**Multiple-Choice**

__The correct answer is (c). The expected value for that cell can be found as follows: .____The correct answer is (d). Since there are 12 months in a year, we have__*n*= 12 and df = 12 – 1 = 11. Reading from Table C, 0.01 <*P-*value < 0.02. The exact value is given by the TI-83/84 as*χ*^{2}cdf(23.5,1000,11)=0.015.__The correct answer is (d). Because we have independent random samples of teachers from each of the two levels, this is a test of homogeneity of proportions. It would have been a test of independence if there was only one sample broken into categories (correct answer would be (b) in that case).____The correct answer is (b). The expected values for the cells are exactly equal to the observed values; e.g., for the 1st row, 1st column, , so__*X*^{2}must equal 0 ⇒the variables are independent, and are not related.__The correct answer is (e). The expected values for this two-way table are given by the matrix:__

Then,

__The correct answer is (c). In a__*χ*^{2}test for independence, we are interested in whether or not two categorical variables, measured on a single population, are related. In a*χ*^{2}test for homogeneity of proportions, we are interested in whether two or more populations have the same proportions for each of the values of a single categorical variable.__The correct answer is (e). Using Ethnicity as the row variable, there are five rows (__*r*= 5) and four columns (*c*= 4). The number of degrees of freedom for an*r*×*c*table is (*r*– 1)(*c*– 1). In this question, (5 – 1)(4 – 1) = 4 × 3 = 12.__The correct answer is (c). In III, the expected count for each category in a goodness-of-fit test is found by multiplying the proportion of the distribution of each category by the sample size. The expected count for a test of independence is found by multiplying the row total by the column total and then dividing by__*n*.

**Free-Response**

__1.__

- Let
*p*_{1}= the proportion of 0s,*p*_{2}= the proportion of 1s,*p*_{3}= the proportion of 2s,*p*_{4}= the proportion of 3s, and*p*_{5}= the proportion of 4s.

*H* _{0} : *p* _{1} = 0.24, *p* _{2} = 0.41, *p* _{3} = 0.27, *p* _{4} = 0.07, *p* _{5} = 0.01.

*H* _{A}_{ }: Not all of the proportions stated in *H* _{0} are correct.

**II** . We will use a chi-square goodness-of-fit test. The observed and expected values for the 500 trials are shown in the following table:

We note that all expected values are at least 5, so the conditions necessary for the chi-square test are present.

**III** . , df = 4 ⇒ 0.10 < *P* -value < 0.15 (from Table C). Using the TI-83/84, *χ* ^{2} cdf(6.79,1000,40)= 0.147.

**IV** . The *P-* value is greater than any commonly accepted significance level. Hence, we do not reject *H* _{0} and conclude that we do not have good evidence that the calculator is not correctly generating values from *B* (4, 0.3).

__For a 3 × 4 two-way table, df = (3 – 1)(4 – 1) = 6 ⇒ 0.005 <__*P*-value < 0.01 (from Table C). The finding is significant at the 0.01 level of significance. Using the TI-83/84,*P*-value =*χ*^{2}cdf(17.2,1000,6)=0.009.__(a) is not correct. For a given set of observations, they both do produce the same value of chi-square. However, they differ in that they are different ways to design a study. (b) is correct. A test of independence hypothesizes that two categorical variables are independent within a given population. A test for homogeneity of proportions hypothesizes that the proportions of the values of a single categorical variable are the same for more than one population. (c) is incorrect. It is a reversal of the actual difference between the two designs. (d) is incorrect. You always use count data when computing chi-square.____The expected value of the cell with the frog is .____Based on the design of the study this is a test of homogeneity of proportions.__*H*_{0}: The proportions of patrons who rate the restaurant Excellent, Good, Fair, and Poor are the same for the Eastern and Western sides of town.

*H* _{A}_{ }: Not all the proportions are the same.

**II** . We will use the chi-square test for homogeneity of proportions.

Calculation of expected values (using the TI-83/84). yields the following results:

Since all expected values are at least 5, the conditions necessary for this test are present.

**III** . , df = (2 – 1)(4 – 1) = 3 ≠ *P* -value > 0.25 (from Table C). *χ* ^{2} cdf(2.86,1000,3)=0.414.

**IV** . The *P-* value is larger than any commonly accepted significance level. Thus, we cannot reject *H* _{0} . We do not have evidence that location influences customer satisfaction.

__If__*n*= 15, then df = 15 – 1 = 14. In the table we find the entry in the column for tail probability of 0.02 and the row with 14 degrees of freedom. That value is 26.87. Any value of*X*^{2}larger than 26.87 will yield a*P*-value less than 0.02.- Let
*p*_{1}be the true proportion of defects produced on Monday.

Let *p* _{2} be the true proportion of defects produced on Tuesday.

Let *p* _{3} be the true proportion of defects produced on Wednesday.

Let *p* _{4} be the true proportion of defects produced on Thursday.

Let *p* _{5} be the true proportion of defects produced on Friday.

*H* _{0} : *p* _{1} = *p* _{2} = *p* _{3} = *p* _{4} = *p* _{5} (the proportion of defects is the same each day of the week.)

*H* _{A}_{ }: At least one proportion does not equal the others (the proportion of defects is not the same each day of the week).

**II** . We will use a chi-square goodness-of-fit test. The number of expected defects is the same for each day of the week. Because there was a total of 150 defects during the week, we would expect, if the null is true, to have 30 defects each day. Because the number of expected defects is greater than 5 for each day, the conditions for the chi-square test are present.

**III** .

*P-* value < 0.15 (from Table C). (*χ* ^{2} cdf(7.533.1000,4) = 0.11; or, you could use the *χ* ^{2} GOF–Test in the STAT TESTS menu of a TI-84 if you have it.)

**IV** . The *P* -value is larger than any commonly accepted significance level. We do not have strong evidence that there are more defects produced on Monday and Friday than on other days of the week.

__Because we have a single population from which we drew our sample and we are asking if two variables are related__*within*that population, this is a chi-square test for independence.*H*_{0}: Type of respondent and opinion toward the legalization of marijuana are independent.

*H* _{A}_{ }: Type of respondent and opinion toward the legalization of marijuana are not independent.

**II** . We will do a *χ* ^{2} test of independence. The following table gives the observed and expected values for this situation (expected values are the second row in each cell; the expected values were calculated by using the MATRIXfunction and the *χ* ^{2} –Test item in the STAT TESTS menu):

Since all expected values are at least 5, the conditions necessary for the chi-square test are present.

**III.** , df = (3 – 1)(3 – 1) = 4 ⇒ 0.025 < *P* -value < 0.05 (from Table C).

(Using the TI-83/84, *P* -value = *χ* ^{2} cdf(10.27,1000,4)=0.036.)

**IV** . Because *P* < 0.05, reject *H* _{0} . We have evidence that the type of respondent is related to opinion concerning the legalization of marijuana.

**Solutions to Cumulative Review Problems**

__The__*t*-test statistic for the slope of the regression line (under*H*_{0}:*β*= 0) is 6.09. This translates into a*P*-value of 0.002, as shown in the printout. This low*P*-value allows us to reject the null hypothesis. We conclude that we have strong evidence of a linear relationship between*X*and*Y*.__For__*C*= .99 (a 99% confidence interval) at df =*n*– 2 = 6,*t** = 3.707. The required interval is 3.9795 ± 3.707(.6529) = (1.56, 6.40). We are 99% confident that the true slope of the population regression line lies between 1.56 and 6.40.__a. This is a geometric distribution problem. The probability that the first success occurs on the 10th roll is given by__*G*(10) = (0.083)(1 – 0.083) = 0.038. (On the TI-83/84,*G*(10) = geometpdf(0.083,10)=0.038.)- . On average, it will take about 12 rolls before you get a 10. (Actually, it”s
*exactly*12 rolls on average since the*exact*probability of rolling a 10 is , not 0.083, and __This is an example of a__*matched pairs design*. The identical twins form a block for comparison of the treatment. Statistics are based on the differences between the scores of the pairs of twins. Hence this is a one-variable situation—one population of values, each constructed as a difference of the matched pairs.__a. Residual = actual – predicted = 3.8 – [–0.826 + 0.193(25.5)] = 3.8 – 4.096 = −0.296.__- There does not seem to be any consistent pattern in the residual plot, indicating that a line is probably a good model for the data.

**CHAPTER 14**

**Inference for Categorical Data: Chi-Square**

- The owner of a small manufacturing business is attempting to determine whether accidents are more likely during a particular shift. The same number of employees work during each shift, and the number of accidents that have occurred during each shift since the company opened are recorded in the table.

How many degrees of freedom are required for the appropriate chi-square test?

(A) 2

(B) 3

(C) 64

(D) 65

(E) 66

- A random sample of 150 students was taken at a large high school. Among other things, students were asked their gender and their eye color. The data are summarized in the table.

In performing a chi-square test for independence between these two variables, what is the expected number of green-eyed females?

(A) 12

(B) 15

(C) 16

(D) 18.75

(E) 20

- The difference between a chi-square test for independence and a chi-square test for homogeneity is

(A) how the data are collected.

(B) the way the number of degrees of freedom is calculated.

(C) how the *P* -value is related to the chi-square test statistic.

(D) the way expected frequencies are calculated.

(E) whether the test is one-sided or two-sided.

- Researchers at an urban high school surveyed 150 randomly selected students, asking their grade level and their opinion on the selected theme for the homecoming dance. The results of the survey are displayed in the table.

The researchers conducted a chi-square test of independence, with a 5% level of significance, to determine whether there is an association between grade level and opinion on the theme for all students in the school. They got a test statistic of 2.93. Which of the following is the correct conclusion and reason?

(A) They should conclude that there is insufficient evidence of an association between grade level and opinion on the theme because the test statistic is greater than 0.05.

(B) They should conclude that there is evidence of an association between grade level and opinion on the theme because the table shows that as grade level increases, the proportion of students who approve tends to increase.

(C) They should conclude that there is evidence of an association between grade level and opinion on the theme because the test statistic is higher than the critical value for 3 degrees of freedom.

(D) They should conclude that there is no evidence of an association between grade level and opinion on the theme because the test statistic is higher than the critical value for 3 degrees of freedom.

(E) They should conclude that there is no evidence of an association between grade level and opinion on the theme because the test statistic is lower than the critical value for 3 degrees of freedom.

- A quality control manager of a company that produces, among other things, parts for games wants to be sure the dice produced by the company are fair. An employee is told to take a single die, roll it 10,000 times, and record the number of times each face appears. Instead, he rolls it 100 times and multiplies the result by 100. Which of the following describes a likely effect of this approach on the chi-square test results?

(A) Because the chi-square test is based on each face appearing one-sixth of the time, the number of trials should not affect the chi-square statistic. This approach is valid.

(B) Multiplying the frequencies by 100 will multiply the chi-square statistic by 100, making the test much more powerful. As a result, an unfair die is more likely to be detected.

(C) With the lower number of trials, we expect greater variation in proportions, so the chi-square statistic will probably be too large, resulting in a greater chance of a fair die being labeled unfair.

(D) With the lower number of trials, we expect smaller differences between observed and expected frequencies, so the chi-square statistic will probably be too small, resulting in a greater chance of an unfair die being labeled fair.

(E) With the lower number of trials, there is more bias in the results, so there is a greater chance of a fair die being labeled unfair.

** Answers**

**A****C****A****E****C**