[R] Mann-Whitney U
Marc Schwartz
marc_schwartz at comcast.net
Tue Aug 14 23:05:07 CEST 2007
On Tue, 2007-08-14 at 14:45 -0600, 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.
>
> 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.
>
> Help please!
>
> Nat
You will need to provide any error messages that you are getting. There
is a two sample example in ?wilcox.test that shows that the function can
handle two vectors with differing sizes.
Having the output of str(group1) and str(group2) may also prove useful.
You may also wish to pay attention to the "Note" in ?wilcox.test which,
if you are getting differing results between SPSS and R, may provide
some insight into why, presuming that you can gain the same information
about SPSS.
HTH,
Marc Schwartz
More information about the R-help
mailing list