[ot-users] Discrete distribution

regis lebrun regis_anne.lebrun_dutfoy at yahoo.fr
Wed Nov 8 22:59:31 CET 2017

 Hi Pamphile,
You can also have a look at the output of DistributionFactory.GetDiscreteMultivariateFactories() and DistributionFactory.GetDiscreteUnivariateFactories() to get the list of all the discrete distributions for which a parametric estimation method has been implemented. Not exactly what you asked for, but rather close.
You mentioned the Multinomial distribution. Be aware of the fact that we don't implement the textbook multinomial distribution (for which X_1+...+X_d=n) because:1) This distribution is not absolutely continuous wrt the discrete Lebesgues measure on {0,...,n}^d2) As such, it does not correspond to the binomial distribution for any choice of the parameters3) Our definition allows to recover the classical one using an obvious trick (set the d+1 component of the probability vector to 0)
You have noticed that the UserDefined class allows to define any (ie arbitrary dimension, arbitrary finite support size) discrete distribution with finite support. It is why the list of discrete distributions is much shorter than the list of absolutely continuous distributions.
For a given distribution, you can check if it is continuous (myDist.isContinuous()), discrete (myDist.isDiscrete(), which is NOT the negation of isContinuous()) or integral (myDist.isIntegral()), this last property allowing to check if the support is part of a lattice, very useful eg to apply Poisson's summation formula.
Using the Mixture class, you can easily build a distribution which is neither continuous nor discrete, think about the waiting time at a traffic light as an application.
You can get the discrete distribution of a linear combination of independent discrete distributions using the RandomMixture class. It is limited to univariate distributions for now.
    Le mercredi 8 novembre 2017 à 14:27:36 UTC+1, Julien Schueller | Phimeca <schueller at phimeca.com> a écrit :  
Hi Roy,

There are several discrete distributions:

- Poisson

- Binomial

- Multinomial

- Dirac

- Geometric

- Skellam

- Bernoulli

- NegativeBinomial

- UserDefined

- ZipfMandelbrot

Maybe they should be highlighted in the doc.


De : users-bounces at openturns.org <users-bounces at openturns.org> de la part de roy <roy at cerfacs.fr>
Envoyé : mercredi 8 novembre 2017 14:14:04
À : users
Objet : [ot-users] Discrete distribution Hi everyone,
I was looking at a way to have discrete distribution.From the doc there is no discrete distribution (or I missed it) so I wanted to use scipy’s distributionsand wrap them with ot.SciPyDistribution. But with randint I got this issue :
>>> ot.SciPyDistribution(randint)Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/Users/roy/Applications/miniconda3/envs/batman3/lib/python3.6/site-packages/openturns/model_copula.py", line 3047, in __init__    raise TypeError('Argument is not a scipy distribution')TypeError: Argument is not a scipy distribution
I tried commenting the raise and it seems to work as I expected. But I suppose the raise is here for a reason.
Until then I am using this:
from scipy.stats import randintimport openturns as ot
rv = randint(10, 20)points = ot.Sample(10000, 1)for i in range(10000):    points[i] = (rv.rvs(),)
disc_dist = ot.UserDefined(points)
Pamphile ROY
Chercheur doctorant en Quantification d’Incertitudes
CERFACS - Toulouse (31) - France
+33 (0) 5 61 19 31 57
+33 (0) 7 86 43 24 22

OpenTURNS users mailing list
users at openturns.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openturns.org/pipermail/users/attachments/20171108/80a9aea4/attachment.html>

More information about the users mailing list