Download presentation
Presentation is loading. Please wait.
Published byCatherine Rose Modified over 9 years ago
1
Test of Goodness of Fit Lecture 43 Section 14.1 – 14.3 Fri, Apr 8, 2005
2
Count Data Count data – Data that counts the number of observations that fall into each of several categories. Count data – Data that counts the number of observations that fall into each of several categories. The data may be univariate or bivariate. The data may be univariate or bivariate. Bivariate example – Observe a student’s final grade and class: A – F and freshman – senior. Bivariate example – Observe a student’s final grade and class: A – F and freshman – senior.
3
Univariate Example Observe students’ final grade in statistics: A, B, C, D, or F. Observe students’ final grade in statistics: A, B, C, D, or F. ABCDF 512842
4
Bivariate Example Observe students’ final grade in statistics and year in college. Observe students’ final grade in statistics and year in college. ABCDF Fresh36321 Soph14410 Junior12001 Senior01100
5
Observed and Expected Counts Observed counts – The counts that were actually observed in the sample. Observed counts – The counts that were actually observed in the sample. Expected counts – The counts that would be expected if the null hypothesis were true. Expected counts – The counts that would be expected if the null hypothesis were true. In this chapter, we will entertain various null hypotheses. In this chapter, we will entertain various null hypotheses.
6
The Chi-Square Statistic Denote the observed counts by O and the expected counts by E. Denote the observed counts by O and the expected counts by E. Define the chi-square ( 2 ) statistic to be Define the chi-square ( 2 ) statistic to be Clearly, if the observed counts are close to the expected counts, then 2 will be small. Clearly, if the observed counts are close to the expected counts, then 2 will be small. If even a few observed counts are far from the expected counts, then 2 will be large. If even a few observed counts are far from the expected counts, then 2 will be large.
7
Think About It Think About It, p. 853. Think About It, p. 853.
8
Chi-Square Degrees of Freedom The chi-square distribution has an associated degrees of freedom, just like the t distribution. The chi-square distribution has an associated degrees of freedom, just like the t distribution. Each chi-square distribution has a slightly different shape, depending on the number of degrees of freedom. Each chi-square distribution has a slightly different shape, depending on the number of degrees of freedom.
9
Chi-Square Degrees of Freedom 2 (2) 2 (5) 2 (10)
10
Properties of 2 The chi-square distribution with n degrees of freedom has the following properties. The chi-square distribution with n degrees of freedom has the following properties. 2 0. 2 0. It is unimodal. It is unimodal. It is skewed right. It is skewed right. 2 = n. 2 = n. 2 = (2n). 2 = (2n). If n is large, then 2 (n) is approximately N(n, (2n)). If n is large, then 2 (n) is approximately N(n, (2n)).
11
Chi-Square vs. Normal N(30, 60) 2 (30) 2 (32) N(32, 8)
12
Chi-Square vs. Normal 2 (128) N(128, 16)
13
The Chi-Square Table See page 949. See page 949. The left column is degrees of freedom: 1, 2, 3, …, 15, 16, 18, 20, 24, 30, 40, 60, 120. The left column is degrees of freedom: 1, 2, 3, …, 15, 16, 18, 20, 24, 30, 40, 60, 120. The column headings represent upper tails: The column headings represent upper tails: 0.005, 0.01, 0.025, 0.05, 0.10, 0.005, 0.01, 0.025, 0.05, 0.10, 0.90, 0.95, 0.975, 0.99, 0.995. 0.90, 0.95, 0.975, 0.99, 0.995. Of course, the upper tails 0.90, 0.95, 0.975, 0.99, 0.995 are the same as the lower tails 0.10, 0.05, 0.025, 0.01, 0.005. Of course, the upper tails 0.90, 0.95, 0.975, 0.99, 0.995 are the same as the lower tails 0.10, 0.05, 0.025, 0.01, 0.005.
14
Example If df = 10, what value of 2 cuts off an upper tail of 0.05? If df = 10, what value of 2 cuts off an upper tail of 0.05? If df = 10, what value of 2 cuts off a lower tail of 0.05? If df = 10, what value of 2 cuts off a lower tail of 0.05?
15
TI-83 – Chi-Square Probabilities To find a chi-square probability on the TI-83, To find a chi-square probability on the TI-83, Press DISTR. Press DISTR. Select 2 cdf (item #7). Select 2 cdf (item #7). Press ENTER. Press ENTER. Enter the lower endpoint, the upper endpoint, and the degrees of freedom. Enter the lower endpoint, the upper endpoint, and the degrees of freedom. Press ENTER. Press ENTER. The probability appears. The probability appears.
16
Example If df = 32, what is the probability that 2 will fall between 24 and 40? If df = 32, what is the probability that 2 will fall between 24 and 40? Compute 2 cdf(24, 40, 32). Compute 2 cdf(24, 40, 32). If df = 128, what is the probability that 2 will fall between 96 and 160? If df = 128, what is the probability that 2 will fall between 96 and 160? Compute 2 cdf(96, 160, 128). Compute 2 cdf(96, 160, 128). On the other hand, if df = 8, what is the probability that 2 will fall between 4 and 12? On the other hand, if df = 8, what is the probability that 2 will fall between 4 and 12? Compute 2 cdf(96, 160, 128). Compute 2 cdf(96, 160, 128).
17
Tests of Goodness of Fit The goodness-of-fit test applies only to univariate data. The goodness-of-fit test applies only to univariate data. The null hypothesis specifies a discrete distribution for the population. The null hypothesis specifies a discrete distribution for the population. We want to determine whether a sample from that population supports this hypothesis. We want to determine whether a sample from that population supports this hypothesis.
18
Examples If we rolled a die 60 times, we expect 10 of each number. If we rolled a die 60 times, we expect 10 of each number. If we got frequencies 8, 10, 14, 12, 9, 7, does that indicate that the die is not fair? If we got frequencies 8, 10, 14, 12, 9, 7, does that indicate that the die is not fair? If we toss a fair coin, we should get two heads ¼ of the time, two tails ¼ of the time, and one of each ½ of the time. If we toss a fair coin, we should get two heads ¼ of the time, two tails ¼ of the time, and one of each ½ of the time. Suppose we toss a coin 100 times and get two heads 16 times, two tails 36 times, and one of each 48 times. Is the coin fair? Suppose we toss a coin 100 times and get two heads 16 times, two tails 36 times, and one of each 48 times. Is the coin fair?
19
Examples If we selected 20 people from a group that was 60% male and 40% female, we would expect to get 12 males and 8 females. If we selected 20 people from a group that was 60% male and 40% female, we would expect to get 12 males and 8 females. If we got 15 males and 5 females, would that indicate that our selection procedure was not random (i.e., discriminatory)? If we got 15 males and 5 females, would that indicate that our selection procedure was not random (i.e., discriminatory)?
20
Null Hypothesis The null hypothesis specifies the probability (or proportion) for each category. The null hypothesis specifies the probability (or proportion) for each category. Each probability is the probability that a random observation would fall into that category. Each probability is the probability that a random observation would fall into that category.
21
Null Hypothesis To test a die for fairness, the null hypothesis would be To test a die for fairness, the null hypothesis would be H 0 : p 1 = 1/6, p 2 = 1/6, …, p 6 = 1/6. The alternative hypothesis would be The alternative hypothesis would be H 1 : At least one of the probabilities is not 1/6.
22
Expected Counts To find the expected counts, we apply the hypothetical probabilities to the sample size. To find the expected counts, we apply the hypothetical probabilities to the sample size. For example, if the hypothetical probability is 1/6 and the sample size is 60, then the expected count is For example, if the hypothetical probability is 1/6 and the sample size is 60, then the expected count is (1/6) 60 = 10.
23
Example We will use the sample data given for 60 rolls of a die to calculate the 2 statistic. We will use the sample data given for 60 rolls of a die to calculate the 2 statistic. Make a chart showing both the observed and expected counts (in parentheses). Make a chart showing both the observed and expected counts (in parentheses). 123456 8 (10) 10 (10) 14 (10) 12 (10) 9 (10) 7 (10)
24
Example Now calculate 2. Now calculate 2.
25
Computing the p-value The number of degrees of freedom is 1 less than the number of categories in the table. The number of degrees of freedom is 1 less than the number of categories in the table. In this example, df = 5. In this example, df = 5. To find the p-value, use the TI-83 to calculate the probability that 2 (5) would be at least as large as 3.4. To find the p-value, use the TI-83 to calculate the probability that 2 (5) would be at least as large as 3.4. 2 cdf(3.4, E99, 5) = 0.6386. 2 cdf(3.4, E99, 5) = 0.6386. Therefore, p-value = 0.6386 (accept H 0 ). Therefore, p-value = 0.6386 (accept H 0 ).
26
TI-83 – Goodness of Fit Test The TI-83 will not automatically do a goodness- of-fit test. The TI-83 will not automatically do a goodness- of-fit test. The following procedure will compute 2. The following procedure will compute 2. Enter the observed counts into list L 1. Enter the observed counts into list L 1. Enter the expected counts into list L 2. Enter the expected counts into list L 2. Evaluate the expression (L 1 – L 2 ) 2 /L 2. Evaluate the expression (L 1 – L 2 ) 2 /L 2. Select LIST > MATH > sum and apply the sum function to the previous result. Select LIST > MATH > sum and apply the sum function to the previous result. The result is the value of 2. The result is the value of 2.
27
Example To test whether the coin is fair, the null hypothesis would be To test whether the coin is fair, the null hypothesis would be H 0 : p HH = 1/4, p TT = 1/4, p HT = 1/2. The alternative hypothesis would be The alternative hypothesis would be H 1 : At least one of the probabilities is not what H 0 says it is.
28
Expected Counts To find the expected counts, we apply the hypothetical probabilities to the sample size. To find the expected counts, we apply the hypothetical probabilities to the sample size. Expected HH = (1/4) 100 = 25. Expected HH = (1/4) 100 = 25. Expected TT = (1/4) 100 = 25. Expected TT = (1/4) 100 = 25. Expected HT = (1/2) 100 = 50. Expected HT = (1/2) 100 = 50.
29
Example We will use the sample data given for 60 rolls of a die to calculate the 2 statistic. We will use the sample data given for 60 rolls of a die to calculate the 2 statistic. Make a chart showing both the observed and expected counts (in parentheses). Make a chart showing both the observed and expected counts (in parentheses). HHTTHT 16 (25) 36 (25) 48 (50)
30
Example Now calculate 2. Now calculate 2.
31
Computing the p-value In this example, df = 2. In this example, df = 2. To find the p-value, use the TI-83 to calculate the probability that 2 (2) would be at least as large as 8.16. To find the p-value, use the TI-83 to calculate the probability that 2 (2) would be at least as large as 8.16. 2 cdf(8.16, E99, 2) = 0.0169. 2 cdf(8.16, E99, 2) = 0.0169. Therefore, p-value = 0.0169 (reject H 0 ). Therefore, p-value = 0.0169 (reject H 0 ).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.