mercredi 25 mai 2016

i'th of n order statistic distribution in C++?

The i'th of n order statistic for a domain D and a probability measure u is the distribution of the i'th lowest value in a set of n values, each of which has been sampled from domain D using probability measure (read: distribution) u.

I want to sample from this distribution in C++, when I am able to sample from u. The naive approach is to make n samples from u, sort them and take the i'th; but - this is problematic when i and n are high.

  • When u is the uniform distribution U(D) and D is discrete?
  • When u is the uniform distribution U(D) and D is continuous, or rather a floating-point number?
  • In general?

Notes:

  • I am willing to take a minor hit in accuracy in exchange for a nice(r) approach.
  • By "better" I mean simpler, or faster, or more statistically robust considering how random numbers are generated.
  • I personally need code which is C++11-compatible. C++14/C++1z solutions are welcome for the sake of other users.

Aucun commentaire:

Enregistrer un commentaire