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

Stéfan van der Walt stefan at sun.ac.za
Mon Apr 28 03:29:20 EDT 2008


Hi Erik

2008/4/28 Erik Tollerud <erik.tollerud at 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