# [SciPy-Dev] scipy.stats

nicky van foreest vanforeest@gmail....
Sat Apr 21 16:12:19 CDT 2012

> 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
>
> In [15]: U.moment(8)
> Out[15]: array(0.11111111111111112)
>
> First point: why in line 14 is U.moment(1)  not equal to U.mean()? I
> checked the code on line
> https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L358
> 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().

Interestingly, http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.moment.html
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.