Re: [Rd] Inconsistencies in wilcox.test

2019-12-09 Thread Pavel S. Ruzankin
I'd like to ask the developers to include some exact computation for ties into wilcox.test(). Just try wilcox.test(c(1,1,5),c(10,11)) wilcox.test(c(1,2,5),c(10,11)) The p-values differ significantly. But if I try library(exactRankTests) wilcox.exact(c(1,1,5),c(10,11)) wilcox.exact(c(1,2,5)

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
The binary tree algorithm does not need additional scrambling. I have written the R code for the algorithm in the last answer at: https://stackoverflow.com/questions/311703/algorithm-for-sampling-without-replacement/46807110#46807110 However, the algorithm will probably be outperformed by hash t

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
Thank you for your answer. Certainly, hash table must be faster than binary tree. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
See also: P. Gupta, G. P. Bhattacharjee. (1984) An efficient algorithm for random sampling without replacement. International Journal of Computer Mathematics 16:4, pages 201-209. http://dx.doi.org/10.1080/00207168408803438 Teuhola, J. and Nevalainen, O. 1982. Two efficient algorithms for random

Re: [Rd] uniform sampling without replacement algorithm

2017-10-18 Thread Pavel S. Ruzankin
If somebody is interested I can write the code. But somebody else has to add the code for handling int / long int / double cases, since I do not have enough experience in that. __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

[Rd] uniform sampling without replacement algorithm

2017-10-17 Thread Pavel S. Ruzankin
Let us consider the current uniform sampling without replacement algorithm. It resides in function do_sample in https://svn.r-project.org/R/trunk/src/main/random.c Its complexity is obviously O(n), where the sample is selected from 1...n, since the algorithm has to create a vector of length n. S