This is a test for three or more proportions within a single population, so use the goodness-of-fit test. We will always use a right-tailed χ 2 -test. The hypotheses for this example would be:
H
0
:
p
A
=
0.35
,
p
B
=
0.23
,
p
C
=
0.25
,
p
D
=
0.10
,
p
F
=
0.07
H 1 : At least one proportion is different.
Even though there is an inequality in H 1 , the goodness-of-fit test is always a right-tailed test. This is because we are testing to see if there is a large variation between the observed versus the expected values. If the variance between the observed and expected values is large, then there is a difference in the proportions.
# Where does the chi-square curve come from, and why only the right tail?
# Draw 5000 samples of n = 250 in which the instructor's grades DO follow the
# department's proportions, and compute the goodness-of-fit statistic each time.
p0 <- c(.35, .23, .25, .10, .07) # H0 is true in every one of these samples
E <- 250 * p0 # 87.5 57.5 62.5 25 17.5
set.seed(10)
X2 <- replicate(5000, sum((rmultinom(1, 250, p0) - E)^2 / E))
hist(X2, breaks = 40, freq = FALSE, xlab = "chi-square statistic",
main = "5000 goodness-of-fit statistics, all simulated under H0")
curve(dchisq(x, df = 4), add = TRUE, lwd = 2) # df = k - 1 = 4
abline(v = 9.4877, lty = 2) # the book's critical value
mean(X2 > 9.4877) # about 0.05 -- only a LARGE statistic is surprising
Also note that we do not write the alternative hypothesis as p A ≠ 0.35 , p B ≠ 0.23 , p C ≠ 0.25 , p D ≠ 0.10 , p F ≠ 0.07 since it could be that any one of these proportions is different. All of the proportions not being equal to their hypothesized values is just one possible case.
There are k = 5 categories that we are comparing: A’s, B’s, C’s, D’s and F’s.
The observed counts are the actual number of A’s, B’s, C’s, D’s and F’s from the sample.
We must compute the expected count for each of the five categories. Find the expected counts by multiplying the expected proportion of A’s, B’s, C’s, D’s and F’s by the sample size.
It will be helpful to make a table to organize the work.
The test statistic is the sum of this last row: χ 2 = ∑ ( O − E ) 2 E = 0.6429 + 0.9783 + 0.324 + 6.76 + 2.4143 = 11.1195
The critical value for a right-tailed χ 2 -test with df = k − 1 = 5 − 1 = 4 is found by finding the area in the χ 2 -distribution using your calculator or Excel. Use α = 0.05 area in the right-tail, to get the critical value of χ α 2 =CHISQ.INV.RT(0.05,4) = 9.4877. Draw and label the curve as shown in Figure 10-4.
Figure 10-4: Values of χ α 2 and χ 2 on a χ 2 -test with df = 4 and α = 0.05 .
The test statistic of χ 2 = 11.1195 > χ α 2 = 9.4877 and is in the rejection area, so our decision is: Reject H 0 .
There is sufficient evidence to support the claim that the proportion of students who get A’s, B’s, C’s, D’s and F’s in introductory statistics courses for this instructor is different than the department’s proportions of 35%, 23%, 25%, 10% and 7% respectively.
If we were asked to find the p-value, you would just find the area to right of the test statistic (always a right-tailed test) using your calculator or Excel =CHISQ.DIST.RT(11.1195,4) = 0.0253.
Try it in XYZ Crunch
Both Excel formulas on one chi-square curve
The first link is =CHISQ.DIST.RT(11.1195,4): the Distributions panel opens on df = 4 with the right-tail area above the test statistic already shaded, giving p = 0.0253. The second is =CHISQ.INV.RT(0.05,4), entered as the left-tail area 0.95, giving the critical value 9.4877. Both say reject. Drag the boundary below 9.4877 and watch the tail area climb past α = 0.05.
This gives a p-value = 0.0252 which is less than α = 0.05 , therefore reject H 0 .
You can use the GOF shortcut function on your calculator to get a p-value; see directions below. If you get the program from your instructor or the website for your TI-83, you can also have the calculator find the ( O − E ) 2 E values. The TI-84 and 89 already does this.
TI-84: Note: For the TI-83 download a GOF program from http://MostlyHarmlessStatistics.com . Only newer TI-84 operating systems have a calculator shortcut key for GOF. Use the same GOF program as for the TI-83 if your 84 does not have the χ 2 GOF-Test.
Before you start, write down your observed and expected values. Select Stat, then Calc. Type in the observed values into list 1, and the expected values into list 2. Select Stat, then Tests. Go down to option D: χ 2 GOF-Test. Choose L1 for the Observed category and L2 for the Expected category, type in your degrees of freedom (df = k − 1 ), and then select Calculate. The calculator returns the χ 2 -test statistic and the p-value. Use the right arrow to see the rest of the ( O − E ) 2 E values.
TI-89: Go to the [Apps] Stat/List Editor, then type in the observed values into list 1, and the expected values into list 2. Press [2nd ] then F6 [Tests], then select 7: Chi-2GOF. Type in the list names and the degrees of freedom (df = k − 1 ). Then press the [ENTER] key to calculate. The calculator returns the χ 2 -test statistic and the p-value. The ( O − E ) 2 E values are stored in the comp list.