[SciPy-Dev] scipy.stats

nicky van foreest vanforeest at gmail.com
Sat Apr 21 17:58:56 EDT 2012


On 21 April 2012 23:45,  <josef.pktd at gmail.com> wrote:
> On Sat, Apr 21, 2012 at 5:31 PM, nicky van foreest <vanforeest at gmail.com> wrote:
>>> In [11]: from scipy.stats import uniform
>>>
>>> In [12]: U = uniform(loc = 3, scale = 5)
>>>
>>> In [13]: U.mean()
>>> Out[13]: 5.5
>>>
>>> In [14]: U.moment(1)
>>> Out[14]: 0.5
>>
>> Might this problem be due to the fact that my ubuntu machine does not
>> support the latest version of scipy.stats?
>
> I'm stil on 0.9 and there is no loc, scale option
>
>>>> import scipy
>>>> scipy.__version__
> '0.9.0'
>>>> stats.uniform.moment(loc = 3, scale = 5)
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: moment() got an unexpected keyword argument 'loc'
>>>> U.moment(1)
> 0.5
>>>> stats.uniform.moment(1)
> 0.5
>
> Obviously I'm not up to date in this.
>
> can you try the distribution directly instead of the frozen distribution?

I am having the same problems as you, although:

In [9]: ? uniform.moment
Type:           instancemethod
Base Class:     <type 'instancemethod'>
String Form:    <bound method uniform_gen.moment of
<scipy.stats.distributions.uniform_gen object at 0x2e901d0>>
Namespace:      Interactive
File:           /usr/lib/python2.7/dist-packages/scipy/stats/distributions.py
Definition:     uniform.moment(self, n, *args)
Docstring:
    n'th order non-central moment of distribution

    Parameters
    ----------
    n: int, n>=1
        order of moment

    arg1, arg2, arg3,... : array-like
        The shape parameter(s) for the distribution (see docstring of the
        instance object for more information)



BTW: all of these points stem from my intention to add some function
to scipy stats to compute/approximate the convolution of two r.v.s.
One such method proposes to use moment matching...



More information about the SciPy-Dev mailing list