Python Forum
generate random variables based on a non-standard t-distribution - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: generate random variables based on a non-standard t-distribution (/thread-22881.html)



generate random variables based on a non-standard t-distribution - nathalie - Dec-01-2019

Hello all,


does anyone know how to generate random variables based on a non-standard t-distribution?
np.random only accepts the standard t distribution with df as input factor.

Best,
Nathalie


RE: generate random variables based on a non-standard t-distribution - ThomasL - Dec-02-2019

Hi, use Numpy.
https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.random.html


RE: generate random variables based on a non-standard t-distribution - nathalie - Dec-02-2019

Hi Thomas, thanks for your reply.
Also numpy only takes the standard t distribution standard_t with (df[, size]) as input factors. However, I would like also input loc and scale.


RE: generate random variables based on a non-standard t-distribution - ThomasL - Dec-02-2019

So None of the 35 distributions you can choose from work for you?


RE: generate random variables based on a non-standard t-distribution - scidam - Dec-03-2019

(Dec-01-2019, 01:47 PM)nathalie Wrote: does anyone know how to generate random variables based on a non-standard t-distribution?

Take a look at scipy.stats module. It allows to define custom distribution (continuous and discreet). What means non-standard t-distribution; maybe you can sample from standard t-dist and filter resulted points somehow.