Sat Apr 21 16:27:04 CDT 2012
On Sat, Apr 21, 2012 at 5:12 PM, nicky van foreest <firstname.lastname@example.org> wrote:
>> In : from scipy.stats import uniform
>> In : U = uniform(loc = 3, scale = 5)
>> In : U.mean()
>> Out: 5.5
>> In : U.moment(1)
>> Out: 0.5
>> In : U.moment(8)
>> Out: array(0.11111111111111112)
>> First point: why in line 14 is U.moment(1) not equal to U.mean()? I
>> checked the code on line
>> to see why, and this explains the result. However, from the doc-string
>> on line https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L129
>> I would expect to see that U.moment(1) = U.mean().
Looks like a bug. And I don't think the test suite checks whether loc
and scale is handled correctly in all code paths.
> Interestingly, http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.moment.html
this is empirical moment, a stats function, not for the distribution
non-central for data is just (data**k).mean() if we don't care about ddof.
Do we need a function?
> says that moment() does compute the central moment. However, I need
> the real moments, i.e., E (X^n) = \int x^n dF(x) where F is the
> distribution function of the R.V. X.
the distribution method moment is non-centered, raw moment.
(It was a bit inconsistent when I went through this, and I think I
decided everywhere on raw moments,)
> SciPy-Dev mailing list
More information about the SciPy-Dev