multinomial experiments goodness of fit tests we have just seen an example of comparing two...

21
Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution as a sampling distribution. We will now look an problems where we compare more than two proportions. We will not be able to use the normal distribution, but will use a different distribution called the Chi-Square or Χ 2 Distribution. Consider the problem of testing a die to see if it is unfair. The die has six numbers, all equally likely. If die is fair, then each number should have a probability of 1/6. In the long run, each number will come up 1/6 of the number of rolls. Suppose weI take a sample of 60 rolls. Theoretically, each number should come up 1/6*60 = 10 times. If the numbers are not all 10, either the die is not fair, or, the die is fair, and the numbers different from 10 are explained by sampling variation. 1 Section 11.2, Page 241

Upload: bernardo-hamm

Post on 16-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Multinomial ExperimentsGoodness of Fit Tests

We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution as a sampling distribution.

We will now look an problems where we compare more than two proportions. We will not be able to use the normal distribution, but will use a different distribution called the Chi-Square or Χ2 Distribution.

Consider the problem of testing a die to see if it is unfair. The die has six numbers, all equally likely. If die is fair, then each number should have a probability of 1/6. In the long run, each number will come up 1/6 of the number of rolls.

Suppose weI take a sample of 60 rolls. Theoretically, each number should come up 1/6*60 = 10 times. If the numbers are not all 10, either the die is not fair, or, the die is fair, and the numbers different from 10 are explained by sampling variation.

To sort this out, I need a hypotheses test, a sampling distribution, and a p-value.

1Section 11.2, Page 241

Page 2: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Goodness of Fit TestFair Die Example

Following is the distribution of the observed frequencies of results from rolling a die 60 times. Is the die fair?

The hypotheses are as follows:

Clearly, the observed frequencies are not all equal to the theoretical frequencies of 10. We need a way to measure how big the “miss” is to see if it likely to be due to sampling variation, or if it is so large as to not be explained by sampling variation.

2Section 11.2, Page 243

Page 3: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Chi Square StatisticFair Die Example

We calculate the “miss” called the chi-square statistic similarly to the way we calculate the variance.

Note that the expected frequencies always equal the total number of observations × Ho true proportion for each cell or proportion. Also note that the total expected frequencies always equals the total observed frequencies.

The χ2 Statistic is the Total, 2.2. Also, note that minimum value of the χ2 is zero. If we took another sample, we would likely get a different value for the chi-square statistic.

3Section 11.1, Page 241

Page 4: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Chi-Square DistributionFair Die Example

Now we need a sampling distribution for the Χ2 statistic = 2.2, so we can calculate the probability of getting a Χ2 ≥ 2.2 when the true proportions are all equal to 1/6.

Χ2 Distribution for 5 df

This is a distribution of all possible Χ2 statistics calculated from all possible samples of 60 observations when there are 6 proportions or cells. Note that the degree of freedom equals the number of proportions – 1.

Finding the p-value on the TI-83, Given Χ2 Stat, df

PRGM – CHI2DISTLOWER BOUND: 2.2UPPER BOUND: 2ND E99df: 5Output: P-VALUE = 0.8208The null hypothesis cannot be rejected.

4Section 11.2, Page 242

Page 5: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Chi-Square DistributionConditions

The sample is random and the observed data represents counts of of individuals in individual categories of a categorical variable

Each expected count is 5 or greater

5Section 11.1, Page 240

Page 6: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Goodness of Fit TestFair Die Example – TI-83 Add-In

Following is the distribution of the observed frequencies of results from rolling a die 60 times. Is the die fair?

The hypotheses are as follows:

6Section 11.2, Page 243

Each expected cell = 1/6*60 = 10.

STAT-EDIT – LI: Enter the observed frequency numbersL2: Enter the expected values, 10 in each of 6 cells.PRGM – GOODFITOBSERVED LIST = 2ND L1EXPECTED LIST = 2ND L2Answer: p-value = .8208, Chi-Square Stat = 2.2Since p-value > ,05, Ho cannot be rejected.

Page 7: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Goodness of Fit TestMendelian Theory Problem

Mendel’s genetic theory of inheritance claims that the frequencies of round and yellow, wrinkled and yellow, round and green, and wrinkled and green peas will occur in the ratio of 9:3:3:1. In testing the theory, Mendel obtained frequencies of 315, 101, 108, and 32 respectively. Does the data contradict the theory. Do a hypotheses test.

Ho: The data fits the theoryHa: The data does not fit the theory.

Calculation of Expected Values

Observed Expected Proportions

Expected Count

315 9/16 9/16 *556 = 312.75

101 3/16 3/16 * 556 = 104.25

108 3/16 3/16 *556 = 104.25

32 1/16 1/16 *556= 34.75

Total = 556 Total = 1 Total = 556

7Section 11.2, Page 245

Page 8: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Goodness of Fit TestMendelian Theory Problem

Observed Expected Proportions

Expected Count

315 9/16 9/16 *556 = 312.75

101 3/16 3/16 * 556 = 104.25

108 3/16 3/16 *556 = 104.25

32 1/16 1/16 * 556 = 34.75

Total = 556 Total = 1 Total = 556

STAT – EDIT: Enter observed data in L1 and expected in L2

PRGM – GOODFITOBSERVED LIST = 2ND L1EXPECTED LIST = 2ND L2Answer: p-value = .9254, Chi-Square Stat = .47The null hypothesis cannot be rejected. The observed data does not contradict the theory

8Section 11.2, Page 245

Page 9: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

a. Perform a hypotheses test to see if the preferences are not all the same. State the hypotheses.

b. Find the p-value and state your conclusionc. What is the name of the model used for the

sampling distribution?

9Problems, Page 252

Page 10: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

