[R] Mann-Whitney U

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Aug 14 23:16:26 CEST 2007


On Tue, 14 Aug 2007, Natalie O'Toole wrote:

> Hi,
>
> Could someone please tell me how to perform a Mann-Whitney U test on a
> dataset with 2 groups where one group has more data values than another?
>
> I have split up my 2 groups into 2 columns in my .txt file i'm using with
> R. Here is the code i have so far...
>
> group1 <- c(LeafArea2)
> group2 <- c(LeafArea1)
> wilcox.test(group1, group2)
>
> This code works for datasets with the same number of data values in each
> column, but not when there is a different number of data values in one
> column than another column of data.

There is an example of that scenario on the help page for wilcox.test, so 
it does 'work'.  What exactly went wrong for you?

> Is the solution that i have to have a null value in the data column with
> the fewer data values?
>
> I'm testing for significant diferences between the 2 groups, and the
> result i'm getting in R with the uneven values is different from what i'm
> getting in SPSS.

We need a worked example.  As the help page says, definitions do differ. 
If you can provide a reproducible example in R and the output from SPSS we 
may be able to tell you how to relate that to what you see in R.

[...]

> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

As it says, we really need such code (and the output you get) to be able 
to help you.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list