Hi,
I've just stumbled across a somewhat strange behaviour when I evaluated:

  np.random.standard_t(np.inf)

and got NaN back. The limit of df going to infinity in Student's
t-distribution is a Gaussian, so I'd expect a Gaussian variate back
(but I suppose a warning or error could be argued to be valid).  Note
that R explicitly supports this[1] and results in Gaussian
behaviour[2].

It looks relatively easy to modify random_standard_t (in
distributions.c) to get similar behaviour, but wanted to check if this
behaviour was deliberate before opening an issue.

In fact it looks like the precision of doubles limit df > ~1e35 to be
Gaussian[3], which might compile down to something smaller than a call
to isfinite() as well as catching more cases[4].

Thanks!

  Sam

[1] https://search.r-project.org/R/refmans/stats/html/TDist.html
[2] R source, src/nmath/rt.c, src/nmath/dt.c, etc.
[3] np.random.gamma(1e35, size=100) - 1e35
[4] https://godbolt.org/z/KcvY8sKd3
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to