[GSoC] Mir.random.flex - Generic non-uniform random sampling

Seb via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Aug 23 07:36:27 PDT 2016


On Tuesday, 23 August 2016 at 13:12:28 UTC, tn wrote:
> Another question: You mention that statistical quality is 
> important, but it is not clear if flex has better or worse 
> quality than Box-Muller and Ziggurat in the case of sampling 
> from normal distribution. Or is the difference negligible? (I 
> realize that the real strength of flex is its versatility.)

tl;dr: yes, it's negligible for the normal distribution.

Excellent question - I didn't cover this in much detail because:

(1) it has already been done extensively in the literature. For 
example, scroll to Table IV (page 32) at "Gaussian Random Number 
Generators" by Thomas et. al. (2007) for chi-squared and 
high-sigma tests [1] (btw in all random libraries I looked at, 
e.g. <random>, the Box-Muller method is used for the normal 
distribution)
(2) the authors of the Tinflex algorithm wrote their own UNU.RAN 
[2] library to prove that the transformed density rejection 
method is close to inversion method (without numerical errors, it 
would be "perfect"). Under the hood UNU.RAN uses polynomial 
interpolation of inverse CDF, which is needed to be able to 
automatically compute statistical properties. This method is on 
our roadmap [3].
(3) the hat/squeeze and cumulative histograms of nearly all 
example distributions at [4] look pretty good [5] (if the 
cumulative histogram is identical to the CDF curve, the errors 
are negligible)
(4) this is just a preview release and requires [3] for automatic 
testing of user-generated distributions

[1] http://www.doc.ic.ac.uk/~wl/papers/07/csur07dt.pdf
[2] http://statmath.wu.ac.at/unuran/
[3] https://github.com/libmir/mir/issues/46
[4] https://github.com/libmir/mir/tree/master/examples/flex_plot
[5] https://drive.google.com/open?id=0BwdiZp7qSaBhZXRJNHhSN1RHR3c


More information about the Digitalmars-d-announce mailing list