Chi Squre
Chi Squre
Chi Squre
* e-2 / 2
where Y0 is a constant that depends on the number of degrees of freedom, 2 is the chi-square statistic, v = n - 1 is the number of degrees of freedom, and e is a constant equal to the base of the natural logarithm system (approximately 2.71828). Y 0 is defined, so that the area under the chi-square curve is equal to one. In the figure below, the red curve shows the distribution of chi-square values computed from all possible samples of size 3, where degrees of freedom is n - 1 = 3 - 1 = 2. Similarly, the the green curve shows the distribution for samples of size 5 (degrees of freedom equal to 4); and the blue curve, for samples of size 11 (degrees of freedom equal to 10).
The chi-square distribution has the following properties: The mean of the distribution is equal to the number of degrees of freedom: = v. The variance is equal to two times the number of degrees of freedom: 2 = 2 * v
Page 2 of 17
When the degrees of freedom are greater than or equal to 2, the maximum value for Y occurs when 2 = v - 2. As the degrees of freedom increase, the chi-square curve approaches a normal distribution.
Fortunately, we don't have to compute the area under the curve to find the probability. The easiest way to find the cumulative probability associated with a particular chi-square statistic is to use theChiSquare Distribution Calculator, a free tool provided by Stat Trek.
Page 3 of 17
To compute the chi-square statistic, we plug these data in the chi-square equation, as shown below. 2 = [ ( n - 1 ) * s2 ] / 2 2 = [ ( 7 - 1 ) * 62 ] / 42 = 13.5 where 2 is the chi-square statistic, n is the sample size, s is the standard deviation of the sample, and is the standard deviation of the population.
Problem 2 Let's revisit the problem presented above. The manufacturing department ran a quality control test, using 7 randomly selected batteries. In their test, the standard deviation was 6 minutes, which equated to a chi-square statistic of 13.5. Suppose they repeated the test with a new random sample of 7 batteries. What is the probability that the standard deviation in the new test would be greater than 6 minutes?
Page 4 of 17
Solution We know the following: The sample size n is equal to 7. The degrees of freedom are equal to n - 1 = 7 - 1 = 6. The chi-square statistic is equal to 13.5 (see Example 1 above).
Given the degrees of freedom, we can determine the cumulative probability that the chi-square statistic will fall between 0 and any positive value. To find the cumulative probability that a chi-square statistic falls between 0 and 13.5, we enter the degrees of freedom (6) and the chi-square statistic (13.5) into the Chi-Square Distribution Calculator. The calculator displays the cumulative probability: 0.96. This tells us that the probability that a standard deviation would be less than or equal to 6 minutes is 0.96. This means (by the subtraction rule) that the probability that the standard deviation would begreater than 6 minutes is 1 - 0.96 or .04.
Page 5 of 17
This approach consists of four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results.
Page 6 of 17
Expected frequency counts. The expected frequency counts at each level of the categorical variable are equal to the sample size times the hypothesized proportion from the null hypothesis Ei = npi where Ei is the expected frequency count for the ith level of the categorical variable, n is the total sample size, and pi is the hypothesized proportion of observations in level i.
Test statistic. The test statistic is a chi-square random variable (2) defined by the following equation. 2 = [ (Oi - Ei)2 / Ei ] where Oi is the observed frequency count for the ith level of the categorical variable, and Ei is the expected frequency count for the ith level of the categorical variable.
P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic. Since the test statistic is a chi-square, use the Chi-Square Distribution Calculator to assess the probability associated with the test statistic. Use the degrees of freedom computed above.
Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting the null hypothesis when the P-value is less than the significance level.
Page 7 of 17
The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below: State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis. Null hypothesis: The proportion of rookies, veterans, and All-Stars is 30%, 60% and 10%, respectively. Alternative hypothesis: At least one of the proportions in the null hypothesis is false.
Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a chi-square goodness of fit test of the null hypothesis. Analyze sample data. Applying the chi-square goodness of fit test to sample data, we compute the degrees of freedom, the expected frequency counts, and the chi-square test statistic. Based on the chi-square statistic and the degrees of freedom, we determine the P-value. DF = k - 1 = 3 - 1 = 2 (Ei) = n * pi (E1) = 100 * 0.30 = 30 (E2) = 100 * 0.60 = 60 (E3) = 100 * 0.10 = 10 2 = [ (Oi - Ei)2 / Ei ] 2 = [ (50 - 30)2 / 30 ] + [ (45 - 60)2 / 60 ] + [ (5 - 10)2 / 10 ] 2 = (400 / 30) + (225 / 60) + (25 / 10) = 13.33 + 3.75 + 2.50 = 19.58 where DF is the degrees of freedom, k is the number of levels of the categorical variable, n is the number of observations in the sample, Ei is the expected frequency count for level i, Oi is the observed frequency count for level i, and 2 is the chi-square test statistic. The P-value is the probability that a chi-square statistic having 2 degrees of freedom is more extreme than 19.58. We use the Chi-Square Distribution Calculator to find P(2 > 19.58) = 0.0001.
Interpret results. Since the P-value (0.0001) is less than the significance level (0.05), we cannot accept the null hypothesis.
Page 8 of 17
Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, the population was more than 10 times larger than the sample, the variable under study was categorical, and each level of the categorical variable had an expected frequency count of at least 5.
Page 9 of 17
H0: Plevel 1 of population 1 = Plevel 1 of population 2 = . . . = Plevel 1 of population r H0: Plevel 2 of population 1 = Plevel 2 of population 2 = . . . = Plevel 2 of population r ... H0: Plevel c of population 1 = Plevel c of population 2 = . . . = Plevel c of population r The alternative hypothesis (Ha) is that at least one of the null hypothesis statements is false.
Page 10 of 17
where Er,c is the expected frequency count for population r at level c of the categorical variable, nr is the total number of observations from population r, nc is the total number of observations at treatment level c, and n is the total sample size. Test statistic. The test statistic is a chi-square random variable (2) defined by the following equation. 2 = [ (Or,c - Er,c)2 / Er,c ] where Or,c is the observed frequency count in population r for level c of the categorical variable, and Er,c is the expected frequency count in population r for level c of the categorical variable. P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic. Since the test statistic is a chi-square, use the Chi-Square Distribution Calculator to assess the probability associated with the test statistic. Use the degrees of freedom computed above.
Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting the null hypothesis when the P-value is less than the significance level.
Viewing Preferences Row total Lone Ranger Sesame Street The Simpsons
Page 11 of 17
Boys
50
30
20
100
Girls
50
80
70
200
Column total
100
110
90
300
Do the boys' preferences for these TV programs differ significantly from the girls' preferences? Use a 0.05 level of significance. Solution The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below: State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis. Null hypothesis: The null hypothesis states that the proportion of boys who prefer the Lone Ranger is identical to the proportion of girls. Similarly, for the other programs. Thus, H0: Pboys who prefer Lone Ranger = Pgirls who prefer Lone Ranger H0: Pboys who prefer Sesame Street = Pgirls who prefer Sesame Street H0: Pboys who prefer The Simpsons = Pgirls who prefer The Simpsons Alternative hypothesis: At least one of the null hypothesis statements is false.
Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a chi-square test for homogeneity. Analyze sample data. Applying the chi-square test for homogeneity to sample data, we compute the degrees of freedom, the expected frequency counts, and the chi-square test statistic. Based on the chi-square statistic and the degrees of freedom, we determine the Pvalue. DF = (r - 1) * (c - 1) = (2 - 1) * (3 - 1) = 2
Page 12 of 17
Er,c = (nr * nc) / n E1,1 = (100 * 100) / 300 = 10000/300 = 33.3 E1,2 = (100 * 110) / 300 = 11000/300 = 36.7 E1,3 = (100 * 90) / 300 = 9000/300 = 30.0 E2,1 = (200 * 100) / 300 = 20000/300 = 66.7 E2,2 = (200 * 110) / 300 = 22000/300 = 73.3 E2,3 = (200 * 90) / 300 = 18000/300 = 60.0
2 = [ (Or,c - Er,c)2 / Er,c ] 2 = (50 - 33.3)2/33.3 + (30 - 36.7)2/36.7 + (20 - 30)2/30 + (50 - 66.7)2/66.7 + (80 - 73.3)2/73.3 + (70 - 60)2/60 2 = (16.7)2/33.3 + (-6.7)2/36.7 + (-10.0)2/30 + (-17.7)2/66.7 + (3.3)2/73.3 + (10)2/60 2 = 8.38 + 1.22 + 3.33 + 4.70 + 0.61 + 1.67 = 19.91 where DF is the degrees of freedom, r is the number of populations, c is the number of levels of the categorical variable, nr is the number of observations from population r, nc is the number of observations from level c of the categorical variable, n is the number of observations in the sample, Er,c is the expected frequency count in population r for level c, and Or,c is the observed frequency count in population r for level c. The P-value is the probability that a chi-square statistic having 2 degrees of freedom is more extreme than 19.91. We use the Chi-Square Distribution Calculator to find P(2 > 19.91) = 0.0000. (The actual Pvalue, of course, is not exactly zero. If the Chi-Square Distribution Calculator reported more than four decimal places, we would find that the actual P-value is a very small number that is less than 0.00005 and greater than zero.) Interpret results. Since the P-value (0.0000) is less than the significance level (0.05), we reject the null hypothesis. Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, each population was more than 10 times larger than its respective sample, the variable under study was categorical, and the expected frequency count was at least 5 in each population at each level of the categorical variable.
Page 13 of 17
Page 14 of 17
The analysis plan describes how to use sample data to accept or reject the null hypothesis. The plan should specify the following elements. Significance level. Often, researchers choose significance levels equal to 0.01, 0.05, or 0.10; but any value between 0 and 1 can be used. Test method. Use the chi-square test for independence to determine whether there is a significant relationship between two categorical variables.
Page 15 of 17
P-value. The P-value is the probability of observing a sample statistic as extreme as the test statistic. Since the test statistic is a chi-square, use the Chi-Square Distribution Calculator to assess the probability associated with the test statistic. Use the degrees of freedom computed above.
Interpret Results
If the sample findings are unlikely, given the null hypothesis, the researcher rejects the null hypothesis. Typically, this involves comparing the P-value to the significance level, and rejecting the null hypothesis when the P-value is less than the significance level.
Male
200
150
50
400
Female
250
300
50
600
Column total
450
450
100
1000
Is there a gender gap? Do the men's voting preferences differ significantly from the women's preferences? Use a 0.05 level of significance. Solution The solution to this problem takes four steps: (1) state the hypotheses, (2) formulate an analysis plan, (3) analyze sample data, and (4) interpret results. We work through those steps below:
Page 16 of 17
State the hypotheses. The first step is to state the null hypothesis and an alternative hypothesis. H0: Gender and voting preferences are independent. Ha: Gender and voting preferences are not independent.
Formulate an analysis plan. For this analysis, the significance level is 0.05. Using sample data, we will conduct a chi-square test for independence. Analyze sample data. Applying the chi-square test for independence to sample data, we compute the degrees of freedom, the expected frequency counts, and the chi-square test statistic. Based on the chi-square statistic and the degrees of freedom, we determine the Pvalue. DF = (r - 1) * (c - 1) = (2 - 1) * (3 - 1) = 2 Er,c = (nr * nc) / n E1,1 = (400 * 450) / 1000 = 180000/1000 = 180 E1,2 = (400 * 450) / 1000 = 180000/1000 = 180 E1,3 = (400 * 100) / 1000 = 40000/1000 = 40 E2,1 = (600 * 450) / 1000 = 270000/1000 = 270 E2,2 = (600 * 450) / 1000 = 270000/1000 = 270 E2,3 = (600 * 100) / 1000 = 60000/1000 = 60
2 = [ (Or,c - Er,c)2 / Er,c ] 2 = (200 - 180)2/180 + (150 - 180)2/180 + (50 - 40)2/40 + (250 - 270)2/270 + (300 - 270)2/270 + (50 - 60)2/40 2 = 400/180 + 900/180 + 100/40 + 400/270 + 900/270 + 100/60 2 = 2.22 + 5.00 + 2.50 + 1.48 + 3.33 + 1.67 = 16.2 where DF is the degrees of freedom, r is the number of levels of gender, c is the number of levels of the voting preference, nr is the number of observations from level r of gender, nc is the number of observations from level c of voting preference, n is the number of observations in the sample, Er,c is the expected frequency count when gender is level r and voting preference is level c, and Or,c is the observed frequency count when gender is level r voting preference is level c.
Page 17 of 17
The P-value is the probability that a chi-square statistic having 2 degrees of freedom is more extreme than 16.2. We use the Chi-Square Distribution Calculator to find P(2 > 16.2) = 0.0003. Interpret results. Since the P-value (0.0003) is less than the significance level (0.05), we cannot accept the null hypothesis. Thus, we conclude that there is a relationship between gender and voting preference. Note: If you use this approach on an exam, you may also want to mention why this approach is appropriate. Specifically, the approach is appropriate because the sampling method was simple random sampling, each population was more than 10 times larger than its respective sample, the variables under study were categorical, and the expected frequency count was at least 5 in each cell of the contingency table.