[Numpy-discussion] von mises distribution in numpy.random biased
Sun Sep 9 21:47:03 CDT 2007
On 9/8/07, Travis E. Oliphant <firstname.lastname@example.org> wrote:
> killian koepsell wrote:
> > hi,
> > the von mises distribution in numpy.random seems to be biased towards
> > a higher concentration (kappa). given a concentration of 2, it
> > produces data that has a concentration of 2.36. i compared the
> > distribution to the one produced by the CircStats package of R
> > using RPy  and created a figure here:
> > http://redwood.berkeley.edu/kilian/vonmises.png
> The algorithm in NumPy is basically the same algorithm. However, two
> things are different about it and the one used in R (and in Python
> itself by the way).
> 1) The two random variates used in the rejection algorithm are drawn
> from a uniform on [-1,1]
> 2) The testing for the sign is done with the same random variable
> instead of a new one.
> I've updated the source to change both of these behaviors. I suspect
> the bias is coming from 1)
> Perhaps you could re-run your tests.
thanks for fixing this so fast. it looks very good now:
More information about the Numpy-discussion