+ All Categories
Home > Documents > Non-Parametric Two-Sample Analysis: The Mann-Whitney …webspace.ship.edu/pgmarr/Geo441/Lectures/Lec...

Non-Parametric Two-Sample Analysis: The Mann-Whitney …webspace.ship.edu/pgmarr/Geo441/Lectures/Lec...

Date post: 12-Jun-2018
Category:
Upload: phunglien
View: 226 times
Download: 0 times
Share this document with a friend
38
Non-Parametric Two-Sample Analysis: The Mann-Whitney U Test
Transcript

Non-Parametric Two-Sample Analysis:The Mann-Whitney U Test

When samples do not meet the assumption of normalityparametric tests should not be used.

To overcome this problem, non-parametric tests can beused.

• These tests are distribution-free (do not assumenormality.

• They are fairly robust and nearly as powerful as parametric tests.

• They often use RANKS rather than observed values.

Earthquake Depth

Chilean earthquakes

Tests of Normality (May)

Kolmogorov-Smirnov(a) Shapiro-WilkStatistic df Sig. Statistic df Sig.

Mag .235 20 .005 .755 20 .000

Tests of Normality (June)

Kolmogorov-Smirnov(a) Shapiro-WilkStatistic df Sig. Statistic df Sig.

Mag .259 18 .002 .756 18 .000

Independent Samples Test

2.644 .113 2.142 36 .039 .6650 .3104 .0354 1.2946

2.108 30.985 .043 .6650 .3155 .0215 1.3085

Equal variancesassumedEqual variancesnot assumed

MagnitudeF Sig.

Levene's Test forEquality of Variances

t df Sig. (2-tailed)Mean

DifferenceStd. ErrorDifference Lower Upper

95% ConfidenceInterval of the

Difference

t-test for Equality of Means

Using a t test gives the result that the magnitude of the earthquakes between May and June were significantly different.

Ranks

18 22.36 402.5020 16.93 338.5038

Month56Total

MagnitudeN Mean Rank Sum of Ranks

Test Statisticsb

128.500338.500

-1.511.131

.133a

Mann-Whitney UWilcoxon WZAsymp. Sig. (2-tailed)Exact Sig. [2*(1-tailedSig.)]

Magnitude

Not corrected for ties.a.

Grouping Variable: Monthb.

Using a non-parametric test gives the result that the magnitude of the earthquakes between May and June was not significantly different.

When the distribution of the data sets deviate substantially from normal, it is better to use non-parametric (distribution free) tests.

• There are no assumptions made concerning the sample distributions.

• Tied ranks are assigned the average rank of the tied observations.

• The Mann-Whitney U test is approximately 95% as powerful as the t test.

• If the data are severely non-normal, the Mann-Whitney U test is substantially more powerful than the t test.

The Mann-Whitney U test (2-tailed)

Compare the critical U value to either U or U’, whichever is larger.

1 groupfor ranks theof sum theis where

'2

)1(

1

21

111

21

R

UnnU

RnnnnU

−=

−+

+=

The sample space The theoretical sum of all ranks for group 1

The actual sum of all ranks for group 1

This equation is essentially comparing the theoretical sum of the ranks from group 1 to the actual sum of the ranks for group 1 while taking into account the sample space. If the group samples get smaller the test gets more conservative.

UnnU

RnnnnU

−=

−+

+=

21

111

21

'2

)1(

Obs Value Rank (with Ties) Rank

21 1 122 2 223 3 (tied) 423 4 (tied) 423 5 (tied 426 6 627 7 (tied) 7.527 8 (tied) 7.5

(3 + 4 + 5) / 3 = 4(7 + 8) / 2 = 7.5

Observations are first sorted. Tied ranks are dealt with by assigning the average rank to the tied observations:

The U test uses the rank of the pooled observations. For a 2-tailed test, ranks can be from highest to lowest or lowest to highest.

Earthquake Location Magnitude RankOceanic

Earthquake Location Magnitude RankContinental

Oceanic 3.9 1 Continental 4.1 3.5Oceanic 4.0 2 Continental 4.3 7Oceanic 4.1 3.5 Continental 4.3 7Oceanic 4.3 7 Continental 4.3 7Oceanic 4.3 7 Continental 4.4 11Oceanic 4.4 11 Continental 4.4 11Oceanic 4.5 13.5 Continental 4.5 13.5Oceanic 4.8 16 Continental 4.6 15Oceanic 5.4 20 Continental 5 17Oceanic 6.3 21 Continental 5.1 18.5Oceanic 6.8 22.5 Continental 5.1 18.5Oceanic 6.8 22.5

Σ 147

Earthquake Magnitudes in Chile

Ho : There is no significant difference magnitude of oceanicversus continental earthquakes in Chile.

Ha : There is a significant difference magnitude of oceanic versus continental earthquakes in Chile.

α = 0.05

n1 = 12n2 = 11

df = n1, n2 = 12, 11

Note that we are performing a 2-tailed test, so we will use thelarger of the test statistics… either U or U’.

9911,12

69'63)11)(12('

6314778132

1472

)112(12)11)(12(

==

=−=

=−+=

−+

+=

criticalUdf

UUUU

U

IMPORTANT:This Mann-Whitney table is 1-tailed. Our α level is 0.05. For a 2-tailed test using a 1-tailed table, you MUST divide the α level between each of the 2 tails…

So the α level we look up on the table is 0.025, or ½ of 0.05.

U’ is larger, so it will be used.

69 < 99Since U is less than UCritical, Accept Ho.

There is no significant difference in the magnitudes of oceanic versus continental earthquakes in Chile (U69, p > 0.10).

SPSS Test Statisticsa

MagnitudeMann-Whitney U 63.000Wilcoxon W 129.000Z -.186Asymp. Sig. (2-tailed) .853Exact Sig. [2*(1-tailed Sig.)] .880b

a. Grouping Variable: Location

b. Not corrected for ties.

Note that SPSS calculates the exact probability

Mann-Whitney U test (1-tailed)

Performing a 1-tailed Mann-Whitney test is somewhat different than other methods. The appropriate test statistic is determined using the following method:

This technique simply forces one to declare in which tail the difference will be found in advance since U’ is to the right of the mean (greater than) and U is to the left of the mean (less than).

Using depth of epicenter data for the same Chilean earthquakes, a 1-tailed test is performed with the data ranked from low to high and continental earthquakes as group 1.

Ho : Continental earthquake depths are not significantly deeper than oceanic earthquakes in Chile.

Ha : Continental earthquake depths are significantly deeper than oceanic earthquakes in Chile.

Using depth of epicenter data for the same Chilean earthquakes, a 1-tailed test is performed with the data ranked from low to high and continental earthquakes as group 1.

Ho : Continental earthquake depths are not significantly deeper than oceanic earthquakes in Chile.

Ha : Continental earthquake depths are significantly deeper than oceanic earthquakes in Chile.

Therefore the test statistic will be:

Oceanic RankOceanic Continental RankContinental

75 13 69 1032 3 99 1750 9 135 2338 6 115 20.519 1 33 4.544 7 92 15.533 4.5 118 22

102 19 115 20.528 2 92 15.570 11.5 89 1449 8 101 1870 11.5

Σ 180.5

Earthquake Depths (km) in Chile

114.5 > 94Since U’ is greater than UCritical, reject Ho.

Continental earthquake depths are significantly deeper than oceanic earthquakes in Chile (U114.5, 0.005 > p > 0.001).

9411,12

5.1145.17)11)(12(

5.175.18066132

5.1802

)111(11)12)(11(

'

'

==

=

−=

=−+=

−+

+=

criticalUdf

UUUU

U

Therefore, this table is used for 2 purposes:1. Declaring which group is 1 and which is 2.2. Declaring which group is greater (or less then) which.

It is important to do this because we could easily restate the direction of Ho and Ha as:

Ho : Continental earthquake depths are not significantly deeper than oceanic earthquakes in Chile.

Ha : Oceanic earthquake depths are significantly shallowerthan continental earthquakes in Chile.

The table of which U value to choose helps keep things straight, regardless of how the null and alternate hypotheses are framed (either Group 1 > Group 2 or Group 2 < Group 1.

This is clearly demonstrated on the next slide. No matter how we frame the Ho and Ha, we will use the appropriate statistic.

5.1145.17132

5.175.18066132

5.1802

)111(11)12)(11(

'

'

'

=−=

=

−+=

−+

+=

UUUU

U

Continental = Group 1, Ranked Low to HighHo: Continental = OceanicHa: Continental < Oceanic

5.175.114132

5.1145.9578132

5.952

)112(12)11)(12(

'

'

'

=−=

=

−+=

−+

+=

UUUU

U

Oceanic = Group 1, Ranked Low to HighHo: Continental = OceanicHa: Continental > Oceanic

5.175.114132

5.1145.8366132

5.832

)111(11)12)(11(

'

'

'

=−=

=

−+=

−+

+=

UUUU

U

Continental = Group 1, Ranked High to LowHo: Continental = OceanicHa: Continental < Oceanic

5.1145.17132

5.175.19278132

5.1922

)112(12)11)(12(

'

'

'

=−=

=

−+=

−+

+=

UUUU

U

Oceanic = Group 1, Ranked High to LowHo: Continental = OceanicHa: Continental > Oceanic

SPSS uses a different technique that reports the smaller calculated value, regardless of how you arrange the groups.

Note that the sum of the ranks does change.

Paired Sample t Test

Paired Sample t Test

This t test is used ONLY when the data are repeat measurements (e.g. measurement at time1 and time2) or when samples are paired in some manner. The equation is:

where is the mean difference between paired observations, and is the standard deviation of the paired differences.

Let’s test the null hypothesis that unemployment rates in 2007 were lower than in 2008 for selected cities.

ns

dtd

=

dds

Determining which data column to subtract from which depends on your hypothesis:

Test only difference: does not matter.

Testing pair 1 > pair 2: subtract pair 1 from pair 2.

Testing pair 1 < pair 2: subtract pair 2 from pair 1.

So in this example subtract the 2008 (pair 2) from the 2007 (pair 1) unemployment rate.

2007(pair 1)

2008 (pair2) d

Los Angeles 5.0 8.8 -3.8San Francisco 4.6 7.0 -2.4Washington DC 3.0 4.7 -1.7Bethesda 2.6 4.0 -1.4Fort Lauderdale 4.1 7.1 -3.0Miami 3.9 7.0 -3.1Chicago 5.0 7.1 -2.1Boston 3.4 5.5 -2.1Detroit 9.1 11.7 -2.6Long Island 4.4 6.6 -2.2Newark 4.0 6.5 -2.5Camden 4.1 6.8 -2.7Philadelphia 4.2 6.3 -2.1Wilmington 3.5 6.1 -2.6Dallas-Fort Worth 4.2 5.8 -1.6Seattle 3.7 6.1 -2.4Tacoma 4.7 7.2 -2.5

n=17 d -2.400v=17-1=16 Sd 0.583

Unemployment Rate for Selected Cities

97.161414.0

4.2

17583.0

4.2−=

−=

−=t

tcritical(1)=1.746

t= -16.97 > 1.746, reject Ho.

Remember, the sign just tells us direction, not magnitude. Therefore:

Unemployment in 2007 was significantly lower than in 2008 for selected cities (t-16.97, p < 0.0005).

The paired t test does not have the assumption of normality of the groups or of equality of variances.

• This is because we are using the paired differences rather than the actual observations.

The only assumption is that the paired differences are normally distributed.

This test is considered to be fairly robust.

Non-Parametric Paired Sample TestWilcoxon T

The Wilcoxon paired-sample test is used when the paired differences are non-normal.

• The paired t test is fairly robust for slightly non-normal paired differences are not typically a problem

• If the differences are very non-normal, especially if there is activity in the tails, this test is more appropriate.

As with the Mann-Whitney U test, two values are calculated:

T+: the sum of the positive ranked differences.

T- : the sum of the negative ranked differences.

The same subtraction rules for the paired t test apply here.

1. First determined the paired differences.

2. Rank the differences from lowest to highest, ignoring the sign.

3. Apply the signs of the differences to the ranks (called the signed-ranks.).

For a 1-tailed test

• If Ha: Pair1 > Pair 2, reject Ho if T- < the critical value.

• If Ha: Pair1 < Pair 2, reject Ho if T+ < the critical value.

For a 2-tailed test

• Use the smaller value.

2012 2013 d Rankd

Signed Ranksd

January 3.22 3.18 -0.04 1.5 -1.5February 2.93 1.67 -1.26 6 -6March 2.11 2.20 0.09 3 3April 2.15 2.19 0.04 1.5 1.5May 6.15 3.47 -2.68 10 -10June 2.72 5.33 2.61 9 9July 5.11 1.13 -3.98 11 -11August 2.87 3.67 0.80 5 5September 5.83 1.55 -4.28 12 -12October 5.49 6.96 1.47 7 7November 0.83 2.58 1.75 8 8December 3.97 3.33 -0.64 4 -4

Total Precipitation for Shippensburg

Ho: Monthly precipitation in 2013 was not greater than in 2012.Ha: Monthly precipitation in 2013 was greater than in 2012.Since our Ha is 2012 (Pair 1) < 2013 (Pair 2) we use T+.

n = 12T+ = 3 + 1.5 + 9 + 5 + 7 + 8 = 33.5T- = 1.5 + 6 + 10 + 11 + 12 + 4 = 44.5Tcritical = 17

The signs are simply used to create 2 groups whose values are summed.

Assign the ranks the signs.

Calculated value is about here.

The Wilcoxon table is one of the few where larger statistics result in accepting the null hypothesis. Make sure you note this.

Since we are testing for a positive difference between 2012 and 2013 use the T+ statistic.

33 > 13 accept the null hypothesis.

Monthly precipitation in 2013 was not greater than in 2012 (Wilcoxon Matched-Pairs T33, p > 0.25).

Sample Before Treatment After Treatment

1 10 132 13 113 16 174 7 115 15 166 11 97 9 88 17 159 14 1710 15 1111 18 16

The treatment should lead to an increase in the measurement. Did the treatment work?

• If Ha: Pair1 > Pair 2, reject Ho if T- < the critical value. • If Ha: Pair1 < Pair 2, reject Ho if T+ < the critical value.


Recommended