[SciPy-user] bug in scipy.stats ?

Stéfan van der Walt stefan@sun.ac...
Sun Apr 20 13:21:38 CDT 2008


Hi Hoyt

On 20/04/2008, Hoyt Koepke <hoytak@gmail.com> wrote:
> Been playing around with scipy.stats a little bit and noticed some
>  puzzling behavior with the gamma function.  Is this a bug?
>
>  In [1]: import scipy.stats as st
>
>  In [2]: g = st.gamma(a=1, b=1)
>
>  In [3]: g.rvs()

>From the docstring:

        Alternatively, the object may be called (as a function) to fix
           the shape, location, and scale parameters returning a
           "frozen" continuous RV object:

        myrv = gamma(a,loc=0,scale=1)
            - frozen RV object with the same methods but holding the
                given shape, location, and scale fixed

For the gamma function:

b = theta = scale

So you can either do:

g = st.gamma(a, scale=b)
g.rvs(), g.rvs(3) etc.

or

g = st.gamma.rvs(a, scale=b)

Regards
Stéfan


More information about the SciPy-user mailing list