Rank-Sum Test STAT 401 - Statistical Methods for Research Workers - - PowerPoint PPT Presentation

rank sum test
SMART_READER_LITE
LIVE PREVIEW

Rank-Sum Test STAT 401 - Statistical Methods for Research Workers - - PowerPoint PPT Presentation

Rank-Sum Test STAT 401 - Statistical Methods for Research Workers Jarad Niemi Iowa State University 6 September 2013 Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 1 / 9 Rank sum test Do these data look normal? Raw histogram of


slide-1
SLIDE 1

Rank-Sum Test

STAT 401 - Statistical Methods for Research Workers Jarad Niemi

Iowa State University

6 September 2013

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 1 / 9

slide-2
SLIDE 2

Rank sum test

Do these data look normal?

Raw histogram of mpg for US and Japanese cars.

10 20 30 10 20 30 40 50

mpg count

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 2 / 9

slide-3
SLIDE 3

Rank sum test

Do these data look normal?

Compared to best fitting normal curves.

0.000 0.025 0.050 0.075 0.100 0.125 10 20 30 40 50

mpg density

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 3 / 9

slide-4
SLIDE 4

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test:

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-5
SLIDE 5

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-6
SLIDE 6

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-7
SLIDE 7

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-8
SLIDE 8

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-9
SLIDE 9

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-10
SLIDE 10

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Calculate SD(U) = sR

  • n1n2

(n1+n2)

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-11
SLIDE 11

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Calculate SD(U) = sR

  • n1n2

(n1+n2)

n2: sample size of the larger group

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-12
SLIDE 12

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Calculate SD(U) = sR

  • n1n2

(n1+n2)

n2: sample size of the larger group sR: standard deviation of the ranks

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-13
SLIDE 13

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Calculate SD(U) = sR

  • n1n2

(n1+n2)

n2: sample size of the larger group sR: standard deviation of the ranks

Calculate Z = (U + c − E[U])/SD(U) where c, the continuity correction, is either 0.5 or -0.5.

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-14
SLIDE 14

Rank sum test Rank-sum test

Rank-sum test

Also referred to as the Wilcoxon rank-sum test and the Mann-Whitney U test: Transform the data to ranks Calculate U, the sum of ranks of the group with a smaller sample size Calculate E[U] = n1R

n1: sample size of the smaller group R: average rank

Calculate SD(U) = sR

  • n1n2

(n1+n2)

n2: sample size of the larger group sR: standard deviation of the ranks

Calculate Z = (U + c − E[U])/SD(U) where c, the continuity correction, is either 0.5 or -0.5. Determine the pvalue using a standard normal distribution.

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 4 / 9

slide-15
SLIDE 15

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-16
SLIDE 16

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9 U = 22.5

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-17
SLIDE 17

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9 U = 22.5 E[U] = 15

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-18
SLIDE 18

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9 U = 22.5 E[U] = 15 SD[U] = 3.86

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-19
SLIDE 19

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9 U = 22.5 E[U] = 15 SD[U] = 3.86 z = 1.81 (appropriate continuity correction is -0.5)

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-20
SLIDE 20

Rank sum test Rank-sum test

Example on a small dataset

mpg country rank 1 13 US 1 2 15 US 2 3 17 US 3 4 22 US 4 5 26 Japan 5.5 6 26 US 5.5 7 28 US 7 8 32 Japan 8 9 33 Japan 9 U = 22.5 E[U] = 15 SD[U] = 3.86 z = 1.81 (appropriate continuity correction is -0.5) p = 0.07

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 5 / 9

slide-21
SLIDE 21

Rank sum test Full data

Transform data to ranks

  • 10

20 30 40 50 100 150 200 250 300 MPG Rank

  • Japan

US

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 6 / 9

slide-22
SLIDE 22

Rank sum test Full data

SAS code for Wilcoxon rank sum test

DATA mpg; INFILE ’mpg.csv’ DELIMITER=’,’ FIRSTOBS=2; INPUT mpg country $; PROC NPAR1WAY DATA=mpg WILCOXON; CLASS country; VAR mpg; RUN;

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 7 / 9

slide-23
SLIDE 23

Rank sum test Full data The NPAR1WAY Procedure Wilcoxon Scores (Rank Sums) for Variable mpg Classified by Variable country Sum of Expected Std Dev Mean country N Scores Under H0 Under H0 Score

  • US

249 33646.50 40960.50 733.579091 135.126506 Japan 79 20309.50 12995.50 733.579091 257.082278 Average scores were used for ties. Wilcoxon Two-Sample Test Statistic 20309.5000 Normal Approximation Z 9.9696 One-Sided Pr > Z <.0001 Two-Sided Pr > |Z| <.0001 t Approximation One-Sided Pr > Z <.0001 Two-Sided Pr > |Z| <.0001 Z includes a continuity correction of 0.5. Kruskal-Wallis Test Chi-Square 99.4068 DF 1 Pr > Chi-Square <.0001 Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 8 / 9

slide-24
SLIDE 24

Rank sum test Full data

Conclusion

Average miles per gallon of Japanese cars are significantly different than average miles per gallon of American cars (Wilcoxon rank sum test, p < 0.0001).

Jarad Niemi (Iowa State) Rank-Sum Test 6 September 2013 9 / 9