Thanks.  The problems you suggested are not a problem for me, because:

a. ?y is assumed to be uniformly random for any test.
b. m can be as large as I like, and I can keep doing ?p until I get n
number which are less than q.


On Thu, Jul 16, 2020 at 11:33 AM Raul Miller <[email protected]> wrote:

> Yes, assuming that there's no other dependence on the values appearing
> in ?m$p and that the ? in ?m$p is actually uniform. (If there's
> artifacts, this process may (or may not) amplify them.)
>
> Remember of course that there's no guarantee that there will be n
> values in ?m$p which are less than q.
>
> Thanks,
>
> --
> Raul
>
>
> On Thu, Jul 16, 2020 at 2:29 PM Roger Hui <[email protected]>
> wrote:
> >
> > Arrgh,
> >
> > Is it valid to generate ?m$p where p>q, and keep only the numbers which
> are
> > less than q?  (Not less than p.)
> >
> >
> > On Thu, Jul 16, 2020 at 11:27 AM Roger Hui <[email protected]>
> > wrote:
> >
> > > A question for the statisticians and mathematicians among us.
> > >
> > > Suppose I want to generate uniform random numbers ?n$q.  Is it valid to
> > > generate ?m$p where p>q, and keep only the numbers which are less than
> p?
> > > Assume that m can be as large as we like.
> > >
> > > An example where p is 30 and q is 10.
> > >
> > >    x=: ?1e6$30
> > >    y=: (x<10)#x
> > >    n=: #y
> > >    n
> > > 332824
> > >    c=: <: #/.~(i.10),y
> > >    +/c
> > > 332824
> > >
> > > Here, c are the count of the numbers 0,1,2,...,9 in y.
> > >
> > > The maximum absolute difference between the sample cumulative
> distribution
> > > n%~+/\c and the the theoretical cumulative distribution +/\10$0.1 is:
> > >
> > >    >./ | (n%~+/\c) - +/\10$0.1
> > > 0.000795616
> > >
> > > The ⍺=0.01 critical value for the Kolmogorov test
> > > <https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test> is
> > > approximately
> > >
> > >    1.63 % %: n
> > > 0.0028254
> > >
> > > Therefore, for this one test, y is uniformly distributed with
> confidence >
> > > 1-⍺=0.99, like ?n⍴10.
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to