tkpmep m@iii@g oii gm@ii@com
2023-Dec-11 14:44 UTC
[Rd] Base R wilcox.test gives incorrect answers, has been fixed in DescTools, solution can likely be ported to Base R
While using the Hodges Lehmann Mean in DescTools (DescTools::HodgesLehmann), I found that it generated incorrect answers (see <https://github.com/AndriSignorell/DescTools/issues/97> https://github.com/AndriSignorell/DescTools/issues/97). The error is driven by the existence of tied values forcing wilcox.test in Base R to switch to an approximate algorithm that returns incorrect results - see <https://aakinshin.net/posts/r-hodges-lehmann-problems/> https://aakinshin.net/posts/r-hodges-lehmann-problems/ for a detailed exposition of the issue. Andri Signorell and Cyril Moser have a new C++ implementation of DescTools::HodgesLehmann using a O(N log(N)) algorithm due to Monahan, but wilcox.test in Base R appears to be still broken. Will someone kindly bring this observation, as well as the existence of a solution, to the attention of the relevant person(s) in the Base R development team? The paper by Mohanan, as well as the original Fortran implementation of the algorithm are linked to from <https://github.com/AndriSignorell/DescTools/issues/97> https://github.com/AndriSignorell/DescTools/issues/97). Inefficient O(N^2) algorithms for the Hodges-Lehmann mean are known and are implemented in a variety of packages. For example, the authors of rt.test (https://cran.r-project.org/web/packages/rt.test) use the O(N^2) approach. I suspect that Andri and Cyril will be more than happy to assist with fixing wilcox.test in Base R with their implementation of Monahan's fast algorithm. Sincerely Thomas Philips [[alternative HTML version deleted]]
Ben Bolker
2023-Dec-11 16:03 UTC
[Rd] Base R wilcox.test gives incorrect answers, has been fixed in DescTools, solution can likely be ported to Base R
You could request a bugzilla account and post it to https://bugs.r-project.org/ yourself: from https://www.r-project.org/bugs.html, > In order to get a bugzilla account (i.e., become ?member?), please send an e-mail (from the address you want to use as your login) to bug-report-request at r-project.org briefly explaining why, and a volunteer will add you to R?s Bugzilla members. (On the other hand, I think that posting to this list was a good idea in any case, as it is more visible than the bugs list and may spark some useful discussion.) cheers Ben Bolker On 2023-12-11 9:44 a.m., tkpmep at gmail.com wrote:> While using the Hodges Lehmann Mean in DescTools (DescTools::HodgesLehmann), > I found that it generated incorrect answers (see > <https://github.com/AndriSignorell/DescTools/issues/97> > https://github.com/AndriSignorell/DescTools/issues/97). The error is driven > by the existence of tied values forcing wilcox.test in Base R to switch to > an approximate algorithm that returns incorrect results - see > <https://aakinshin.net/posts/r-hodges-lehmann-problems/> > https://aakinshin.net/posts/r-hodges-lehmann-problems/ for a detailed > exposition of the issue. > > > > Andri Signorell and Cyril Moser have a new C++ implementation of > DescTools::HodgesLehmann using a O(N log(N)) algorithm due to Monahan, but > wilcox.test in Base R appears to be still broken. Will someone kindly bring > this observation, as well as the existence of a solution, to the attention > of the relevant person(s) in the Base R development team? > > > > The paper by Mohanan, as well as the original Fortran implementation of the > algorithm are linked to from > <https://github.com/AndriSignorell/DescTools/issues/97> > https://github.com/AndriSignorell/DescTools/issues/97). Inefficient O(N^2) > algorithms for the Hodges-Lehmann mean are known and are implemented in a > variety of packages. For example, the authors of rt.test > (https://cran.r-project.org/web/packages/rt.test) use the O(N^2) approach. I > suspect that Andri and Cyril will be more than happy to assist with fixing > wilcox.test in Base R with their implementation of Monahan's fast algorithm. > > > > Sincerely > > > > Thomas Philips > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel