From olafm at kimberly.tako.de  Thu Jul 23 00:45:32 2009
From: olafm at kimberly.tako.de (Olaf Mersmann)
Date: Thu, 23 Jul 2009 00:45:32 +0200
Subject: [Rd] Improvement of [dpq]wilcox functions
In-Reply-To: <4A560737.9080005@iugrina.com>
References: <4A560737.9080005@iugrina.com>
Message-ID: <1248302320-sup-9142@bloxx.local>

Hi Ivo,

Excerpts from Ivo Ugrina's message of Thu Jul 09 17:05:27 +0200 2009:
> I believe I have significantly improved [dpq]wilcox
> functions by implementing Harding's algorithm:
> Harding, E.F. (1984): An Efficient, Minimal-storage Procedure
> for Calculating the Mann-Whitney U, Generalized U and Similar
> Distributions, App. Statist., 33, 1-6

I've looked at your code and it is indeed quite a bit faster. Sadly in
some cases it produces inaccurate results. See for example:

R 2.9.1:
  > sum(dwilcox(1:(500*100), 500, 100))
  [1] 1

R 2.9.1 + your patch:
  > sum(dwilcox(1:(500*100), 500, 100))
  [1] 1.001377
  > sum(dwilcox(1:(500*200), 500, 200))
  [1] -132443.2
  > sum(dwilcox(1:(1000*200), 1000, 200))
  [1] 3.412391e+13

The last two examples run out of memory on my machine in an unpatched
R. I think if you can sort out the numerical issuses your patch would
be interesting since it is indeed quite a bit faster than the current
implementation.

Cheers,
Olaf Mersmann



[Rd] Improvement of [dpq]wilcox functions
Olaf Mersmann