Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Topic: two-sample nonparametric test on quantiles
Replies: 8   Last Post: Feb 3, 2013 12:50 AM

 Messages: [ Previous | Next ]
 Ray Koopman Posts: 3,383 Registered: 12/7/04
Re: two-sample nonparametric test on quantiles
Posted: Jan 30, 2013 5:44 PM

On Jan 30, 4:32 am, "Mickey M." <cz3...@gmail.com> wrote:
> I have made a small numerical experiment and I have found that the assumption F=G is essential for the exact shape of the distribution of Mann-Whitney U statistics.
>
> f1 = function(n1, n2) {
> x = sort(rnorm(n1))
> y = sort(rnorm(n2))
> sum(outer(x,y,function(a,b) a<b))
>
> }
>
> f2 = function(n1, n2) {
> x = sort(rnorm(n2,sd=1000))
> y = sort(rnorm(n2))
> sum(outer(x,y,function(a,b) a<b))
>
> }
>
> A = replicate(10000,f1(10,10))
> B = replicate(10000,f2(10,10))
>
> plot(density(A)) #density of U1 for two Normal distributions, mu=0,sd=1
> lines(density(B)) #density of U1 for two Normal distr, first with sd=1, second with sd=1000

It's not necessary that the SD ratio be that extreme for U to notice
the difference between two distributions that have the same mean and
shape. Here are the results of a similar simulation with 10^6
replications, n1 = n2 = 5, and SD ratio = 2 in B.

frequency distributions

U expected A B

0 3968.25 4024 5853
1 3968.25 3992 4962
2 7936.51 7905 8742
3 11904.8 11911 11557
4 19841.3 19738 18520
5 27777.8 27732 34499
6 35714.3 35795 35026
7 43650.8 43691 43152
8 55555.6 55663 51639
9 63492.1 63164 60664
10 71428.6 71118 78856
11 75396.8 74959 72039
12 79365.1 79353 74598
13 79365.1 79469 74722
14 75396.8 75884 72088
15 71428.6 71431 78757
16 63492.1 63665 59829
17 55555.6 55886 51753
18 43650.8 43404 43084
19 35714.3 35825 35602
20 27777.8 27685 34536
21 19841.3 19807 18641
22 11904.8 12080 11617
23 7936.51 7922 8799
24 3968.25 3896 4882
25 3968.25 4001 5583

A: chi-square(25) = 19.70, p = .762

B: chi-square(25) = 8912.52, p = .315 * 10^-1901

Date Subject Author
1/28/13 Richard Ulrich
1/30/13 Ray Koopman
1/31/13 Richard Ulrich
2/3/13 Ray Koopman
2/3/13 Ray Koopman