94 6.3. Nonparametric Methods (I) One sample problem: Wilcoxon sign rank test: (not necessarily normal x1 ,, x n are the data from some population population). Suppose m is the population median. We want to test if H 0 : m m0 , where m0 is some number. We now introduce the Wilcoxon sign rank test. Let zi zi m0 and ri is the rank of z i . Let s all the ranks corresponding to xi m0 >0 while s r r i ( xi m0 ) 0 i ( xi m0 )0 be the sum of is the sum of all the ranks corresponding to xi m0 <0. Example 1: H 0 : m m0 8 xi 7.1 13.5 5.2 4.2 6.4 10.4 5.7 5.4 6.3 7.5 zi 0.9 5.5 2.8 3.8 1.6 2.4 2.3 2.6 1.7 0.5 ri 2 10 8 9 3 6 5 7 4 1 Sign of xi 8 _ + _ _ _ + _ _ _ _ Then, s 10 6 16, s 2 8 9 3 5 7 4 1 39 . The following are the Wilcoxon sign rank tests under three alternatives: (i) H 0 : m m0 vs H a : m m0 s wn, , then reject H 0 , where wn , can be found by table. (ii) H 0 : m m0 vs H a : m m0 s wn, , then reject H 0 , where wn , can be found by table. (iii) H 0 : m m0 vs H a : m m0 s min( s , s ) wn, , then reject H 0 , where wn , can be found by table. Note: s s n(n 1) . 2 94 95 Example 1 (continue): Test H 0 : m m0 8 vs H 1 : m 8 , 0.05. [sol]: s 16, w10,0.05 11 s 16 11 not reject H 0 . As the sample size is large, p-value can be obtained vis a normal approximation. As n n(n 1) n(n 1)( 2n 1) is large, T N ( , ) 4 24 n(n 1) 4 N (0,1). Thus, as n(n 1)( 2n 1) 24 T H 0 : M M 0 vs H 1 : M M 0 and T c, then p-value= P( Z n(n 1) n(n 1) c 4 4 ) ( ) . The p-values under the n(n 1)( 2n 1) n(n 1)( 2n 1) 24 24 c other alternatives can be obtained similarly. (II) Two samples problem: Wilcoxon rank sum test: x1 ,, x n and y1 ,, y m are the data from two populations. Let m1 and m2 be the population medians the two populations, respectively. We want to test H 0 : m1 = m2 . Wilcoxon rank sum test: 1. Combine x1 ,, x n , y1 ,, y m and find all the ranks of these data. 2. Find the sum of the ranks w corresponding to x1 ,, x n . The following are the Wilcoxon rank sum tests under three alternatives: (i) H 0 : m1 m2 vs H a : m1 m2 reject H 0 as w wu , where wu can be found by table. (ii) H 0 : m1 m2 vs H a : m1 m2 reject H 0 as w wL , where wL can be found by table. (iii) H 0 : m1 m2 vs H a : m1 m2 reject H 0 as w wu or w wL . Example 2: Area A 60 100 150 290 Area B 110 130 140 170 200 310 The above data are the incomes in two areas. Test H 0 : m1 m2 vs H a : m1 m2 with 0.05. [sol]: 95 96 1. Income 60 100 150 290 110 130 140 Rank 1 2 6 9 3 4 5 2. n1 4, n2 6, w 1 2 6 9 18, wL 12, wu 32. Since 12 w 18 32 not reject H 0 . 170 200 310 7 8 10 Conclusion: there is no difference in income between the two areas. 96