Chapter GoalsAfter completing this chapter, you should be able to: Recognize when and how to use the Wilcoxon signed rank test for a population median Recognize the situations for wh
Trang 2Chapter Goals
After completing this chapter, you should be able to:
Recognize when and how to use the Wilcoxon signed rank test for a population median
Recognize the situations for which the Wilcoxon signed rank test applies and be able to use it for decision-making
Know when and how to perform a Mann-Whitney U-test
Perform nonparametric analysis of variance using the Kruskal-Wallis one-way ANOVA
Trang 3Nonparametric Statistics
Nonparametric Statistics
Fewer restrictive assumptions about data levels and underlying probability distributions
Population distributions may be skewed
The level of data measurement may only
be ordinal or nominal
Trang 4Wilcoxon Signed Rank Test
Used to test a hypothesis about one
population median
the median is the midpoint of the distribution: 50%
below, 50% above
A hypothesized median is rejected if sample results vary too much from expectations
no highly restrictive assumptions about the shape of the population distribution are needed
Trang 5The W Test Statistic
Performing the Wilcoxon Signed Rank Test
Calculate the test statistic W using these steps:
Step 1: collect sample data
Step 2: compute d i = difference between each value and the hypothesized median
Step 3: convert d i values to absolute differences
Trang 6The W Test Statistic
Performing the Wilcoxon Signed Rank Test
Step 4: determine the ranks for each d i value
eliminate zero d i values
Lowest d i value = 1
For ties, assign each the average rank of the
tied observations
(continued)
Trang 7The W Test Statistic
Performing the Wilcoxon Signed Rank Test
Step 5: Create R+ and R- columns
for data values greater than the hypothesized
median, put the rank in an R+ column
for data values less than the hypothesized
median, put the rank in an R- column
(continued)
Trang 8The W Test Statistic
Performing the Wilcoxon Signed Rank Test
Step 6: the test statistic W is the sum of the ranks in the R+ column
Test the hypothesis by comparing the calculated W to the critical value from the table in appendix P
Note that n = the number of non-zero d i values
(continued)
Trang 9 The median class size is claimed to be 40
Sample data for 8 classes is randomly obtained
Compare each value to the hypothesized median to find
difference
Class size = x i
Difference
d i = x i – 40 | d i | 23
45 34 78 34 66 61 95
-17 5 -6 38 -6 26 21 55
17 5 6 38 6 26 21 55
Trang 10 Rank the absolute differences:
| d i | Rank
5 6 6 17 21 26 38 55
1 2.5 2.5 4 5 6 7 8
tied
(continued)
Trang 11 Put ranks in R+ and R- columns and find sums:
Class size = x i
-17 5 -6 38 -6 26 21 55
17 5 6 38 6 26 21 55
4 1 2.5 7 2.5 6 5 8
1 7
6 5 8
4 2.5 2.5
Trang 12Completing the Test
H 0 : Median = 40
H A : Median ≠ 40
Test at the α = 05 level:
This is a two-tailed test and n = 8, so find W L and W U in
appendix P: W L = 3 and W U = 33
The calculated test statistic is W = Σ R+ = 27
Trang 13Completing the Test
H 0 : Median = 40
H A : Median ≠ 40
W L = 3 and W U = 33
W L < W < W U so do not reject H 0
(there is not sufficient evidence to conclude that the
median class size is different than 40)
Trang 14If the Sample Size is Large
The W test statistic approaches a normal distribution as n increases
For n > 20, W can be approximated by
24
1) 1)(2n
n(n
4
1)
n(n W
z
+ +
+
−
=
where W = sum of the R+ ranks
d = number of non-zero d values
Trang 15Nonparametric Tests for Two
Population Centers
Nonparametric Tests for Two Population Centers
Wilcoxon Matched-Pairs Signed Rank Test
Mann-Whitney
U-test
Large Samples
Small Samples
Large Samples Small
Samples
Trang 16Mann-Whitney U-Test
Used to compare two samples from two populations
Assumptions:
The two samples are independent and random
The value measured is a continuous variable
The measurement scale used is at least ordinal
If they differ, the distributions of the two populations will
differ only with respect to the central location
Trang 17 Consider two samples
combine into a singe list, but keep track of which sample each value came from
rank the values in the combined list from low
to high
For ties, assign each the average rank of the tied values
separate back into two samples, each value keeping its assigned ranking
sum the rankings for each sample
Mann-Whitney U-Test
(continued)
Trang 18 If the sum of rankings from one sample differs enough from the sum of rankings from the other sample, we conclude there is a difference in the population medians
Mann-Whitney U-Test
(continued)
Trang 192 1 1
2
1
R
) n
(
n n
n U
∑
−
+ +
2 1 2
2
1
R
) n
(
n n
n U
where:
n 1 and n 2 are the two sample sizes
∑ R 1 and ∑ R 2 = sum of ranks for samples 1 and 2
Trang 21 Suppose the results are:
Class size (Math, M) Class size (English, E)
23 45 34 78 34 66 62 95 81
30 47 18 34 44 61 54 28 40
(continued)
Mann-Whitney U-Test
Trang 23 Split back into the original samples:
Class size (Math, M) Rank
Class size (English, E) Rank
23 45 34 78 34 66 62 95 81
2 10 6 16 6 15 14 18 17
30 47 18 34 44 61 54 28 40
4 11 1 6 9 13 12 3 8
(continued)
Mann-Whitney U-Test
Trang 24H 0 : Median M ≤ Median E
H A : Median M > Median E
Claim: Median class size for
Math is larger than the
median class size for English
22
104 2
(9)(10) (9)(9)
R 2
1) (n
n n
n
2 1
1 = + + − ∑ = + − =
59
67 2
(9)(10) (9)(9)
R 2
1) (n
n n
n
2 1
Trang 25 The Mann-Whitney U tables in Appendices L and M give the lower tail of the U-distribution
For one-tailed tests like this one, check the alternative hypothesis to see if U 1 or U 2 should be used as the test statistic
Since the alternative hypothesis indicates that population 1 (Math) has a higher median, use U 1 as the test statistic
(continued)
Mann-Whitney U-Test
Trang 26 Use U 1 as the test statistic: U = 22
Compare U = 22 to the critical value Uα from the appropriate table
For sample sizes less than 9, use Appendix L
For samples sizes from 9 to 20, use Appendix M
If U < Uα, reject H 0
(continued)
Mann-Whitney U-Test
Trang 27Since U U α , do not reject H 0
Use U 1 as the test statistic: U = 19
Uα from Appendix M for α = 05, n 1 = 9 and n 2 = 9 is Uα = 7
Trang 28Mann-Whitney U-Test for
Large Samples
The table in Appendix M includes Uα values only for sample sizes between 9 and 20
The U statistic approaches a normal distribution as sample sizes increase
If samples are larger than 20, a normal approximation can be used
Trang 29Mann-Whitney U-Test for
12
) 1 n
n )(
n )(
n ( 1 2 1 + 2 +
= σ
Where n 1 and n 2 are sample sizes from populations 1 and 2
Trang 30Mann-Whitney U-Test for
n )(
n )(
n (
2
n
n
U z
2 1
2 1
2 1
+ +
−
=
Trang 31Large Sample Example
We wish to test
Suppose two samples are obtained:
n 1 = 40 , n 2 = 50
When rankings are completed, the sum of ranks for sample 1 is ΣR 1 = 1475
When rankings are completed, the sum of ranks for sample 2 is ΣR 2 = 2620
H 0 : Median 1 ≥ Median 2
H A : Median 1 < Median 2
Trang 32 U statistic is found to be U = 655
1345
1475 2
(40)(41) (40)(50)
R 2
1) (n
n n
n
2 1
1 = + + − ∑ = + − =
655
2620 2
(50)(51) (40)(50)
R 2
1) (n
n n
n
2 1
2 = + + − ∑ = + − =
Since the alternative hypothesis indicates that
population 2 has a higher median, use U 2 as the test
statistic
Compute the U statistics:
Large Sample Example
(continued)
Trang 33Since z = -2.80 < -1.645, we reject H 0
645 1
zα = −
Reject H 0
0 Median
Median
:
H
0 Median
Median
:
H
2 1
A
2 1
) 1 50 40
)(
50 )(
40 (
1000 655
12
) 1 n
n )(
n )(
n
(
2
n n U z
21
21
21
−
= +
+
−
= +
Trang 34Wilcoxon Matched-Pairs
Signed Rank Test
The Mann-Whitney U-Test is used when samples from two populations are independent
If samples are paired, they are not independent
Use Wilcoxon Matched-Pairs Signed Rank Test with paired samples
Trang 35The Wilcoxon T Test Statistic
Performing the Small-Sample Wilcoxon
Matched Pairs Test (for n < 25)
Calculate the test statistic T using these steps:
Step 1: collect sample data
Step 2: compute d i = difference between the sample 1 value and its paired sample 2 value
Step 3: rank the differences, and give each rank the same sign as the sign of the difference value
Trang 36The Wilcoxon T Test Statistic
Performing the Small-Sample Wilcoxon
Matched Pairs Test (for n < 25)
Step 4: The test statistic is the sum of the absolute values of the ranks for the group with the smaller expected sum
Look at the alternative hypothesis to determine
the group with the smaller expected sum
For two tailed tests, just choose the smaller sum
(continued)
Trang 37Small Sample Example
Paired samples, n = 9:
Value (before) Value (after)
38 45 34 58 30 46 42 55 41
30 47 18 34 34 31 24 38 40
b a
A
b a
0
Median Median
: H
Median Median
Trang 38Small Sample Example
Paired samples, n = 9:
Value (before) (after) Value
30 47 18 54 38 31 24 62 40
6 -2 16 4 -8 15 18 -7 1
4 -2 8 3 -6 7 9 -5 1
Trang 39 The calculated T value is T = 13
Complete the test by comparing the calculated T value to the critical T-value from Appendix N
For n = 9 and α = 025 for a one-tailed test,
Small Sample Example
(continued)
Trang 40Wilcoxon Matched Pairs Test
for Large Samples
The table in Appendix N includes Tα values only for sample sizes from 6 to 25
The T statistic approaches a normal distribution as sample size increases
If the number of paired values is larger than 25, a normal approximation can be used
Trang 41 The mean and standard deviation for Wilcoxon T :
(continued)
4
) 1 n
(
n +
= µ
24
) 1 n
2 )(
1 n
)(
n
= σ
where n is the number of paired values
Wilcoxon Matched Pairs Test
for Large Samples
Trang 42Mann-Whitney U-Test for
2 )(
1 n
( n
4
) 1 n
(
n
T z
+ +
+
−
=
Trang 43 Tests the equality of more than 2 population medians
Assumptions:
variables have a continuous distribution.
the data are at least ordinal.
samples are independent.
samples come from populations whose only possible difference is that at least one may have a different central location than the others.
Kruskal-Wallis One-Way
ANOVA
Trang 44Kruskal-Wallis Test Procedure
Obtain relative rankings for each value
In event of tie, each of the tied values gets the average rank
Sum the rankings for data from each of the k groups
Compute the H test statistic
Trang 45Kruskal-Wallis Test Procedure
The Kruskal-Wallis H test statistic:
(with k – 1 degrees of freedom)
) 1 N
(
3 n
R )
1 N
( N
R i = Sum of ranks in the i th sample
n i = Size of the i th sample
(continued)
Trang 46 Complete the test by comparing the calculated H value to a critical χ2 value from the chi-square distribution with k – 1 degrees of freedom
(The chi-square distribution is Appendix G)
Decision rule
Reject H 0 if test statistic H > χ 2 α
Otherwise do not reject H 0
(continued)
Kruskal-Wallis Test Procedure
Trang 47 Do different departments have different class sizes?
Kruskal-Wallis Example
Class size (Math, M) (English, E) Class size (History, H) Class size
23 45 54 78 66
55 60 72 45 70
30 40 18 34 44
Trang 48 Do different departments have different class sizes?
Kruskal-Wallis Example
Class size
(Math, M) Ranking
Class size (English, E) Ranking
Class size (History, H) Ranking
23 41 54 78 66
2 6 9 15 12
55 60 72 45 70
10 11 14 8 13
30 40 18 34 44
3 5 1 4 7
Trang 49 The H statistic is
(continued)
Kruskal-Wallis Example
72 6 )
1 15
(
3 5
20 5
56 5
44 )
1 15
( 15
12
) 1 N
(
3 n
R )
1 N
( N
12 H
2 2
= +
=
+
− +
=
equal are
Medians population
all ot N : H
Median Median
Median :
H
A
H E
M
Trang 502 05
χ
Compare H = 6.72 to the critical value from the chi-square distribution for 5 – 1 = 4 degrees of freedom and α = 05:
4877
9
2 05
χ
There is not sufficient evidence to reject that the population medians are all equal
Trang 51Kruskal-Wallis Correction
If tied rankings occur, give each observation the mean rank for which it is tied
The H statistic is influenced by ties, and should be corrected
Correction for tied rankings:
N N
) t t
(
1 3
g
1 i
i
3 i
g = Number of different groups of ties
N = Total number of observations
Trang 52H Statistic Corrected for
Tied Rankings
Corrected H statistic:
N N
) t t
( 1
) 1 N
(
3 n
R )
1 N
( N
12 H
3
g
1 i
i
3 i
k
1
i i
2 i
Trang 53Chapter Summary
Developed and applied the Wilcoxon signed rank test for a population median
W- Small Samples
Large sample z approximation
Developed and applied the Mann-Whitney U-test for two population medians
Small Samples
Large Sample z approximation
Used the Wilcoxon Matched-Pairs T-test for paired
samples
Small Samples
Large sample z approximation
Applied the Kruskal-Wallis H-test for multiple
population medians