Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Testing for uniform distribution

    This thread suggests that to test for the sample uniform distribution quantile command can be used.

    I am having a sample of N numbers produced by a certain random number generator. The chart built by quantile looks very good (replicates the 45 angle line closely).

    But, as I understand this is not sufficient yet to conclude the generator is good. Here is an example:

    1,9,2,5,8,6,4,7,3 -> good (for me)
    1,2,3,4,5,6,7,8,9 -> not good (for me)


    in the second case the quantile plot results in the same picture, but it is "obviously" not random.

    The hard part is to formulate what exactly is desirable, but I guess if I have a sample of N then the quantile should produce "good" pictures for the first N/2 and for the second N/2 numbers while preserving the same min, max, mean, median (and we repeat recursively). This got to be known as some standard property please let me know what term applies here.

    This article discusses a lot of approaches to the problem, but has a lot of broken links.

    If it matters, I am actually having a limited set of K samples with N1, N2, .. NK elements coming from the same generator. Sample sizes are in the thousands. There is no reason to believe that the generator in question has a finite period, or it is extremely large much larger than any of the N I have for the sample sizes to test.

    In the end I'd like to get some idea of e.g. whether the generator in question is better or worse than Stata's own, and if worse, how much worse (if such metrics exist).
    And this is more of a quick diagnostics check, and not a research project.

    Example data N=1000:
    Code:
    insheet using "http://www.radyakin.org/statalist/2019/rnd1000.txt"
    Thank you, Sergiy Radyakin

  • #2
    a good start is Knuth's The Art of computer programming: Vol 2, Semi-numerical algorthms


    but many more tests have been described by George Marsaglia; you can get an intro by going to https://en.wikipedia.org/wiki/Randomness_tests and downloading one of his papers at the external links - that paper cites a number of his other papers on testing rng's

    added in edit: you cannot prove that an rng produces random number generators but various tests can eliminate (if passed) various threats - you might also want to ask StataCorp how they test their rng's

    Comment

    Working...
    X