NONPARAMETRIC TESTS - Winona State University

advertisement

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

In situations where the normality of the population(s) is suspect or the sample sizes are so small that checking normality is not really feasible, it is sometimes preferable to use nonparametric tests to make inferences about “average” value.

Wilcoxon Rank Sum Test (Mann-Whitney U Test)

This test is an alternative to the two-sample t-test for comparing the “average” value of two populations where the samples from each population are taken independently.

The hypotheses tested can be stated as follows:

H : The distribution of population X and population Y are identical. o

If the populations are symmetric (but not necessarily normal) the null hypothesis

can be expressed in terms of the population medians as:

M

X

M

Y

H a

: The distribution of population X and population Y are different. (two-tailed)

M

X

M

Y or

H a

: The distribution of population X is shifted to the right of the distribution for

population Y, i.e. the population X values are generally larger than the population

Y values. (right-tailed)

M

X

M

Y or

H : The distribution of population X is shifted to the left of the distribution for a

population Y, i.e. the population X values are generally smaller than the population

X values. (left-tailed)

M

X

M

Y

The tests statistic is based on the sum of the ranks assigned to the observed data from each population when the combined sample is ranked from smallest to largest. We will always assume that the sample size (m) for population X is less than or equal to the sample size (n) from population Y.

Example 16.1 Radial Lengths of Green and Red Sea Stars.

Researchers want to compare the radial lengths of two color morphs of the same species of sea star. The red color morph is more liable to predation and, hence, those found might be generally smaller than the green color morph.

H o

: M

R

M

G

vs. H a

: M

R

M

G

237

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

The data below are radial lengths (mm) of two independently drawn random samples of these sea stars.

Red: 108 64 80 92 40

Green: 102 116 98 132 104 124

The sum of the ranked lengths for the red sea stars is: _____________.

The sum of the ranked lengths for the green sea stars is: ____________.

The sum of the ranks for the red sea stars is smaller than the rank sum for the green sea stars but this would be expected even if the null hypothesis were true. Why?

The test statistic, W

R

, is the sum of the ranks for population R (red sea star). Use

Wilcoxon Rank Sum Test tables to determine whether to reject the null or not. Intuitively we will reject the null hypothesis if the sum of the ranked radial lengths for the red sea stars is “small”. The table tells what “small” is for a given significance level ( 

).

For m = 5 and n = 6 we find the following in the Lower Tail table.

For m = 5 and n = 6 we find the following in the Upper Tail table.

.

05 level if: The table says we will reject the null at the

W

R

20 for H a

: M

R

M

G

W

R

> 40 for H a

: M

R

M

G

W

R

< 18 or W

R

42 for H a

: M

R

M

G

Thus we have evidence to conclude that red sea stars are generally smaller than green sea stars in terms of radial length (p < .05).

238

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

Data Table In JMP

Results

239

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

Normal Approximation to Wilcoxon Rank Sum Test

If one our sample sizes exceeds 12 we cannot use the table in the back of this handout to find our critical value. When this is the case we can use the normal approximation approach to find an approximate p-value.

The normal approximation test statistic is z

W

W

W where

W

 n

R

( n

R

 n

G

2

1 )

and

W

 n

R n

G

( n

R

12

 n

G

1 )

Here we have,

W = W

R

=18

W

5 ( 5

2

6

1 )

W

30

5

6 ( 5

6

1 )

12

5 .

48 z

18

30

5 .

48

 

2 .

19

240

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

Wilcoxon Signed Rank Test

This test is an alternative to the paired t-test which is used when we do not wish to assume that the population of paired differences is normally distributed. As with the

Mann-Whitney U test, the Wilcoxon Signed-Rank Test use ranks based on the paired differences rather than the actual values.

Example 16.2 - Effect of Togetherness on the Heart Rate of Rats

Rat Alone Rate Together Rate d i

= T i

– A i

Sign | d i

| i

| Signed Rank

1

2

3

4

5

6

7

8

9

10

463

462

462

456

450

426

418

415

409

402

523

494

461

535

476

454

448

408

470

437

60

32

-1

79

26

28

30

-7

61

35

We then calculate W

= the sum of the positive signed ranks = _______________

and W

= the sum of the negative signed ranks = _______________

Are hypotheses are stated in terms of the median of the paired differences . Listed below are the hypotheses along with the test statistic based on the signed rank sums used to test it.

H

H

H o o o

: M d

: M d

: M d

0 vs. H a

0

0

vs. H

vs. H a a

: M d

: M d

: M d

0 (two-tailed) Test statistic W

0 (right-tailed) Test statistic W

0 (left-tailed) Test statistic W

 min( W

W

W

, W

)

