[SciPy-user] scipy.stats rv objects from data

Stéfan van der Walt stefan@sun.ac...
Mon Apr 28 02:29:20 CDT 2008


Hi Erik

2008/4/28 Erik Tollerud <erik.tollerud@gmail.com>:
> I'm finding the scipy.stats documentation somewhat difficult to
>  follow, so maybe the answer to this question is in there... I can't
>  really find it, though.
>
>  What I have is a sequence of numbers X_i . Two things I'd like to be
>  able to do with this:
>  1. Create a discrete probability distribution (class rv_discrete) from
>  this data so as to use the utility functions that take rv_discrete
>  objects.
>  The rv_discrete documentation suggests should be easy.  I did the following
>  >>>ddist=rv_discrete(values=(x,[1/len(x) for i in x]),name='test')
>  >>>ddist.pmf(50)
>  array(0.0)

That should be 1.0/len(x), otherwise all the probabilities are 0.

Cheers
Stéfan


More information about the SciPy-user mailing list