a. Perform a hypotheses test to see of the observed data is inconsistent with the stated ratios. State the appropriate hypotheses.

b. Find the expected counts for each color.c. What are the necessary conditions for the

sampling distribution?d. What is the name of the model used for the

sampling distribution?e. Find the p-value and state your conclusion.

10Problems, Page 252

Page 11: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Test for IndependenceFollowing is a two way table. In this case, two categorical variables are measured on one group of college students. For each student, their Gender and Favorite Subject Area are recorded.

Independence of Two VariablesConsider the Social Science category. 113/300 or 38% of all students chose Social Science. However, 41/122 or 34% of males chose the category and 72/178 or 40% of Females chose the category. Considering this a probability distribution, if I pick a person at random, there is a 38% chance the person chose Social Science. However, it you tell me the person is a female, then the probability is 40% they chose the category.This is an indication that the two variables are not independent, but related. Two variables are independent, if knowing the outcome of one variable does not change the probability of the outcome of the other variable.

11Section 11.3, Page 246

Page 12: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Tests for Independence

The sample data gives an indication the variables are not independent, but this indication may be due to sampling variation.To test for independence, we will use Chi-Square methods. The appropriate hypotheses are:

Ho: The variables are independentHa: The variables are not independent

Next, we need to calculate the expected values for each cell of the data matrix under the assumption that the variables are independent. For example, if the variables are independent, then the the overall proportion of of students in the Social science category is 113/300 = .3767. Both the proportions for the category have to be the same. The expected value for Males is 0.3767*122= 45.95 and the expected values for Females is 0.3767*178 = 67.05.

12Section 11.3, Page 248

Page 13: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Test for Independence

Shown above in the parentheses are all the expected values. Next we need to calculate the χ2 statistic for each data cell. For example, for the first cell: (37-29.28)2/29.28 = 2.0355.

Adding up the cell calculations for the 6 cells gives total χ2 statistic of 4.604. The formula for df =(#rows – 1)*(#columns – 1) = (2-1)*(3-1) = 2.

The area under the curve to the right of 4.604 = .1001 > .05. The null hypotheses cannot be rejected.

13Section 11.3, Page 248

Page 14: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Test for IndependenceBlack Box Program

Ho: The variables are independentHa: The variables are not independent

2nd MATRIX – EDIT2 ENTER 3 (The data table is 2 rows and 3 columns. Ignore total row and total column)Enter the data in matrix [A] left to rightSTAT-TESTS-C:χ2-TESTObserved: [A]Expected: [B]CalculateAnswer: p-value = .0999, χ2-Stat = 4.60632nd MATRIX – EDIT – [B] – ENTERDisplays the Expected Values MatrixAll cells ≥ 5; conditions satisfied

14Section 11.3, Page 248

Page 15: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

a. Test the hypotheses that the size of community reared in is independent of the size of community residing in. State the appropriate hypotheses.

b. Find the p-value and state your conclusionc. What is the name of the sampling

distribution?d. What are the necessary conditions, and are

they satisfied? What is the value of the smallest expected cell?

15Section 11.3, Page 254

Page 16: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

a. Test the hypotheses that years of employment and knowing what supervisor expects are independent. State the appropriate hypotheses.

b. Find the p-value and state your conclusionc. What is the name of the sampling

distribution?d. What are the necessary conditions, and are

they satisfied? What is the value of the smallest expected cell?

16Section 11.3, Page 254

Page 17: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Tests for HomogeneityAnother application of Chi-Square procedures is test for homogeneity, or essentially, a test whether different groups have the same distribution for a given variable. Consider the table below that gives voter’s opinion on a proposal broken down by separate locations.

In the case of a test for independence, we had one group of individuals and measure two categorical variables in that group.In the case of a test for homogeneity, we have one categorical variable, Opinion on Proposal, and three separately located groups of voters. The hypothesis are:

Ho: The distributions are homogeneousHa: The distributions are not homogeneous

17Section 11.3, Page 250

Page 18: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Tests for HomogeneityThe mechanics for a test of homogeneity are exactly the same as for a test of independence. We calculate the expected values under the assumption Ho is true.

The proportion favor are all assumed to be 254/500 = .5080. The expected value for urban is .5080*200 = 101.6. The χ2 Stat for cell 1 = (143-101.6)2/101.6 = 16.8897. The total χ2 statistic for all cells is 91.72.

The df = 2 and the p-value = 1.21E-20 ≅ 0Ho is rejected, the distributions are not the same.

18Section 11.3, Page 251

Page 19: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

19Section 11.3, Page 255

a. State the hypotheses.b. Find the p-value and state your

conclusion.c. What is the name of the model used

for the sampling distribution.d. What is the value of the smallest

expected cell?

Page 20: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Problems

20Section 11.3, Page 255

a. State the hypotheses.b. Find the p-value and state your

conclusion.c. What is the name of the model used for

the sampling distribution.d. What is the value of the smallest expected

cell?

Page 21: Multinomial Experiments Goodness of Fit Tests We have just seen an example of comparing two proportions. For that analysis, we used the normal distribution

Summary of Chi-Square Applications

Goodness of Fit TestGiven one categorical variable with a fixed set of proportions for the categories. Ha: The observed data does not fit the proportions.Calculate expected values (Ho true proportion * total observations)Observed and Expected data in List EditorPRGM: GOODFIT

Test for IndependenceGiven two categorical variables measured on the same population.Ha: The variables are not independent (They are related)Observed data in Matrix EditorStat-Tests-χ2 Test

Test for HomogeneityGiven one categorical variable and two or more populations.Ha: The proportions for the categories are not the same for for all populations.Observed data in Matrix EditorStat-Tests-χ2 Test

21Chapter 12, Summary