For this example, if had originally hypothesized that the heart rate of a rat will increase when it is placed in a social environment then we have the right-tailed alternative and our test statistic W = _______.

The Wilcoxon Signed-Rank Test table gives critical values we can compare our observed test statistic value W to for a given sample size, i.e. number of pairs, n .

Here because our observed test statistic value is less than the table value we reject the null hypothesis and conclude that the heart rate of a rat will generally increase when it is taken from a solitary confinement and placed in a social environment with other rats.

241

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

IN JMP

Select Distribution > Test Mean > Enter 0 for the hypothesized value and check the nonparametric test box. The p-value for the right-tailed test has been highlighted.

The test statistic reported by JMP =

( W

W

2

)

Why? I don’t know, but we only need

the p-value anyway (p = .0049).

Conclusion:

Normal Approximation to Wilcoxon Signed-Rank Test

If n>12 we can use a z-statistic and find the p-value from the standard normal table. z

W

W

W

 w where

W

 n ( n

1 )

4 and

W

 n ( n

1 )( 2 n

1 )

24

.

Here we have n = 10 so we don’t need to, but we can use the above approximation as follows:

W

 n ( n

1 )

4

W

10 ( 10

1 )

4 n ( n

1 )( 2 n

1 )

24

27.5

10 ( 11 )( 21 )

24

9 .

81

Thus our z-statistic is z

W

W

W

W =

Now we find the p-value using the standard normal table.

242

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

Nonparametric Approach: Kruskal-Wallis Test

If the normality assumption is suspect or the sample sizes from each of the k populations are too small to assess normality we can use the Kruskal-Wallis Test to compare the size of the values drawn from the different populations. There are two basic assumptions for the Kruskal-Wallis test:

1) The samples from the k populations are independently drawn.

2) The null hypothesis is that all k populations are identical in shape, with the

only potential difference being in the location of the typical values (medians).

Hypotheses:

H : All k populations have the same median or location. o

H : At least one of the populations has a median different from other others a

or

At least one population is shifted away from the others.

To perform to the test we rank all of the data from smallest to largest and compute the rank sum for each of the k samples. The test statistic looks at the difference between the average rank for each group



R n i i

 and average rank for all observations

N

2

1

. If there are differences in the populations we expect some groups will have an average rank much larger than the average rank for all observations and some to have smaller average ranks.

H

N (

12

N

1 ) i k 

1 n i



R i n i

N

2

1



2

~

2 k

1

(Chi-square distribution with df = k-1 )

The larger H is the stronger the evidence we have against the null hypothesis that the populations have the same location/median. Large values of H lead to small p-values!

Example 16.3 - Movement of Gastropods (Austrocochlea obtusa)

Preliminary observations on North Stradbroke Island indicated that the gastropod Austrocochlea obtuse preferred the zone just below the mean tide line. In an experiment to test this, A. obtusa were collected, marked, and placed either 7.5 m above this zone (Upper Shore), 7.5 m below this zone (Lower Shore), or back in the original area (Control). After two tidal cycles, the snails were recaptured. The distance each had moved (in cm) from where it had been placed was recorded. Is there a significant difference among the median distances moved by the three groups?

Enter these data into two columns, one denoting the group the other containing the recorded movement for each snail.

243

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

R

1

84 , R

2

79 , R

3

162 and H

7 .

25 (p-value = .0287).

We have evidence to suggest that the movement distances significantly differ between the groups.

Multiple Comparisons

To determine which groups significantly differ we can use the procedure outlined on pgs. 213-215 of the textbook. To determine if group i significantly differs from group j we compute z ij

R i n i

R j n j

and then compute p-value = P ( Z

 z ij

) .

N ( N

1 )

12

1 n i

1 n j

If the p-value is less then

 where m

# of pair-wise comparisons to be made which would typically be

2 m



 k

2 



if all pair-wise comparisons are of interest. For this example, we can make a total of m =



3

2



3

.

05 pair-wise comparisons so we compare our p-values to

2 ( 3 )

.

00833 .

Comparing Upper Shore vs. Control z

13

18 .

0

12 .

0

25 ( 26 )

12

1

7

1

9

= 1.618

P(Z > 1.62) = .0526 > .00833 so we fail to conclude these locations significantly differ in terms of gastropod movement. Similar comparisons show the only significant difference in movement is between lower and upper shore.

244

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

In JMP, there are multiple comparison procedures for comparing populations pairwise.

The Steel-Dwass method is the nonparametric equivalent to Tukey’s HSD from one-way

ANOVA.

Results of the Steel-Dwass method for the gastropod movement study.

245

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

Wilcoxon Rank Sum Test Tables

246

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

247

STAT 305: Chapter 16 – Nonparametric Tests

Fall 2013

248

Download