[R] Adding noise

Ben Bolker bbolker at gmail.com
Tue Nov 30 22:31:15 CET 2010


Jim Silverton <jim.silverton <at> gmail.com> writes:

> 
> Hello,
> I have some discrete pvalues and I would like to sort them. Then add random
> noise so that they are ordered the same way as the original pvalues. Off
> course I don't want any pvalues less than 0 or greater than 1. Any ideas on
> how to do this in R?
> 


  Are you basically just trying to break ties?

  Something like (completely untested)

eps <- min(diff(c(0,sort(pvaluevector),1)))/2
pvaluevector+runif(length(pvaluevector),min=-eps,max=eps)



More information about the R-help mailing list