Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Nonparametric
Statistics
14.1 Introduction to
Nonparametric Statistics
14.2 Sign Test
14.3 Wilcoxon Signed Rank
Test for Matched-Pair
Data
14.4 Wilcoxon Rank Sum
Test for Two
Independent Samples
14.5 Kruskal-Wallis Test
14.6 Rank Correlation Test
14.7 Runs Test for
Randomness
Wavebreakmedia/Shutterstock
14-2
Parametric hypothesis tests are used to test claims about a population parameter, such as
the population mean m or the population proportion p. Often, parametric tests require that
the population follow a particular distribution, such as the normal distribution.
Nonparametric hypothesis tests, also called distribution-free hypothesis tests, generally
have fewer required conditions. In particular, nonparametric tests do not require the
population to follow a particular distribution, such as the normal distribution.
Recall that we should not perform a parametric hypothesis test (such as the t test
for the population mean m) if the conditions are not met. Why, then, would a data ana-
lyst take a chance and use a parametric test when the conditions may not be satisfied?
The answer is that there are advantages and disadvantages to each method.
The efficiency of a nonparametric hypothesis test is defined as the ratio of the sample size
required for the corresponding parametric test to the sample size required for the
nonparametric test, in order to achieve the same result (such as correctly rejecting the null
hypothesis). The efficiency ratings are reported on the assumption that required conditions
for both the parametric and the nonparametric tests have been met.
For example, in Section 14.3 we will learn about the Wilcoxon signed rank test for
matched-pair data. The corresponding parametric test is the t test for the difference in
means for dependent samples that we learned about in Section 10.1. If a certain result
is achieved by using the Wilcoxon signed rank test with a sample size of 100, an
equivalent result may be obtained using the dependent-samples t test with a sample
size of 95. Thus, the efficiency of the Wilcoxon signed rank test (assuming that the
conditions have been met for both tests) is
95
efficiency 5 5 0.95
100
Thus, the Wilcoxon signed rank test is fairly efficient compared with the dependent-
samples t test. On the other hand, the sign test that we will learn about in Section 14.2 has
an efficiency of only 0.63, meaning that the corresponding dependent-samples t test
requires a sample size of only 63 to achieve the same result that the sign test achieves
with a sample size of 100. Thus, the sign test is less efficient than the Wilcoxon signed
rank test. However, as we shall see, the conditions for performing the Wilcoxon signed
rank test are stricter than for performing the sign test. As is often the case, there is a trade-
off between the efficiency of a test and the conditions required for performing the test.
Table 1 contains the efficiency ratings of the nonparametric (distribution-free)
hypothesis tests that we will learn about in this chapter. The efficiency ratings are cal-
culated under the assumption that the conditions for both the parametric and the non-
parametric tests have been met.
The sign test is a nonparametric hypothesis test in which the original data are
transformed into plus or minus signs. The sign test may be conducted for (a) a single
population median, (b) matched-pair data from two dependent samples, or (c) binomial
data.
60
50
40
30
20 The t test may be used if the population is normal or if the sample size is at least 30.
10
5 The normal probability plot shows two data values outside the bounds, indicating that
1
1000 500 0 500 1000 1500
the data are not normally distributed. Also, the sample of size n 5 8 is not at least 30.
Hurricane-related deaths Therefore, the conditions for performing the t test for the population mean are not
Figure 1 Normal probability plot
met. (The unusual data value of 1016 hurricane-related deaths for 2005 is the result of
for the hurricane-related deaths data. Hurricanes Katrina and Rita.)
Fortunately, however, the required conditions for performing the sign test for the
population median are less stringent than those for the t test for the population mean.
The sign test requires only that the sample data have been randomly selected. It is not
required that the population be normally distributed. It should be noted, however,
that the sign test is a hypothesis test for the population median, not the population
mean.
The key concept for performing the sign test for the median is the following: each
of the data values is converted to either a plus sign (1) or a minus sign (2). If there is
a preponderance of plus signs to minus signs, or vice versa (depending on the form of
the hypothesis test), then this is evidence against the null hypothesis.
Solution
a. We may write the hypotheses as
H0 : M 5 50 versus Ha : M , 50
where M represents the population median number of hurricane-related deaths
per year.
b. As shown here, we have 7 minus signs and 1 plus sign, so that our sample size is
7 1 1 5 8.
Recall that the median of a data set is the 50th percentile and splits the data set into
equal halves. Thus, if the null hypothesis were true, we would expect about half of the
sample data values to lie above the median and half below, so that about half of the signs
would be plus signs and about half would be minus signs. Now, only 1 of the 8 signs in
this data set is a plus sign, which may indicate evidence against the null hypothesis.
However, to make sure, we need to perform the sign test for the population median. The
procedure for the sign test for the population median is summarized as follows.
Table 2 Hypotheses for the sign test for the population median M
Null hypothesis Alternative hypothesis Type of test
H0 : M 5 M0 Ha : M . M0 Right-tailed test
H0 : M 5 M0 Ha : M , M0 Left-tailed test
H0 : M 5 M0 Ha : M M0 Two-tailed test
Note: M0 is the value of the population median M for which a claim is being made.
Step 2 Find the critical value and state the rejection rule.
Small-Sample Case (sample size n # 25): Use Appendix Table I. Choose the column
withthe appropriate level of significance (a) and the applicable one-tailed or two-tailed
test. Then select the row with the appropriate sample size n 5 number of pluses and
minuses. The number in that row and column is your critical value Scrit. The rejection rule
is to reject H0 if Sdata # Scrit.
Large-Sample Case (sample size n . 25): Use Appendix Table C, the standard
normal table. The Z critical value for this sign test is always found in the left tail of the
standard normal distribution, so that Zcrit is always less than 0. For a left-tailed test or a
right-tailed test, the critical value Zcrit is the value of Z with area a to the left of it. For a
two-tailed test, the critical value Zcrit is the value of Z with area a/2 to the left of it.
Table 4 in Chapter 9 on page 500 contains values of Zcrit for some common values
of a. The rejection rule is to reject H0 if Zdata # Zcrit.
Step 3 Find the value of the test statistic.
Small-Sample Case (n # 25): Use Table 3 to find the test statistic Sdata.
Large-Sample Case (n . 25): First use Table 3 to find Sdata, and then calculate the test
statistic Zdata:
n
_Sdata 1 0.5+ 2
2
Zdata 5
n
2
Step 4State the conclusion and the interpretation.
Compare the test statistic with the critical value, using the rejection rule. A generic
interpretation is as follows. If H0 is rejected, then state, Evidence exists that [whatever Ha
says]. If H0 is not rejected, then state, There is insufficient evidence that [whatever Ha says].
Solution
From Example 1, we know that the data come from a random sample, which is the only
condition for conducting the sign test. Thus, we may proceed.
Step 1 State the hypotheses. The hypotheses are
H0 : M 5 50 versusHa : M < 50
where M represents the population median number of hurricane-related deaths per year.
Step 2 Find the critical value and state the rejection rule. The total number of
plus signs and minus signs is n 5 7 1 1 5 8, which is not greater than 25, so we use
the small-sample case. We have a one-tailed test, with a 5 0.05 and n 5 8, which gives
us Scrit 5 1 (Figure 2). The rejection rule is to reject H0 if Sdata # 1.
a
0.005 0.01 0.025 0.05
(one tail) (one tail) (one tail) (one tail)
0.01 0.02 0.05 0.10
n (two tails) (two tails) (two tails) (two tails)
1 * * * *
2 * * * *
3 * * * *
4 * * * *
5 * * * 0
6 * * 0 0
7 * 0 0 0
8 0 0 0 1
Step 4 State the conclusion and the interpretation. The value of our test statistic
NOW YOU CAN DO is Sdata 5 1, which is # 1, so we reject H0. Evidence exists that the population median
Exercises 916. number of hurricane-related deaths is less than 50 per year.
Example 4 Large-sample sign test for the population median using technology
The data set Nutrition (on the text website) contains information about 961 food
nutrition items. The variable calories states the number of calories per serving for each food
item. Consider these 961 food items to be a random sample of the population of all
food items. Test whether the population median number of calories differs from 120,
using level of significance a 5 0.10.
Solution
The 961 food items are a random sample from the population of all food items, so the
conditions for performing the sign test for the population median are met.
Step 1 State the hypotheses. The key words differs from indicate that we have a
two-tailed test. The answer to the question Differs from what? gives us the value of
M0 5 120.
Step 2 Find the critical value and state the rejection rule. We have a large sample
here. Among the 961 values, there are 18 that are equal to the proposed population
median M0 5 120. We ignore values that do not have a sign associated with them, so
n 5 961 2 18 5 943. We are given the level of significance a 5 0.10, so our Zcrit 5
21.645. We will reject H0 if Zdata # 21.645.
Step 3 Find the value of the test statistic. We use the instructions provided in
the Step-by-Step Technology Guide at the end of this section. Figure 3 shows
the Minitab results from the sign test for the population median. The value for
Below is the number of minus signs, and the value for Above is the number
of plus signs. So, we have 448 minus signs and 495 plus signs. Thus, the sample
size is n 5 448 1 495 5 943. From Table 3, Sdata 5 the number of minus signs
or plus signs, whichever is smaller. Thus, Sdata 5 448. We then calculate the test
statistic Zdata:
n 943
_Sdata 1 0.5+ 2 s448 1 0.5d 2
2 2
Zdata 5 5 < 21.498
n 943
2 2
N Below
120.0 versus not = 120.0
Step 4 State the conclusion and the interpretation. Because Zdata 21.498 is not
# Zcrit 5 21.645, we do not reject H0. The evidence is insufficient that the population
median number of calories differs from 120 calories per serving. The Minitab output
NOW YOU CAN DO shows that the sample median equals 125 calories, which is a little bit different from
Exercises 1720. M0 5 120, but the difference is not statistically significant.
Table 4 Hypotheses for the sign test for the population median of the differences Md
Alternative
Null hypothesis hypothesis Type of test Test statistic Sdata
H0 : Md 5 0 Ha : Md . 0 Right-tailed test Sdata 5 number of minus signs
H0 : Md 5 0 Ha : Md , 0 Left-tailed test Sdata 5 number of plus signs
H0 : Md 5 0 Ha : Md 0 Two-tailed test Sdata 5 number of minus signs or
plus signs, whichever is smaller
We may use the same methods for the matched-pair sign test that we used for the
sign test for a single population median, with the following modifications:
1. For each matched pair, subtract the value of the second variable from the value of
the first variable.
2. We are interested only in the sign of the difference found in Step 1, not the
difference itself.
3. Exclude ties. That is, omit any matched pairs in which the values for both
variables are equal.
We illustrate the sign test for the population median of the differences using the follow-
ing example.
Example 5 Sign test for matched-pair data from two dependent samples
The National Center for Educational Statistics publishes the results from the Trends in
International Math and Science Study (TIMSS). The following table contains the2007
and 2011 average eighth-grade mathematics scores for a random sample of 12 coun-
tries. Test whether the population median math score M has decreased from 2007 to
2011, using a 5 0.05.
Difference
Country 2007 2011 (2011 2 2007) Sign
Korea 597 613 116 1
Singapore 593 611 118 1
United States 508 509 11 1
Lithuania 506 502 24 2
Hungary 517 505 212 2
Romania 461 458 23 2
Russia 512 539 127 1
Australia 496 505 19 1
Indonesia 397 386 211 2
Norway 469 475 16 1
Sweden 491 484 27 2
Malaysia 474 440 234 2
Solution
The countries represent a random sample of matched-pair data, so the condition for
performing the sign test for the population median of the differences is met.
Step 1 State the hypotheses. We have a left-tailed test:
H0 : Md 5 0 versus Ha : Md < 0
where Md represents the population median of the differences in eighth-grade math
scores from 2007 to 2011.
Step 2 Find the critical value and state the rejection rule. The sample size is
thesum of the number of plus signs and minus signs: n 5 6 1 6 5 12. Because n # 25,
we use the small-sample case. To find the critical value, we use Appendix Table I. We
have a one-tailed test, with a 5 0.05 and n 5 12, which gives us Scrit 5 2. The rejection
rule is to reject H0 if Sdata # 2.
Step 3 Find the value of the test statistic. From Table 3, we have Sdata 5 the number
of plus signs 5 6.
Step 4 State the conclusion and the interpretation. Because Sdata 5 6 is not # 2,
NOW YOU CAN DO we do not reject H0. There is insufficient evidence that the population median eighth-
Exercises 2124. grade math score has decreased from 2007 to 2011.
The sign test may also be applied using the p-value method and technology.
Receipts Expenditures
State ($ millions) ($ millions) Difference
Florida 28,208 26,832 1,376
California 73,272 68,045 5,227
New Jersey 20,032 19,938 94
Alabama 7,000 6,540 460
Minnesota 10,280 10,191 89
Indiana 11,996 11,315 681
Maine 2,458 2,458 0
New York 41,800 42,895 21,095
Mississippi 4,341 3,945 396
Ohio 24,259 21,237 3,022
Solution
The states represent a random sample of matched-pair data. We may thus proceed with
the sign test for the population median of the differences.
Step 1 State the hypotheses.
H0 : Md 5 0 versus Ha : Md 0
where Md represents the population median of the differences in education receipts
minus expenditures per state.
Step 2 Find the p-value using technology. We use the instructions provided in the
Step-by-Step Technology Guide at the end of this section. The Minitab output shown
in Figure 4 and the JMP output shown in Figure 5 provide the p-value for this hypothesis
test: p-value 5 0.0391. Note that one state (Maine) has education receipts equal to
expenditures, so that the difference for Maine equals zero. Maine is thus omitted, and
the p-value is based on the other nine states left in the sample.
FIGURE 4 Minitab output for the sign test for the FIGURE 5 JMP output for the sign
population median. test for the population median.
Step 3 State the conclusion and the interpretation. The p-value 0.0391 is less than
the level of significance a 5 0.05, so we reject H0. Evidence exists that the population
median difference between education receipts and expenditures differs from zero.
looks at the numbers of spam emails and nonspam emails processed by auniversity
spam filter. When using the sign test, spam emails are represented by plus (1) signs,
and nonspam emails are represented by minus (2) signs. Table 5 contains the hypoth-
eses for the sign test for binomial data. Note that the hypothesized population propor-
tion is always p0 5 0.5.
We use the same methods for the sign test for binomial data that we used for the sign
test for a single population median. However, only the large-sample case is used (n . 25),
because only when the sample size is large does the Central Limit Theorem apply.
Solution
Because the sample of Americans has been selected randomly and n . 25, we may
proceed. We represent people taking at least one prescription drug per month by plus
(1) signs and people taking no prescription drugs by minus (2) signs.
Step 1 State the hypotheses.
H0 : p 5 0.5 versusHa : p . 0.5
where p represents the population proportion of Americans taking at least one pre-
scription drug per month.
Step 2 Find the critical value and state the rejection rule. The sample size
n 5 100 is greater than 25, so we may use the large-sample case. Using Table 4 in
Chapter 9 (page 500) for level of significance a 5 0.01, we have Zcrit 5 22.33. We will
reject H0 if Zdata # 22.33.
Step 3 Find the value of the test statistic. From Table 5, Sdata 5 the number of
minus signs 5 the number of people not taking prescription drugs. Thus, Sdata 5 100 2
67 5 33. We then calculate the test statistic Zdata:
n 100
_Sdata 1 0.5+ 2 s33 1 0.5d 2
2 2
Zdata 5 5 5 23.3
n 100
2 2
Step 4 State the conclusion and the interpretation. Because Zdata 5 23.3 is # Zcrit 5
NOW YOU CAN DO 22.33, we reject H0. Evidence exists that the population proportion of Americans
Exercises 2526. taking at least one prescription drug per month has increased.
Table 6 Miles per gallon of a random sample of 14 vehicles for 2007 and 2014
Combined Combined Difference
Make Model mpg for 2007 mpg for 2014 (2014 2 2007) Sign
Chevrolet Tahoe 17 17 0 None
Chevrolet Suburban 17 17 0 None
Dodge Caravan 21 20 21 2
Ford Explorer 17 19 2 1
Wavebreakmedia/Shutterstock
Solution
The vehicles represent a random sample, so the condition for performing the sign test
for the population median of the differences is met.
Step 1 State the hypotheses. Here, we have a right-tailed test:
H0 : Md 5 0 versus Ha : Md . 0
where Md represents the population median of the differences in miles per gallon
(2014 2 2007).
Step 2 Find the critical value and state the rejection rule. The sample size is the
sum of the number of plus signs and minus signs. There are 7 plus signs and 4 minus
signs, so that n 5 7 1 4 5 11. Because n # 25, we use the small-sample case. To find
the critical value, we use Appendix Table I. We have a one-tailed test, with a 5 0.01
and n 5 11, which gives us Scrit 5 1. The rejection rule is to reject H0 if Sdata # 1.
Step 3 Find the value of the test statistic. From Table 5, we have Sdata 5 the number
of minus signs 5 4.
Step 4 State the conclusion and the interpretation. Because Sdata 5 4 is not # 1,
we do not reject H0. The evidence is insufficient to conclude that the population median
of the differences (2014 2 2007) is greater than zero. In other words, the evidence is
insufficient to conclude that the population median vehicle gas mileage has increased
from 2007 to 2014.
We return to this Case Study in Section 14.3, when we apply the Wilcoxon signed rank
test to the same question.
EXCEL
Excel does not have a built-in sign test function. However, you Step 2 In the dialog box, enter the following values: For
can use the BINOMDIST function to calculate the p-value for a Number_s, enter the value of Sdata (from Table 3) For Trials, enter
sign test. n 5 the sum of the number of pluses and minuses. For
Step 1 On the main menu bar, click fx. Where it says Search Probability_s, enter 0.5. For Cumulative, type True.
for a function, type BINOMDIST and click Go. Where it says Step 3 Click OK. The result is the p-value for a one-tailed test.
Select a function, select BINOMDIST and click OK. Double this value for a two-tailed test. Reject H0 if the p-value is
less than a.
MINITAB
Step 1 If you are performing the sign test for a single Step 2 Select Stat > Nonparametrics > 1-Sample Sign....
population median, enter the original data into column C1. If you Step 3 For the Variables cell, select C1. Select Test
are performing the sign test for the population median of the Median, and enter the hypothesized value of the median, M 0.
differences, enter the difference data into column C1. Select the direction of the alternative hypothesis, and click OK.
SPSS
Step 1 Enter the data into the first column. Under Variable Step 5 Under Output, select Filter out unselected cases. This
View, rename the first variable, and name the second (currently will ignore values that do not have a sign associated with them.
empty) variable Sign. Click OK.
Step 2 Click Transform > Compute Variable. Step 6 Click Analyze > Nonparametric Tests > Legacy
Step 3 Under Target Variable type Sign, and under Numeric Dialogs > Binomial....
Expression enter the first variable, a less-than sign (<), and then Step 7 Move Sign to Test Variable List, and under Test
M 0. Click OK twice. Proportion put 0.50, and click OK.
Step 4 Select Data > Select Cases. Click If condition is
satisfied, click If, and enter the first variable, the not equals
button, and then M 0. Click Continue.
JMP
JMP does the sign test for matched pairs only. Step 2 Click Analyze > Matched Pairs. Move both columns to
Step 1 Click File > New > Data Table. Enter the two samples Y, Paired Response. Click OK.
in the first two columns. Step 3 Click the arrow beside Matched Pairs, and select Sign
Test. The output using Example 6 is shown in Figure 5.
3. True or false: In the sign test for the median, if there is a 16. Test whether the population median M differs from
preponderance of plus signs to minus signs, or vice versa 1000, using level of significance a 5 0.10.
(depending on the form of the hypothesis test), then this is
950100097592590010001025900
evidence against the null hypothesis. (p. 14-6)
4. In the sign test for the population median, explain why 8759501000975925750775900
the sample size for the hypothesis test may not be the same
For Exercises 1720, perform the large-sample sign test for
as the number of data values in the sample. (p. 14-6)
the population median. Use the following steps:
5. True or false: When computing the test statistic for the
a. State the hypotheses.
large-sample case for the sign test for the population median,
b. Find the Z critical value and state the rejection rule.
we need not calculate Sdata. (p. 14-8)
c. Calculate the value of the test statistic Zdata.
6. True or false: The matched-pair sign test is interested in
d. State the conclusion and the interpretation.
the exact value of the difference between the first and second
17. H0 : M 5 3.14 vs. Ha : M . 3.14, a 5 0.05. There are
variables. (p. 14-10)
100 pluses and 10 minuses.
7. The matched-pair sign test represents an alternative to
18. H0 : M 5 3.0 vs. Ha : M , 3.0, a 5 0.01. There are
which parametric hypothesis test? (p. 14-10)
20 pluses and 180 minuses.
8. The sign test for binomial data represents a special case
19. H0 : M 5 20.25 vs. Ha : M 20.25, a 5 0.10.
of which parametric hypothesis test? (p. 14-12)
There are 225 pluses and 5 minuses, and ten data values
PRACTICING THE TECHNIQUES equal 20.25.
20. H0 : M 5 75 vs. Ha : M 75, a 5 0.05. There are 10,350
CHECK IT OUT! pluses and 5,492 minuses, and 300 data values equal 75.
For Exercises 2124, you are given matched-pair data and
To do Check out Topic
are asked to perform a hypothesis test. Assume that each
Exercises 916 Example 3 Small-sample sign test for sample of differences is obtained through dependent random
the population median sampling. Do the following:
Exercises 1720 Example 4 Large-sample sign test for a. State the hypotheses.
the population median b. Find the critical value and state the rejection rule.
Exercises 2124 Example 5 Sign test for matched-pair c. Find the value of the test statistic.
data from two dependent d. State the conclusion and the interpretation.
samples 21. Test whether the population mean of the differences
Exercises 2526 Example 7 Sign test for binomial data Md . 0, using level of significance a 5 0.05.
For Exercises 916, perform the small-sample sign test for Subject 1 2 3 4 5
the population median. Use the following steps: Sample 1 3.0 2.5 3.5 3.0 4.0
a. Use Appendix Table I to find the value of Scrit. Sample 2 2.5 2.5 2.0 2.0 1.5
b. State the rejection rule.
c. Calculate Sdata. 22. Test whether the population mean of the differences
d. Provide the conclusion and the interpretation of the Md . 0, using level of significance a 5 0.01.
hypothesis test.
9. H0 : M 5 10 vs. Ha : M . 10, a 5 0.05. There are Subject 1 2 3 4 5 6
10 pluses and 10 minuses. Sample 1 10 12 9 14 15 8
10. H0 : M 5 100 vs. Ha : M , 100, a 5 0.01. There are Sample 2 8 11 10 12 14 9
2 pluses and 16 minuses.
11. H0 : M 5 0 vs. Ha : M 0, a 5 0.10. There are 0 pluses 23. Test whether the population mean of the differences
and 8 minuses. Two data values equal 0. Md . 0, using level of significance a 5 0.05.
12. H0 : M 5 98.6 vs. Ha : M 98.6, a 5 0.05. There is
1 plus and 1 minus. Three data values equal 98.6. Subject 1 2 3 4 5 6 7
13. Test whether the population median M is less than 10,
Sample 1 20 25 15 10 20 30 15
using level of significance a 5 0.05.
Sample 2 30 30 20 20 25 35 25
10895111069312172
14. Test whether the population median M is greater than 24. Test whether the population mean of the differences
100, using level of significance a 5 0.01. Md . 0, using level of significance a 5 0.05.
105219100136345996100400102100229331
15. Test whether the population median M is less than 400, Subject 1 2 3 4 5 6 7
using level of significance a 5 0.05. Sample 1 1.5 1.8 2.0 2.5 3.0 3.2 4.0
105219100136345996100400102100229331 Sample 2 1.0 1.7 2.1 2.0 2.7 2.9 3.3
For Exercises 25 and 26, perform the sign test for binomial 30. New Car Prices. Kelleys Blue Book (www.kbb.com)
data. publishes data on new and used cars. The following table
25. A sample of size n 5 200 has x 5 75 successes. Test contains the fair market value for five new 2013 and 2014
whether the population proportion is less than 0.5, using vehicles (data recorded July 2014). Test whether prices have
level of significance a 5 0.01. risen. That is, test whether the population median of the
26. A sample of size n 5 1000 has x 5 525 successes. Test difference in price is greater than zero, using level of
whether the population proportion is greater than 0.5, using significance a 5 0.05. carprice
level of significance a 5 0.10.
Toyota Honda Ford Chevy Tesla
Applying the Concepts Camry Civic 150 Corvette Model S
27. Electric Cars. The accompanying tableshows the 2014 $20,672 $17,069 $24,362 $45,684 $68,738
miles-per-gallon equivalent (MPGe) for five electric (Sample 1)
cars, as reported by www.hybridcars.com in 2014. Test 2013 $20,284 $16,499 $22,674 $44,021 $68,674
whether the population median mileage is greater than (Sample 2)
90 MPGe, using level of significance a 5 0.05.
electricmiles
31. High and Low Temperatures. The University of
Waterloo Weather Station tracks the daily low and high
Electric vehicle Mileage (mpg) temperatures in degrees Celsius in Waterloo, Ontario,
Tesla Model S 89 Canada. The table contains a random sample of the daily
Nissan Leaf 99 high and low temperatures for 10 days in calendar year
Ford Focus 105 2010. Test whether the population median of the difference
in price differs from zero, using level of significance
Mitsubishi i-MiEV 112
a 5 0.05. waterlootemp
Chevrolet Spark 119
Cleanup costs Cleanup costs 33. Firefox Market Share. A random sample of 1000
County ($ millions) County ($ millions) Internet users in Finland showed that 472 used the
Broward 0.85 Pinellas 1.15 Firefox browser.2 Use the sign test to test whether the
population proportion of Internet users in Finland using
Escambia 0.70 Santa Rosa 0.50
Firefox differs from 0.50, using level of significance
Franklin 0.50 Walton 1.35 a 5 0.10.
34. Too Much Info on Facebook? A random sample of 287 on Facebook.3 Use the sign test to test whether the
corporate employees found 189 who worried that work population proportion of corporate employees who worry
colleagues and employees are sharing too much information about this exceeds 0.50, using level of significance a 5 0.01.
The sign test that we learned about in Section 14.2 required only that the sample be ran-
domly selected. However, because the requirements for performing the sign test are so mini-
mal, the efficiency of the sign test may not be as high as the analyst would want it to be.
If the sample data are randomly selected and symmetric, however, the data analyst
may apply the more efficient Wilcoxon signed rank test to two of the situations in
which the sign test can be applied, namely, to test for a single population median and
to test for the population median of the differences for matched-pair data.
120
100
80
Frequency
60
0.20
Axis of symmetry 40
Relative frequency
0.15 20
0
0.10 0.00 1.25 2.50 3.75 5.00 6.25 7.50 8.75
Calories per gram
0.05
IQR = 66 8 = 58
0
57.5 60.0 62.5 65.0 67.5 70.0 72.5
Height (inches) Min = 0 Q1 = 0.6 Median = 1.8 Q3 = 3.4 Max = 9.0
Figure 6 Approximately symmetric distribution. Figure 7 Calories per gram are right-skewed.
150
150
100
Frequency
100
Frequency
50
50
0
0
0 100 200 300
70 80 90 100
Fitness scores
Exam scores
IQR = 200 99 = 101
IQR = 98 86 = 12
Min = 70 Q1 = 86 Median = 94 Q3 = 98 Max = 100 Min = 1 Q1 = 99 Median = 153 Q3 = 200 Max = 297
Figure 8 Exam scores are left-skewed. Figure 9 Fitness scores are symmetric.
number of calories per gram for the food items in the Nutrition data set. Note that the
corresponding boxplot has a longer whisker on the right side, and that the median line
is somewhat to the left of the center of the box.
For the left-skewed exam score data in Figure 8, the boxplot has a longer whisker
on the left side, and the median line is somewhat to the right of center. Finally, for the
symmetric fitness score data in Figure 9, the corresponding boxplot has whiskers of
approximately equal length, and the median line is situated approximately in the center
of the box.
Solution
Calculate the signed ranks as follows:
a. 1.
For each data value, find the difference d between the data values for each
matched pair. That is, for each community college, we find d 5 the number
of enrolled students in 2014 minus the number of enrolled students in 2013.
Omit observations where d 5 0. These differences are shown in Column 4
of Table 7.
2. Find the absolute values of the differences. The absolute values of the
differences d are shown in Column 5 of Table 7.
3. Rank the absolute values of the differences from smallest to largest. If two or
more data values are tied with the same rank, assign to each the mean value
of their ranks had they not been tied. (There are no ties in this data set. See
Example 11 to see how ties are handled.) The ranks of the absolute
differences d are shown in Column 6 of Table 7.
4. Attach to each rank the sign of its corresponding value of d. This is its
signed rank. For example, the rank of d for Los Angeles Community
College is 3, but the sign of d (2392) for Los Angeles is negative (2).
We attach this negative sign to the rank to give us Los Angeless signed
rank of 23. Replace each original data value with its corresponding
signed rank. The signed ranks are shown in the last column of
Table 7.
b. The sum of the positive sign ranks is
11556
The sum of the negative signed ranks is
2 3 2 2 2 4 2 6 5 215
The procedure for the Wilcoxon signed rank test for matched-pair data is summarized
as follows.
Table 8 Hypotheses for the Wilcoxon signed rank test for matched-pair data
Null hypothesis Alternative hypothesis Type of test
H0 : Md 5 0 Ha : Md . 0 Right-tailed test
H0 : Md 5 0 Ha : Md , 0 Left-tailed test
H0 : Md 5 0 Ha : Md 0 Two-tailed test
Step 2 Find the critical value and state the rejection rule.
Small-Sample Case (n # 30): Use Appendix Table J. Choose the column with the
appropriate level of significance (a) and the applicable one-tailed or two-tailed test.
Then select the row with the appropriate sample size n, where n is the number of data
values for which d does not equal zero. The number in that row and column is your
critical value Tcrit. The rejection rule is to reject H0 if Tdata # Tcrit.
Large-Sample Case (n . 30): Use Appendix Table C, the standard normal table. The
Z critical value for this sign test is always found in the left tail of the standard normal
distribution, so that Zcrit is always less than 0. For a left-tailed test or a right-tailed test,
the critical value Zcrit is the value of Z with area a to the left of it. For a two-tailed test,
the critical value Zcrit is the value of Z with area a/2 to the left of it. Table 4 in Chapter9
(page 500) contains values of Zcrit for some common values of a. The rejection rule is
to reject H0 if Zdata # Zcrit.
Step 3 Find the value of the test statistic.
First find the signed ranks using the following steps:
a. For each data value, find the difference d between each data value and the
hypothesized median M 0. Omit data values for which d 5 0.
b. Find the absolute values of the differences.
c. Rank the absolute values of the differences from smallest to largest. If two or more data
values have the same rank, assign to each the mean value of their ranks had they not
been tied.
d. Attach to each rank the sign of its corresponding value of d. This is its signed rank.
Replace each original data value with its corresponding signed rank.
Small-Sample Case (n # 30): Use Table 9 to find Tdata, where T1 is the sum of the
positive signed ranks, and T2 is the absolute value of the sum of the negative
signed ranks.
Large-Sample Case (n . 30): Use Table 9 to find Tdata, and then calculate the test
statistic Zdata:
nsn 1 1d
Tdata 2
4
Zdata 5
nsn 1 1ds2n 1 1d
24
Step 4 State the conclusion and the interpretation. Compare the test statistic with the
critical value, using the rejection rule.
We illustrate the Wilcoxon signed rank test for the population median of the differ-
ences using the following example.
Solution
Figure 11 is a TI-83/84 boxplot of the differences (2014 2 2013). The whiskers are
approximately the same length, indicating symmetry. Thus, we have a random sample
Figure 11 TI-83/84 boxplot of
of data exhibiting acceptable symmetry, and so our conditions are met.
the differences.
Step 1 State the hypotheses. We have a left-tailed test:
H0 : Md 5 0 versusHa : Md , 0
0.005 0.01 0.025 0.05
(one tail) (one tail) (one tail) (one tail)
0.01 0.02 0.05 0.10
n (two tails) (two tails) (two tails) (two tails)
5 * * * 1
6 * * 1 2
7 * 0 2 4
Step 4 State the conclusion and the interpretation. Because Tdata 5 6 is not # 2,
we do not reject H0. The evidence is insufficient to conclude that the population median
NOW YOU CAN DO number of students enrolled at California community colleges has decreased from
Exercises 1518. 2013 to 2014.
Table 10 Hypotheses for the Wilcoxon signed rank test for a single population median
Null hypothesis Alternative hypothesis Type of test
H0 : M 5 M0 Ha : M . M 0 Right-tailed test
H0 : M 5 M0 Ha : M , M 0 Left-tailed test
H0 : M 5 M0 Ha : M M 0 Two-tailed test
We illustrate the small-sample case of the Wilcoxon signed rank test for a single
population median using the following example.
Test, using level of significance a 5 0.10, whether the population median age of the
missing children equals 6 years old.
Solution
Step 1 State the hypotheses. We have a two-tailed test:
H0 : M 5 6 versus Ha : M 6
where M represents the population median age of the missing children. Thus, the
hypothesized value for the median is M0 5 6.
Step 2 Find the critical value and state the rejection rule. To find the critical
value, we use Appendix Table J, excerpted here in Figure 13. We have a two-tailed test,
with level of significance a 5 0.10 and n 5 5, which gives us Tcrit 5 1. The rejection
rule is to reject H0 if Tdata # 1.
0.005 0.01 0.025 0.05
(one tail) (one tail) (one tail) (one tail)
0.01 0.02 0.05 0.10
n (two tails) (two tails) (two tails) (two tails)
5 * * * 1
6 * * 1 2
Step 3 Find the value of the test statistic. The calculations to find the signed ranks
are shown in Table 11.
Table 11 Finding the signed ranks for the child age data
Child Age Age 2 M0 5 d |d| Rank of |d| Signed rank
Adam 4 4 2 6 5 22 2 3 23
Juan 9 92653 3 4.5 4.5
Benjamin 5 5 2 6 5 21 1 1.5 21.5
Samantha 7 72651 1 1.5 1.5
Kayleen 6 62650
Aiko 3 3 2 6 5 23 3 4.5 24.5
a. Find d 5 age 2 M0 5 age 2 6 for each child. Note that the value of d for
Kayleen is zero, so we omit Kayleens age from further calculations.
b. The absolute values of the differences d are shown in the fourth column of
Table 11.
c. We rank the absolute differences. Notice that the absolute values for Benjamin
and Samantha are d 5 1. Had they not been tied, their ranks would have been
1and 2. The mean of 1 and 2 is (1 1 2)2 5 1.5. Thus, each childs age is
assigned the rank of 1.5. There is also a tie between Juan and Aiko, with d 5 3.
Had they not been tied, their ranks would have been 4 and 5, so each childs age
is assigned the mean rank of 4.5. The ranks of the absolute differences d are
shown in the fifth column of Table 11.
d. Attach to each rank the sign of its corresponding value of d. This is its signed
rank. For example, the rank of d for Adam is 3, but the sign of d 5 22 for
Adam is negative (2). We attach this negative sign to the rank for Adam to
giveus Adams signed rank of 23. Replace each original data value with its
corresponding signed rank, shown in the last column of Table 11.
Next, we need to sum the positive ranks and the negative ranks. There are two
positive signed ranks: Juans 4.5 and Samanthas 1.5. Thus, T1 5 4.5 1 1.5 5 6.
There are three negative signed ranks, which we add to get T2 : 23 1 (21.5) 1
(24.5) 5 29. Taking the absolute value gives us T2 5 29 5 9. Table 9 tells
us that Tdata 5 the smaller of T1 and T2. Thus, Tdata 5 6.
Step 4 State the conclusion and the interpretation. The rejection rule is to reject
NOW YOU CAN DO H0 if Tdata # 1. Because Tdata 5 6 is not # 1, we do not reject H0. There is insufficient
Exercises 1922. evidence that the population median age of missing children differs from 6 years old.
Solution
The boxplot of the age data is shown here.
The conditions are met because we have a random sample and the distribution of
ages is symmetric.
Step 1 State the hypotheses.
H0 : M 5 6 versus Ha : M 6
where M represents the population median age of the missing children.
Step 2 Find the critical value and state the rejection rule. There are 50 children.
Boxplot of childerns ages.
Ten of these children are 6 years old, so that d 5 6 2 6 5 0. These 10 children are
therefore omitted from this hypothesis test. This leaves us with 40 children, which is
greater than 30, so we use the large-sample case. From Table 4 in Chapter 9 (page500),
the two-tailed test with level of significance a 5 0.10 gives us Zcrit 5 21.645. We will
reject H0 if Zdata # 21.645.
Step 3 Find the value of the test statistic. We use the instructions provided in the
Step-by-Step Technology Guide at the end of this section. Figure 14 shows the Minitab
results, and Figure 15 shows the SPSS results, from the Wilcoxon signed rank test for the
population median. Note that the original sample size (N) is 50, but that N for Test
is n 5 40, because 10 data values have been omitted. The Wilcoxon Statistic is the
value of Tdata 5 279, which represents the smaller of T1 5 279 and T2 5 2541 5 541.
We use this value to find the test statistic:
nsn 1 1d 40s41d
Tdata 2 279 2
4 4
Zdata 5 5 < 21.7608
nsn 1 1ds2n 1 1d 40s41ds81d
24 24
Figure 15 SPSS output for the Wilcoxon signed rank test for a population median.
Step 4 State the conclusion and the interpretation. Because Zdata < 21.7608 #
21.645, we reject H0. There is evidence that the population median age of the missing
children differs from 6 years old. Acquiring more data has changed our conclusion.
MINITAB
Step 1 If you have two samples, enter the values in C1 and Step 3 Click Stat > Nonparametrics > 1-Sample Wilcoxon.
C2. If you have one sample, enter the values in C1. Step 4 For Variables, type C3. Select Test Median, and enter
Step 2 For two samples, click Calc > Calculator. For Store the hypothesized value of the median M 0. Select the form of the
result in variable, type C3. For Expression, type C1C2. Click OK. Alternative hypothesis, and click OK.
SPSS
We use the data in Example 12 to illustrate the procedure. Step 2 Click Data > Select Cases, click If condition is
Step 1 Enter the data into the first column. Under the Variable satisfied, and click If.
View tab, rename the variable Age and change Measure Step 3 In the empty formula box, type Age 6. Click
to Scale. Continue then OK.
Step 4 Click Analyze > Nonparametric Tests > One signed-rank test). Enter the Hypothesized median, 6, and
Sample. click Run.
Step 5 Select the Fields tab, and move Age to Test Fields. Step 7 Double-click the table of results in the Output window to
Step 6 Select the Settings tab, select Customize tests, open the Model Viewer, and observe the right-hand side. The
and check Compare median to hypothesized (Wilcoxon results are shown in Figure 15 of Example 12.
CRUNCHIT!
We use the data in Table 7 to illustrate the procedure. Step 3 Select Statistics > Non-parametrics > Wilcoxon Signed
Step 1 Enter the 2013 data into Var1 and the 2014 data into Var2. Rank. For Sample, select Var5. Enter the Median under null
Step 2 Select Insert > Evaluate Formula. Enter Var22Var1 hypothesis, 0, and for the Alternative hypothesis choose Less
and click Evaluate. The differences appear in Var5. than. Click Calculate.
The accompanying figure is a boxplot of the data. Use level Table 12 Pain levels before and after Reiki touch
of significance a 5 0.05. therapy
Patient 1 2 3 4 5 6 7 8 9 10 11 12 13
After 3 1 0 0 2 1 2 1 0 4 1 4 8
24. Earthquake Magnitudes. The following data from Before 6 2 2 3 3 4 2 5 1 6 6 4 8
the U.S. Geological Survey represent the magnitude on the Difference 23 21 22 23 21 23 0 24 21 22 25 0 0
Richter scale of a random sample of 10 earthquakes
worldwide that occurred during the week of August 3, 2014.
Test, using the Wilcoxon signed rank test, whether there was
5.65.06.35.45.75.35.14.55.34.9 a reduction in mean pain level after the Reiki therapy, using
The accompanying figure is a boxplot of the data. Use the level of significance a 5 0.05. The accompanying figure is a
Wilcoxon signed rank test to test whether the population boxplot of the data.
median magnitude of earthquakes is less than 6.0. Use
level of significance a 5 0.01.
28. Video Game Ratings. GameRankings.com publishes
summary statistics for reviews of video games. The
25. Small Businesses. The following data set represents the following data set represents a random sample of video
number of businesses in a random sample of eight cities games, with their average reviewer score for the PlayStation 3
nationwide.5 platform and the Xbox 360 platform, as of January 23, 2009.
Test whether the population median of the differences
79233642690963314311557828282781 (PlayStation 3 2 Xbox 360) is less than zero, using level of
The accompanying figure is a boxplot of the data. Test, using significance a 5 0.05. gameranking
the Wilcoxon signed rank test, whether the population
median number of businesses per city is greater than 2500, PlayStation 3 Xbox 360
using level of significance a 5 0.01. mean mean
Game reviewer score reviewer score
Grand Theft Auto IV 0.9373 0.9656
BioShock 0.9403 0.9525
26. Outliers: Muscular Endurance. The muscular
Call of Duty 4 0.9378 0.9416
endurance of 15 randomly selected males was measured after
Rock Band 0.9119 0.9225
taking a single 600-milligram dose of vitamin C and also after
The Orange Box 0.8838 0.9624
taking a sugar placebo. Muscular endurance was measured by
Guitar Hero III: 0.8390 0.8622
repetitive grip strength.6 The following data setrepresents the
Legends of Rock
differences in muscular endurance (vitamin C 2 placebo).
In Section 14.3, we compared data from dependent samples. Here, in Section 14.4, we
analyze data from independent samples. Recall from Section 10.1 that two samples are
independent when the subjects selected for the first sample do not determine the sub-
jects in the second sample. In Section 10.2, we learned how to perform a hypothesis test
for the difference in population means using two independent samples. The two-sample
t test that we learned in that section required either that each sample size be large
(at least 30) or that each population be normally distributed. Here, in Section 14.4,
we will learn about the Wilcoxon rank sum test for the difference in population medi-
ans using two independent samples, which has less stringent conditions.
The Wilcoxon rank sum test is a nonparametric hypothesis test in which the original data
from two independent samples are transformed into their ranks. It tests whether the two
The Wilcoxon rank sum test is population medians are equal or not.
equivalent to the Mann-Whitney
test, another nonparametric test
used in some textbooks to test for In the Wilcoxon rank sum test, the two samples are temporarily combined, and the
the difference in population ranks of the combined data values are calculated. Then the ranks are summed sepa-
medians. (By an equivalent rately for each sample.
hypothesis test, we mean a
hypothesis test that is applicable to R1 5 the sum of the ranks for the first sample
the same situations and always
provides the same conclusions.) R2 5 the sum of the ranks for the second sample
Example 13 Finding the ranks of combined data and summing the ranks for each
sample
The following table shows the pulse rates in beats per minute for a random sample of
five women and a random sample of four men.
a. Combine the data sets and find the ranks.
b. Find the sum of the ranks for the women and the sum of the ranks for the men.
Women 6677576268
Men 79716871
Solution
a. We temporarily combine the two samples and arrange the values in increasing
order. We then rank the data values from smallest to largest, as shown in the
following table. Note that we have two pulse rates of 68 beats per minute. Had
these not been tied, they would have had ranks 4 and 5. We therefore assign to
each the mean rank (4 1 5)2 5 4.5. Similarly, the two pulse rates of 71 beats
per minute are assigned the mean rank (6 1 7)2 5 6.5.
NOW YOU CAN DO The sum of the ranks for the men is
Exercises 710. R2 5 4.5 1 6.5 1 6.5 1 9 5 26.5
Suppose we have two independent samples. Let M1 and M2 represent the popula-
tion median of the first and second samples, respectively. Then we have the following
two-tailed hypotheses for the Wilcoxon rank sum test:
H0 : M1 5 M2versusHa : M1 M2
The null hypothesis states that the two populations have the same median. If this is
When performing the Wilcoxon
true, we expect that R1, the sum of the ranks for the first sample, will not be very dif-
rank sum test, we need to find R1
only, the sum of the ranks for the
ferent from R2, the sum of the ranks for the second sample. Large differences between
first sample. It is not necessary to R1 and R2 will therefore lead us to reject the null hypothesis that no difference exists in
find the sum of the ranks for the the population medians. When the conditions are met, the distribution of R1 follows an
second sample, R2. approximately normal distribution.
Step 2 Find the critical value and state the rejection rule.
Use Table 14 to find the critical value and the rejection rule.
Table 14 Critical values and rejection rules for the Wilcoxon rank sum test
Form of hypothesis test
Right-tailed Left-tailed Two-tailed
H0 : M1 5 M2 H0 : M1 5 M2 H0 : M1 5 M2
Ha : M1 . M2 Ha : M1 , M2 Ha : M1 M2
a 5 0.10 Z crit 5 1.28 Z crit 5 21.28 Z crit 5 1.645
a 5 0.05 Z crit 5 1.645 Z crit 5 21.645 Z crit 5 1.96
a 5 0.01 Z crit 5 2.33 Z crit 5 22.33 Z crit 5 2.58
Rejection rule Reject H 0 if Reject H 0 if Reject H 0 if
Zdata $ Z crit Zdata # Z crit Zdata # 2Z crit or if
Zdata $ Z crit
sR 5 n1n2sn1 1 n2 1 1d
12
n1 and n2 represent the sample sizes for samples 1 and 2, respectively, and R1 5 the sum
of the ranks for the first sample.
Step 4State the conclusion and the interpretation. Compare the test statistic with the
critical value, using the rejection rule.
Women 667757626878738184696279
Men 7971687168867358687478
Solution
The data were obtained using random samples. Also, we assume that the distributions
of the populations have the same shape. Also, we have n1 5 12 and n2 5 11, so the
conditions for performing the Wilcoxon rank sum test are satisfied.
Step 1 State the hypotheses. The key words less than indicate that we have a left-
tailed test, from Table 13:
H0 : M1 5 M2versusHa : M1 , M2
where M1 and M2 represent the population median pulse rates of the first (women) and
second (men) samples, respectively.
Step 2 Find the critical value and state the rejection rule. The level of significance
is a 5 0.05, so from Table 14 our critical value is Zcrit 5 21.645, and our rejection rule
is to reject H0 if Zdata # 21.645.
Step 3 Find the value of the test statistic. We combine the two samples and arrange
in increasing order. We then rank the data values from smallest to largest, as shown in
the following table, assigning ties to the mean rank value.
Combined data 57 58 62 62 66 68 68 68 68 69 71 71
Rank 1 2 3.5 3.5 5 7.5 7.5 7.5 7.5 10 11.5 11.5
Combined data 73 73 74 77 78 78 79 79 81 84 86
Rank 13.5 13.5 15 16 17.5 17.5 19.5 19.5 21 22 23
We have
n1sn1 1 n2 1 1d 12s12 1 11 1 1d
mR 5 5 5 144
2 2
sR 5 n1n2 sn1 1 n2 1 1d
12
5 12s11ds12 1 11 1 1d
12
< 16.2481
So that
R1 1 mR 140 2 144
Zdata 5 < < 20.2462
sR 16.2481
Step 4 State the conclusion and the interpretation. We said in Step 2 that we
would reject H0 if Zdata # 21.645. But Zdata < 20.2462, which is not # 21.645.
NOW YOU CAN DO Therefore, our conclusion is to not reject H0. There is insufficient evidence that the
Exercises 1114. population median pulse rate for women is less than that for men.
female adolescents with AN (patients) and n2 5 340 randomly selected female ado-
Getty Images
lescents without AN (controls) was estimated by interviewing their mothers. The sam-
ples were drawn independently. Use Minitab and SPSS to test whether the population
median minutes of physical activity for the patients differs from that for the controls,
using level of significance a 5 0.01.
Solution
Because both the patients and the controls were randomly selected, because n1 . 10
and n2 . 10, and because we assume that both population shapes are the same, we may
proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : M1 5 M2versusHa : M1 M2
where M1 and M2 represent the population median activity level (in minutes) of the
patients and the controls, respectively.
Step 2 Find the critical value and state the rejection rule. The level of significance
is a 5 0.01, so our critical value is Zcrit 5 2.58. We will reject H0 if Zdata # 22.58 or if
Zdata $ 2.58.
Step 3 Find the value of the test statistic. We use the instructions provided in the
Step-by-Step Technology Guide at the end of this section. Figure 16 shows the Minitab
results from the Mann-Whitney test, which is equivalent to the Wilcoxon rank sum test
for independent samples. Figure 17 shows the SPSS results from the Mann-Whitney test.
N Median
with AN 314 4200.0
without AN 340 3240.0
sR 5 n1n2 sn1 1 n2 1 1d
12
5 314s340ds314 1 340 1 1d
12
< 2413.9836
So that
R1 1 mR 109,336.5 2 102,835
Zdata 5 < < 2.6933
sR 2413.9836
Step 4 State the conclusion and the interpretation. We said we will reject H0 if
Zdata # 22.58 or if Zdata $ 2.58. We have Zdata < 2.6933, which is greater than 2.58.
Therefore, we reject H0. There is evidence that the population median amount of
physical activity for female adolescents with AN differs from the population median
amount of physical activity for female adolescents without AN.
MINITAB
Step 1 Enter the values of the first variable in C1 and the values Step 3 For First Sample, type C1. For Second Sample, type
of the second in C2. C2. Select the Not Equal form of the Alternative hypothesis, and
Step 2 Click Stat > Nonparametrics > Mann-Whitney. click OK.
SPSS
Step 1 Enter the activity data in the first column and a numeric code Step 3 In the Fields tab, move Activity to Test Fields and Group
for group (for example, 0 for control and 1 for patients) in the second to Groups.
column. Under the Variable View tab, name your variables Activity Step 4 In the Settings tab, select Customize tests and check
and Group, set Decimals at 0 for Group, and set the Measure for Mann-Whitney (2 samples). Click Run.
Activity to Scale and the Measure for Group to Nominal. Step 5 Double-click on the output to open the Model Viewer
Step 2 Click Analyze > Nonparametric Tests > Independent window, and observe the results on the right-hand side, shown in
Samples. Figure 17 of Example 15.
CRUNCHIT!
Step 1 Click File, highlight Load from Larose, Discostat3e > Step 3 For Sample 1, select Women. For Sample 2, select
Chapter 14, and select Example 14. Men.
Step 2 Click Statistics, highlight Non-parametrics, and select Step 4 For Location shift under null hypothesis, input 0. For
Mann-Whitney U. Alternative, choose Less than. Click Calculate.
19. Phosphorus and Potassium in Food. The following per county differs for California versus Georgia, using level
data represent independent random samples taken from a of significance a 5 0.05. gacaincome
population of food items, recording the amount of
phosphorus in the first sample and the amount of potassium Income in California and Georgia
in the second sample (both measurements are
in milligrams). Test whether the population median amount Per capita Per capita
of phosphorus differs from the population median amount California personal Georgia personal
of potassium, using level of significance a 5 0.05. county income ($) county income ($)
phospotassium
Alameda 45,689 Treutlen 18,840
Ventura 42,746 Effingham 28,443
Phosphorus (mg) 42414361213950927222143 Napa 47,491 Echols 19,171
976631140142011089131 Solano 35,074 Wilcox 21,546
547171295611734 Yolo 31,990 Whitfield 29,838
Potassium (mg) 10638762723766315010318 Tulare 24,153 Monroe 30,352
26527162171323027336 San Benito 32,472 Fannin 25,020
292298278 Colusa 25,201 Henry 26,876
Source: U.S. Department of Agriculture. Santa Clara 55,735 Liberty 24,216
Monterey 38,373 Stephens 25,931
20. Income in California and Georgia. The following table
contains the per capita personal income for independent Shasta 30,762 Dooly 21,228
random samples of counties in California and Georgia. Test San Mateo 66,839
whether the population median per capita personal income Source: U.S. Bureau of Economic Analysis.
In Section 14.4, we learned the Wilcoxon rank sum test, which tests whether the popu-
lation medians of two independent random samples are equal. Here, in Section 14.5,
we extend this method from two populations to three or more populations.
The Kruskal-Wallis test is a nonparametric hypothesis test in which the original data from
three or more independent samples are transformed into their ranks. It tests whether the
population medians are all equal.
To calculate the test statistic for the Kruskal-Wallis test, we temporarily combine
all the data values from all the samples and find the ranks of the combined data values.
So far, this is exactly what we did for the Wilcoxon rank sum test, except that now we
have k (three or more) samples instead of just two samples. Then the ranks are summed
separately for each of the k samples.
R1 5 the sum of the ranks for the first sample
R2 5 the sum of the ranks for the second sample, and so on, until
:
Rk 5 the sum of the ranks for the kth (last) sample
Let n1, n2, . . . , nk represent the sample sizes for samples 1, 2, . . . , k, respectively. And
let N represent the total number of data values in all the samples combined; that is,
N 5 n1 1 n2 1 . . . 1 nk. To perform the Kruskal-Wallis test, each of the sample sizes
n1, n2, . . . , nk must be at least 5. Then the Kruskal-Wallis test statistic is given by
R2k
1 2
12 R21 R22
x2data 5 1 1? ? ? 1 2 3sN 1 1d
NsN 1 1d n1 n2 nk
When the conditions are met, x2data follows a x2 distribution with k 2 1 degrees of
freedom.
Solution
a. The combined data, and their ranks, are shown here.
Combined data 2,108 2,153 2,276 3,070 3,274 3,424 3,718 3,855 4,403
Rank 1 2 3 4 5 6 7 8 9
Combined data 4,883 4,948 5,825 6,865 7,184 8,150 8,771 9,489 13,729
Rank 10 11 12 13 14 15 16 17 18
R2k
1 2
12 R21 R22
x2
5 1 1 1 2 3sN 1 1d
data
NsN 1 1d n1 n2 nk
5
12
1 962 312 442
18s19d 7
1
5
1
6 2
2 3s19d 7.261
NOW YOU CAN DO Later, we will find out if this value for the test statistic warrants rejection of the null
Exercises 714. hypothesis. But first, we need to learn the hypotheses for the Kruskal-Wallis test.
Recall from Chapter 12 that the null hypothesis for ANOVA is that all population
means are equal, and that the alternative hypothesis is that not all the population means
are equal. The hypotheses for the Kruskal-Wallis test are the same, except that we are
testing for medians instead of means.
Next, we will summarize the steps for performing the Kruskal-Wallis test for the
equality of three or more population medians.
Solution
Each sample is independent and randomly selected, and each sample has at least five
data values. Thus, the conditions for the Kruskal-Wallis test are met, and we may pro-
ceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : The population median numbers of small businesses per city are all equal.
Ha : Not all the population median numbers of small businesses per city are equal.
Step 2 Find the x2 critical value x2crit and state the rejection rule. We have level of
significance a 5 0.05. There are k 5 3 samples, so our degrees of freedom equals
k 2 1 5 3 2 1 5 2. Using Appendix Table E, we select the column headed 0.05 and
the row with degrees of freedom 5 2. This gives us x2crit 5 5.991 (see Figure 18). The
rejection rule is to reject H0 if x2data $ 5.991.
Step 3 Find the value of the test statistic x2data. From Example 16, we have
x2data 7.261.
NOW YOU CAN DO Step 4 State the conclusion and the interpretation. Because 7.261 $ 5.991, we
reject H0. Evidence exists that not all the population median numbers of small
Exercises 1518. businesses per city are equal for Florida, North Carolina, and Texas.
Solution
Each sample is independent and randomly selected, and there are at least five data
values in each sample. Thus, the conditions for the Kruskal-Wallis test are met, and we
may proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : The population median motivation scores are all equal.
Ha : Not all the population median motivation scores are equal.
Step 2 Find the x2 critical value x2crit and state the rejection rule. We have level of
significance a 5 0.01. There are k 5 3 samples, so our degrees of freedom equals
k 2 1 5 3 2 1 5 2. Using Appendix Table E, we find x2crit 5 9.210. The rejection rule
is to reject H0 if x2data $ 9.210.
Step 3 Find the value of the test statistic x2data. We use the instructions in the Step-
by-Step Technology Guide at the end of this section. Figure 19 shows the Minitab
results from the Kruskal-Wallis test applied to the Facebook data. Figure 20 shows the
output from the same test in JMP. Minitab denotes x2data as H (use the one that is
adjusted for ties). Thus, from Figure 19, x2data 5 15.79.
Step 4 State the conclusion and the interpretation. Because 15.29 . 9.210, we reject
H0. There is evidence that not all the population median motivation scores areequal for the
low-disclosure, medium-disclosure, and high-disclosure Facebook pages.
MINITAB
We use Example 18 to illustrate. Step 2 Click Stat > Nonparametrics > Kruskal-Wallis.
Step 1 Enter the Motivation values for all samples in C1 and Step 3 For Response, type C1. For Factor, type C2. Click OK.
the group label in C2. The group data indicate which sample the Output is shown in Figure 19 of Example 18.
response data values are drawn from.
SPSS
Step 1 Enter the Motivation data in the first column. Enter a
numeric code for the self-disclosure level in the second column.
Step 2 Under the Variable View tab, rename the columns
Motivation and Group. Assign Decimals of 0 for Group. Change
Measure to Scale for Motivation and Nominal for Group.
Step 3 Click Analyze > Non-parametric Tests > Independent
Samples .
Step 4 Under the Fields tab, move Motivation to Test Fields and
Group to Groups.
Step 5 Under the Settings tab, click Customize tests and select
Kruskal-Wallis 1-way ANOVA (k samples). Click Run.
Step 6 Double-click the output to bring up the Model Viewer
window. Observe the results on the right-hand side, shown in
Figure 21.
JMP
Step 1 Enter the motivation score in the first column. Enter a Step 4 Select the red triangle beside One-Way Analysis of
numeric code for the self-disclosure level in the second column. Motivation by Group, click Nonparametric, and select Wilcoxon
Step 2 Rename the columns Motivation and Group. Right-click Test. Output for the Kruskal-Wallis Tests appears, under the
Group, select Column Info and change Data Type to Character. heading Wilcoxon/Kruskal-Wallis Tests. See Figure 20 in
Step 3 Click Analyze > Fit Y by X. Move Motivation to Y, Example 18.
Response and Group to X, Factor. Click OK.
CRUNCHIT!
For data with groups in different columns (unstacked data): Step 1 Select Statistics, highlight Non-parametrics, and select
Step 1 Select Statistics, highlight Non-parametrics, and select Kruskal-Wallis.
Kruskal-Wallis. Step 2 Select the Grouped tab. For Data, select the column
Step 2 In the Columns tab, select the columns that contain the that contains the data. For Group by, select the column that
data. Click Calculate. contains the group labels. Click Calculate.
For data with values in one column and groups in another column
(stacked data):
stock market returns are the same across all three groups, States, Canada, and Mexico. Use level of significance
using level of significance a 5 0.01. prosdartsanova a 5 0.01. infantmortality
The rank correlation test (also called Spearmans rank correlation test) is based on the
ranks of matched-pair data. This test may also be applied when the original data are
ranks. In the rank correlation test we investigate whether two variables are related by
analyzing the ranks of matched-pair data. The rank correlation test may also be used to
detect a nonlinear relationship between two variables.
Example 19 Calculating the test statistic for the rank correlation test
femaleliteracy
The fertility rate is the mean number of children born to a typical woman in the
country, and the female literacy rate is the percentage of women at least 15 years old
who can read and write. The table contains the female literacy rate (in percent) and the
fertility rate (in numbers of children) for a random sample of 10 countries.
China 87 1.73
Israel 94 2.41
Italy 98 1.28
United States 99 2.09
Poland 100 1.25
Calculate the test statistic for the rank correlation test, using the following steps:
a. Rank the values of the first variable (female literacy) from lowest to highest.
b. Rank the values of the second variable (fertility) from lowest to highest.
c. For each subject (country), find the difference in ranks, d, and square the
difference in ranks to get d2. Add up the d2-values to get d2.
d. Complete the calculation of the test statistic rdata:
rdata 5 1 2
6 od
2
nsn2 2 1d
where n represents the sample size (number of matched pairs).
Solution
Table 15 contains the calculations needed to find rdata.
Because there are n 5 10 countries, the value of the test statistic is given by
rdata 5 1 2
6 od 2
512
6s310d
< 20.8788
nsn 2 1d
2
10s99d
NOW YOU CAN DO
Exercises 912. We now present the steps for performing the rank correlation test.
Table 16
Critical values and rejection rule for the rank correlation test,
large-sample case
Level of significance a Critical value Zcrit Rejection rule
rdata 5 1 2
6 od 2
nsn2 2 1d
where n represents the sample size (number of matched pairs).
Large-Sample Case (n . 30): Use Steps ad from the small-sample case. However,
we are using a normal approximation, so the test statistic is called Zdata.
zdata 5 1 2
6 od 2
nsn 2 1d
2
Solution
The data come from a random sample, so we may proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : No rank correlation exists between female literacy and fertility.
Ha : A rank correlation exists between female literacy and fertility.
Step 2 Find the critical value and state the rejection rule. There are n 5 10
countries in the data set in Table 15, so we apply the small-sample case (n # 30). Use
Appendix Table K. We select the column with level of significance a 5 0.01 and the
row with n 5 10. Our critical value is rcrit 5 0.794 (see Figure 22). We will reject H0 if
rdata $ 0.794 or if rdata # 20.794.
Figure 22 Finding the critical value rcrit for the rank correlation test.
Step 3 Find the value of the test statistic rdata. In Example 19, we found rdata
20.8788.
Step 4 State the conclusion and the interpretation. Because 20.8788 # 20.794,
our conclusion is to reject H0. There is evidence for a rank correlation between female
literacy and fertility. Because rdata is negative, the association between female literacy
NOW YOU CAN DO and fertility is a negative relationship. That is, as female literacy increases, fertility
Exercises 1320. tends to decrease, and vice versa.
Solution
The expanded data set comes from a random sample, so we proceed with the hypoth-
esis test.
Step 1 State the hypotheses.
H0 : No rank correlation exists between female literacy and fertility.
Ha : A rank correlation exists between female literacy and fertility.
Step 2 Find the critical value and state the rejection rule. There are now n 5 37
countries, so we apply the large-sample case (n . 30). With level of significance a 5
0.01, we find our critical value Zcrit from Table 16:
2.58
Zcrit 5 5 0.43
37 2 1
We will reject H0 if Zdata $ 0.43 or if Zdata # 20.43.
Step 3 Find the value of the test statistic rdata. We use the instructions provided in
the Step-by-Step Technology Guide at the end of this section. Figure 23 shows the
Minitab results, with rdata denoted as Pearson correlation of female literacy and
fertility 5 20.831. Although Minitab thus identifies the statistic as the linear
correlation coefficient for numerical data that we learned in Chapter 4, this statistic is
nevertheless equal to the rank correlation coefficient, because it is based on ranks.
Step 4 State the conclusion and the interpretation. Because 20.831 # 20.43, we
reject H0, just as we did for the small-sample case. There is evidence for a rank
correlation between female literacy and fertility.
10 Q
Letter Frequency Scrabble points
X
Q 0.003 10 8
Points in Scrabble
L 0.035 1 6
K
G 0.016 2
4
E 0.130 1
X 0.005 8 G
2
L S T E
T 0.093 1
0
S 0.063 1
0.00 0.02 0.04 0.06 0.08 0.10 0.12 0.14
K 0.003 5 Relative frequency in English language
Solution
The data come from a random sample, so we may proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : No rank correlation exists between language frequency and Scrabble points.
Ha : A rank correlation exists between language frequency and Scrabble points.
Step 2 Find the critical value and state the rejection rule. There are n 5 8 letters in
the random sample, so we apply the small-sample case (n # 30). Using Appendix Table K,
we select the column with level of significance a 5 0.05 and the row with n 5 8. Our
critical value is rcrit 5 0.738. We will reject H0 if rdata $ 0.738 or if rdata # 20.738.
Step 3 Find the value of the test statistic. See Table 17.
There are n 5 8 letters in the sample, so the value of the test statistic is given by
rdata 5 1 2
6 od 2
512
6s148.5d
20.7679
nsn 2 1d 2
8s63d
Step 4 State the conclusion and the interpretation. Because 20.7679 # 20.738,
we reject H0. There is evidence for a rank correlation between the frequency of letters
in the English language and the number of points each letter is worth in the game of
Scrabble. Because rdata is negative, the relationship is also negative. That is, high point
values are associated with low frequency in English, and vice versa.
30
2014 mpg
25
20
15
15 20 25 30 35
2007 mpg
Solution
The data come from a random sample of matched pairs, so we may proceed with the
hypothesis test.
Step 1 State the hypotheses.
H0 : No rank correlation exists between the 2007 mpg and the 2014 mpg.
Ha : A rank correlation exists between the 2007 mpg and the 2014 mpg.
Step 2 Find the critical value rcrit and state the rejection rule. There are n 5 14
vehicles in the data set, so we apply the small-sample case (n # 30). In Appendix Table K
we select the column with level of significance a 5 0.01 and the row with n 5 14. Our
critical value is rcrit 5 0.679. We will reject H0 if rdata $ 0.679 or if rdata # 20.679.
Step 3 Find the value of the test statistic rdata. We use Table 18 to find d2
We have
o d 2
5 46.5
Then, because there are n 5 14 vehicles, the value of the test statistic is given by
rdata 5 1 2
6 od 2
512
6s46.5d
< 0.8978
nsn 2 1d
2
14s195d
Step 4 State the conclusion and the interpretation. Because rdata 0.8978 $
0.679, we reject H0. Evidence exists for a rank correlation between the 2007 vehicle
mpg and the 2014 vehicle mpg. Because rdata is positive, the association between 2007
and 2014 vehicle mpg is a positive relationship. In other words, vehicles that had low
gas mileage in 2007 tended to have low gas mileage in 2014, while the vehicles that
had high gas mileage in 2007 tended to have high gas mileage in 2014.
TI-83/84
Step 1 Enter the ranks into lists L1 and L2. Make sure that the Step 3 Press STAT, and highlight CALC. Select LinReg(a+bx)
two lists represent paired data; that is, the first value in L1 and press ENTER twice. The displayed value of r is the value of
represents the same subject as the first value in L2, and so on. the rank correlation.
Step 2 Press 2nd and then CATALOG. Scroll down to
DiagnosticOn and press ENTER twice.
EXCEL
Step 1 Enter the ranks into columns A and B. Make sure Step 2 In cell C1, type 5 CORREL(A1 : An, B1:Bn), where n is
thatthe two lists represent paired data; that is, the first value in A replaced by the sample size for your data. Hit Enter. The
represents the same subject as the first value in B, and so on. displayed value of r is the value of the rank correlation.
MINITAB
Step 1 Enter the raw data values into columns C1 and C2. Step 2 Select Stat . Basic Statistics . Correlation .
Make sure thatthe two lists represent paired data; that is, the first Step 3 Enter C1 and C2 under Variables. Under Method,
value in C1 represents the same subject as the first value in C2, choose Spearman rho and click OK.
and so on.
SPSS
Step 1 Enter the raw data values into the first two columns. Step 2 Select Analyze . Correlate . Bivariate .
Make sure thatthe two lists represent paired data; that is, the first Step 3 Move the two variables to Variables, uncheck Pearson,
value in the first column represents the same subject as the first check Spearman, and clickOK.
value in the second column, and so on.
JMP
Step 1 Click File > New > Data Table. Enter the raw data Step 2 Select Analyze . Multivariate Methods . Multivariate
values into Column 1 and Column 2. Make sure thatthe two lists Step 3 Move the two variables to Y, Columns and click OK.
represent paired data; that is, the first value in Column 1 represents Step 4 Click the red arrow beside Multivariate, highlight
the same subject as the first value in Column 2, and so on. Nonparametric Correlations, and select Spearmans r.
c. Calculate the test statistic rdata. (AP) poll and the USA Today poll. Test whether a rank
d. State the conclusion and the interpretation. correlation exists between the two polls, using level of
17. Use the data and test statistic from Exercise 9, level of significance a 5 0.10. collegefootball
significance a 5 0.01, and rcrit from Exercise 13.
18. Use the data and test statistic from Exercise 10, level of College AP Poll USA Today Poll
significance a 5 0.05, and rcrit from Exercise 14. Florida State 1500 1475
19. Use the data and test statistic from Exercise 11, level of Auburn 1428 1388
significance a 5 0.10, and rcrit from Exercise 15. Michigan State 1385 1375
20. Use the data and test statistic from Exercise 12, level of
South Carolina 1247 1219
significance a 5 0.05, and rcrit from Exercise 16.
Missouri 1236 1200
APPLYING THE CONCEPTS Oklahoma 1205 1189
Alabama 1114 1086
21. Ranking the Presidents. A study asked a randomly
selected group of liberal historians and a randomly selected Clemson 1078 1091
group of conservative historians to rank the presidents of the Oregon 974 975
United States since George Washington.12 Interestingly, both UCF 959 865
groups agreed on the top five presidents, but the rankings Stanford 936 872
were not exactly the same. The rankings for the top five are Ohio State 816 872
shown here. Test whether a rank correlation exists between Baylor 778 796
the liberal ranks and the conservative ranks, using level of LSU 717 719
significance a 5 0.10. Note that you need not calculate the
Louisville 693 703
ranks, as the ranks are given. presidents
UCLA 632 597
Oklahoma State 598 587
Conservative
President Liberal rank rank Texas A&M 459 443
USC 299 313
Abraham Lincoln 1 1
Notre Dame 256 125
George Washington 3 2
Arizona State 255 302
Franklin Roosevelt 2 3
Wisconsin 245 266
Thomas Jefferson 4 4
Duke 190 202
Theodore Roosevelt 5 5
Vanderbilt 117 180
22. Best Countries for Business. The Web site www.
24. Population and Area. Does an association exist
doingbusiness.org publishes rankings on the best countries for
between the size (in square miles) of a nation and the
doing business. The following data set represents a random
number of people who live in that nation (the population)?
sample of nations and their rankings in two categories: ease of
The following data set represents a random sample of 12
doing business and ease of starting up a new business. Test
countries and their areas and populations. Test whether a
whether a rank correlation exists between the two categories,
rank correlation exists between area and population, using
using level of significance a 5 0.05. Note that you need not
level of significance a 5 0.05. populationarea
calculate the ranks, as the ranks are given. bestbusiness
Area
Ease of doing Ease of starting Nation (square miles) Population
Nation business a new business
Bangladesh 55,598 147,365,352
Ireland 2 2 United States 3,718,691 298,444,215
Japan 4 6 China 3,705,386 1,313,973,713
Canada 3 1 India 1,269,338 1,095,351,995
South Africa 5 4 Greece 50,942 10,688,058
United States 1 3 Canada 3,855,081 33,098,932
Mongolia 7 5 Japan 145,882 127,463,611
Mexico 6 7 Kazakhstan 1,049,150 15,233,244
Mexico 761,602 107,449,525
23. College Football. Different polls do not all show the Saudi Arabia 756,981 27,019,731
same rankings for the best teams in college football. The
Singapore 267 4,492,150
table contains the points (calculated by votes received) for
the top 24 teams for the 2013 season in the Associated Press Australia 2,967,893 20,264,082
Age of child Weight cancer per 100,000 people and the number of cigarettes
in months in ounces smoked in hundreds per capita. Use the rank correlation test
to test for a relationship between the number of deaths from
0 103
bladder cancer and the per capita number of cigarettes
1 152
smoked, using level of significance a 5 0.05.
3 194
cigarettecancer
4 229
6 276
8 276 Deaths from
10 288 Cigarettes per bladder cancer per
12 304 State capita (100s) 100,000 people
15 319 Kansas 21.84 2.91
18 334 Washington 21.17 4.04
24 359 Oklahoma 23.44 2.93
30 394
Maryland 25.91 5.21
Source: Centers for Disease Control and Prevention.
Texas 20.08 2.94
29. Cigarettes and Bladder Cancer. A study examined the Louisiana 21.58 4.65
relationship between the number of cigarettes smoked and Massachusetts 26.92 4.69
various types of cancer.13 The relationship between bladder Rhode Island 29.18 4.99
cancer and the number of cigarettes may involve a nonlinear
Florida 28.27 4.46
component. The following data set is a random sample of
U.S. states, along with the number of deaths from bladder Alaska 30.34 3.46
Recall from Chapter 13 that one of the assumptions for the linear regression model was
that the values of the response variable y were independent. We checked this assump-
tion using a scatterplot of the residuals against the fitted values; if systematic curvature
was present, then the assumption was violated. Here, in Section 14.7, we learn a
hypothesis test for checking this assumption, called the runs test for randomness.
A sequence is an ordered data set. A run is a sequence of observations sharing the same
value (of two possible values), preceded or followed by data having the other possible
value or by no data at all. The runs test for randomness tests whether the data in a
sequence are random or whether there is a pattern in the sequence.
For example, suppose that we are noting the gender (F 5 female, M 5 male) of the
first 16 students to enter your statistics classroom today as they walk in the door. Here
are two possible sequences:
Sequence 1: F F F F F F F F M M M M M M M M
Sequence 2: F M F M F M F M F M F M F M F M
In the first sequence, there is a run of eight females, followed by a run of eight males.
The eight females form a run because they represent a sequence of observations shar-
ing the same value: F. Similarly, the eight males form a run. In Sequence 2, we note
that the genders are alternating. The first data value F is followed immediately by an
observation with a different value: M. Thus, the first data value itself forms a run. Simi-
larly, each of the remaining observations forms a run of length 1.
Solution
NOW YOU CAN DO There are n1 5 12 females and n2 5 8 males, so that n 5 n1 1 n2 5 12 1 8 5 20. There
Exercises 58. are G 5 10 runs.
If the number of runs is too low or too high, this is evidence that a pattern exists in
the data set. If the number of runs is neither too high nor too low, this is evidence that
no time-ordered pattern exists in the data set, which may then be considered random.
Thus, the runs test for randomness tests whether the number of runs is either too high
or too low. There are large- and small-sample cases for the test statistic and the critical
values for the runs test for randomness, as shown in the following steps.
appropriate value of n2. The two values at the intersection of this row and column
represent the lower critical value Gcrit, lower and the upper critical value Gcrit, upper. The
rejection rule is to reject H0 if Gdata # Gcrit, lower or if Gdata $ Gcrit, upper.
Large-Sample Case (n1 . 20 or n2 . 20): A normal approximation is used. See Table 19.
Table 19
Critical values and rejection rule for the runs test,
large-sample case
Level of
significance Critical value Zcrit Rejection rule
0.10 1.645 Reject H0 if
0.05 1.96 Zdata # 2Zcrit
0.01 2.58 or if Zdata $ Zcrit
2n1 n2
mG 5 11
n1 1 n2
sG 5 s2n1n2ds2n1n2 2 n1 2 n2d
sn1 1 n2d2 sn1 1 n2 2 1d
G 2 mG
zdata 5
sG
Solution
We know that the data are time-ordered, and that each data value represents one of two
distinct outcomes. We may thus proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : The sequence of data is random.
Ha : The sequence of data is not random.
Step 2 Find the critical values, and state the rejection rule. We have n1 5 12
females and n2 5 8 males, so the small-sample case applies (n1 # 20 and n2 # 20). In
Value of n2
2 3 4 5 6 7 8 9 10 11 12
1 1 1 1 1 1 1 1 1 1 2
2
6 6 6 6 6 6 6 6 6 6 6
Value of n1
1 2 3 3 4 5 5 5 6 6 7
10
6 8 10 12 13 14 15 16 16 17 17
1 2 3 4 4 5 5 6 6 7 7
11
6 8 10 12 13 14 15 16 17 17 18
2 2 3 4 4 5 6 6 7 7 7
12
6 8 10 12 13 14 16 16 17 18 19
Figure 26 Finding the critical values for the runs test for randomness.
Appendix Table L we find the row with n1 5 12 and the column with n2 5 8, giving us
the critical values Gcrit, lower 5 6 and Gcrit, upper 5 16 (see Figure 26). We will reject H0 if
Gdata # 6 or if Gdata $ 16.
Step 3 Find the value of the test statistic. We have the small-sample case, so the
test statistic Gdata is simply the number of runs, G:
Gdata 5 G 5 10
Step 4 State the conclusion and the interpretation. Because Gdata 5 10 is not # 6
NOW YOU CAN DO and is not $ 16, we do not reject H0. There is insufficient evidence that the sequence is
Exercises 920. not random.
The runs test may also be used for numerical data, as long as the numerical data
are classified into two categories, as shown in the following example.
Example 25 Runs test for randomness of numerical data classified into categories
The weather station at the University of Missouri at Columbia publishes daily infor-
mation on the amount of rain that falls at Sanborn Field at the university. The follow-
ing 62 observations represent the daily rainfall information for the months of July and
August 2008. For example, on July 1 the weather station reported 0.00 inch of rain,
and on July 2 the weather station reported 0.37 inch of rain. We categorize each days
rainfall as follows: N 5 no rain falling, and R 5 some rain falling. Test whether the
sequence is random by conducting the runs test for randomness, using level of sig-
nificance a 5 0.10.
RRNNNNRRNNRNNNNNNNNNRNRRNRRNRR
N
NNNNNNNNNNNRNRNNNNNRRRNNNNNRNNN
Solution
The data are ordered, because they are arranged from July 1 to August 31, 2008. Also,
each data value represents one of two distinct outcomes: some rain or no rain. We may
thus proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : The sequence of data is random.
Ha : The sequence of data is not random.
Step 2 Find the critical values, and state the rejection rule. We have n1 5 18 rainy
days and n2 5 44 days with no rain. Because n2 . 20, the large-sample case applies.
From Table 19, the critical value is 1.645, and we will reject H0 if Zdata # 21.645 or if
Zdata $ 1.645.
Step 3 Find the value of the test statistic. We have n 5 n1 1 n2 5 18 1 44 5 62,
and there are G 5 23 runs. Then
2n1 n2 2s18ds44d
mG 5 115 1 1 < 26.5484
n1 1 n2 18 1 44
sG 5 s2n1n2ds2n1n2 2 n1 2 n2d
sn1 1 n2d2 sn1 1 n2 2 1d
5 [2s18ds44d][2s18ds44d 2 18 2 44]
s18 1 44d2 s18 1 44 2 1d
< 3.2065
23 2 26.5484
zdata 5 < 21.1066
3.2065
Step 4 State the conclusion and the interpretation. Because 21.1066 is not less
than 21.645 and is not more than 1.645, we do not reject H0. There is insufficient
evidence that the sequence is not random.
The runs test for randomness may also be used to test the independence assump-
tion for linear regression data, as shown in the following example. The important thing
to remember is that the runs test should be applied to the residuals, which are ordered
by the size of the fits (y ).
x y x y
0.0 1.00000 3.3 20.98748
1.0
0.3 0.95534 3.6 20.89676
0.6 0.82534 3.9 20.72593 0.5
0.9 0.62161 4.2 20.49026
1.2 0.36236 4.5 20.21080 0
y
Solution
The scatterplot of the residuals versus the fits is shown in Figure 28.
1.0
0.5
Residuals
0
0.5
1.0
By examining Figure 28, we can classify the residuals from left to right as positive
or negative, giving us:
PPPPPPNNNNNNNNNNPPPPPP
The residuals are ordered by the size of the fits, and we have classified each r esidual
into one of two distinct outcomes. Thus, we may proceed with the hypothesis test.
Step 1 State the hypotheses.
H0 : The sequence of residuals is random.
Ha : The sequence of residuals is not random.
Step 2 Find the critical values, and state the rejection rule. We have n1 5 12
positives and n2 5 10 negatives, so the small-sample case applies (n1 # 20 and n2 # 20).
From Appendix Table L we find our critical values Gcrit, lower 5 7 and Gcrit, upper 5 17. We
will reject H0 if Gdata # 7 or if Gdata $ 17.
Step 3 Find the value of the test statistic. We have the small-sample case, so the
test statistic Gdata is simply the number of runs, G:
Gdata 5 G 5 3
By the way, have you guessed the
Step 4 State the conclusion and the interpretation. Because Gdata 5 3 is less than 7,
equation of the pattern shown in
Figures 27 and 28? The we reject H0. Evidence exists that the sequence of residuals is not random. The residuals
relationship between x and y is are nonrandom, so the independence assumption for the linear regression model is
y 5 cos(x). violated, and we should not proceed with a linear regression analysis.
MINITAB
Minitab can perform the runs test for randomness for numerical Step 3 For the variable, type C1. Select Above and Below, and
data only. enter the value that is used to classify the data into two distinct
Step 1 Enter the numerical data in column C1. categories. For example, in Example 26, we would enter 0 here,
Step 2 Click Stat > Nonparametrics > Runs Test. because values above 0 are positive and values below 0 are
negative. Click OK.
SPSS
SPSS can perform the runs test for randomness for numerical data Step 3 Move the first column to Test Variable List. For Cut Point
only. select Custom, and enter the value that is used to classify the data
Step 1 Enter the numerical data in the first column. into two distinct categories. Click OK.
Step 2 Click Analyze > Nonparametric Tests > Legacy
Dialogs > Runs.
For Exercises 1720, conduct the runs test for randomness NNAAANAAAAANAAANNAN
using the following steps: NNNNNNNNNNNNAANAANAA
a. State the hypotheses. A A N A N N N A N
b. Find the critical values. 25. Douglas Fir Trees: Annual Growth versus Age. The
c. Calculate the test statistic. following scatterplot depicts the residuals versus the fits from a
d. State the conclusion and the interpretation. regression of the annual growth of Douglas fir trees versus the
17. Use the sequence in Exercise 5, the critical values in age of the tree.16 Proceeding from left to right, classify each
Exercise 9, the test statistic in Exercise 13, and level of residual as either above zero (A) or below zero (B). Then
significance a 5 0.05. perform the runs test to determine whether the independence
18. Use the sequence in Exercise 6, the critical values in assumption is violated, using level of significance a 5 0.05.
Exercise 10, the test statistic in Exercise 14, and level of 1.0
significance a 5 0.05.
19. Use the sequence in Exercise 7, the critical value in
Exercise 11, the test statistic in Exercise 15, and level of
significance a 5 0.01. 0.5
Residuals
Exercise 12, the test statistic in Exercise 16, and level of
significance a 5 0.10. 0
5
AAAAA
24. Super Bowl Winners. The following sequence 10
represents the conference of the Super Bowl winners from
1967 to 2014, where A represents the American Football 15
Conference and N represents the National Football
Conference.15 Test whether the sequence is random, using 20
level of significance a 5 0.10. 70 72 74 76 78 80 82
Fits
R1 2 mR SECTION 14.6
Zdata 5 Rank correlation test (p. 14-44)
sR
r (p. 14-47). The test statistic for the rank correlation
data
where test is
mR 5
n1sn1 1 n2 1 1d
rdata 5 1 2
o6 d2
2 nsn2 2 1d
sR 5 n1n2sn1 1 n2 1 1d
12
where d 5 the difference in ranks between the two samples.
SECTION 14.7
Gdata (p. 14-57)
and where n1 and n2 represent the sample sizes for Run (p. 14-55)
samples 1 and 2, respectively, and R1 5 the sum of the Runs test for randomness (p. 14-55)
ranks for the first sample. Sequence (p. 14-55)
R21 R22 R2k
1n 2 2 3sN 1 1d
12 2n1n2 s2n1n2ds2n1n2 2 n1 2 n2d
x2data 5 1 1 1
NsN 1 1d n2 nk mG 5 1 1 and sG 5
1
n1 1 n2 sn1 1 n2d2 sn1 1 n2 2 1d
16. Hot and Cold in Texas. Is the weather in Texas on the SECTION 14.5
hot side or the cold side? The following table shows the For Exercises 20 and 21, test whether the population
annual number of heating degree-days and cooling medians differ, using level of significance a 5 0.05. The
degree-days for a random sample of cities in Texas.17 Test, data represent independent random samples.
using the Wilcoxon signed rank test, whether the population
20.
median of the differences (heating degree-days minus Sample 1 11141713181210
cooling degree-days) is less than zero, using level of Sample 2 171515151818
significance a 5 0.05.
Sample 3 1119181211121115
hotcoldtx Sample 4 212220212319172324
Chapter 14 Quiz
True or False 11. Carbon Emissions. The following table shows the
1. True or false: The hypotheses for the Wilcoxon signed carbon dioxide emissions (in millions of metric tons)
rank test for the population median of the differences are the fromthe consumption of fossil fuels in 2000 and 2005 for
same as those for the corresponding sign test. arandom sample of 10 nations. Test whether the emissions
2. True or false: The sample size used in the Wilcoxon signed have been increasing. That is, test, using a sign test, whether
rank test always equals the number of data values in the sample. the population median of the difference (2005 2 2000) in
3. True or false: In the Wilcoxon rank sum test, the two carbon dioxide emissions is greater than zero, using level of
samples are temporarily combined, and the ranks of the significance a 5 0.05. carbon3
combined data values are calculated. Then the ranks are
summed separately for each sample.
Carbon emissions Carbon emissions
Fill in the Blank in 2000 (millions of in 2005 (millions
4. A convenient graphic for assessing the symmetry of a Nation metric tons) of metric tons)
data distribution is a ___________.
Brazil 342.1 360.6
5. The cutoff sample size between using the small-sample
case and the large-sample case for the Wilcoxon signed rank Canada 558.4 631.3
test is ___________. China 2912.6 5322.7
6. The Kruskal-Wallis test is the nonparametric alternative France 399.0 415.3
to ___________ of ___________, which we learned in an
India 994.1 1165.7
earlier chapter.
Ireland 40.4 44.1
Short Answer
South Africa 383.4 423.8
7. In the Wilcoxon signed rank test for matched-pair data,
which data values need to be omitted? Thailand 160.6 234.2
8. Is the Wilcoxon rank sum test used for dependent or Vietnam 47.4 80.4
independent samples? What about the Wilcoxon signed rank United States 5823.5 5957.0
test?
9. State the conditions for performing the Kruskal-Wallis test.
12. Military Veterans. The following table contains
Calculations and Interpretations the number of U.S. military veterans (in thousands) for a
10. Children Without Health Insurance. The following random sample of 13 states. militaryvets
table contains the number of children (in thousands) who
arenot covered by health insurance for a random sample of a. Verify that the data are symmetric.
24 states. Use the sign test to test whether the population b. Use the Wilcoxon signed rank test to test whether the
median number of children per state without health population median number of veterans per state
insurance is greater than 75,000, using level of significance differs from 100,000, using level of significance
a 5 0.05. a 5 0.05.
childhealth
13. Trade Balance. Table 20 contains the trade balance (in Table 20 U.S. trade balances
millions of dollars) that the United States has with a random
Trade Trade
sample of 12 European countries and a random sample
European balance Asian balance
of 11 Asian countries. Positive numbers indicate that our
country ($ millions) country ($ millions)
exports to that country exceed in value our imports from
that country. Negative numbers indicate that exports are Austria 7,497 Bangladesh 2,976
less than imports. Test whether the population median trade Belgium 10,009 China 256,207
balance with European countries differs from the population Czech Republic 1,168 Japan 82,760
median trade balance with Asian countries, using level of Germany 44,513 South Korea 12,918
significance a 5 0.05. Greece 918 Israel 7,775
Ireland 21,436 Malaysia 20,948
United Kingdom 6,629 Nepal 61
Netherlands 14,560 Thailand 14,300
Norway 4,256 Taiwan 11,968
France 14,140 Saudi Arabia 25,230
Luxembourg 475 Cambodia 2,325
Finland 2,133