[Scipy-tickets] [SciPy] #1650: scipy.stats: inconsistent doc string
SciPy Trac
scipy-tickets@scipy....
Wed May 2 11:22:10 CDT 2012
#1650: scipy.stats: inconsistent doc string
-------------------------+--------------------------------------------------
Reporter: nicky | Owner: somebody
Type: enhancement | Status: new
Priority: low | Milestone: Unscheduled
Component: scipy.stats | Version: 0.10.0
Keywords: |
-------------------------+--------------------------------------------------
Old description:
> The doc string on line (as of date April 16 2012)
> https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L129
>
> to compute the moments of a distribution is like this:
>
> _doc_moment = \
> """moment(n, %(shapes)s, loc=0, scale=1)
> Non-central moment of order n
> """
>
> Thus, a non-central moment should be returned. On the other hand, the
> code on line
>
> https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L358
>
> is as follows:
>
> def _moment(data, n, mu=None):
> if mu is None:
> mu = data.mean()
> return ((data - mu)**n).mean()
>
> This computes a central moment, not a non-central moment.
>
> Besides this, this code is called nowhere within distributions.py. Is it
> dead?
New description:
The doc string on line (as of date April 16 2012)
https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L129
to compute the moments of a distribution is like this:
{{{
_doc_moment = \
"""moment(n, %(shapes)s, loc=0, scale=1)
Non-central moment of order n
"""
}}}
Thus, a non-central moment should be returned. On the other hand, the
code on line
https://github.com/scipy/scipy/blob/master/scipy/stats/distributions.py#L358
is as follows:
{{{
def _moment(data, n, mu=None):
if mu is None:
mu = data.mean()
return ((data - mu)**n).mean()
}}}
This computes a central moment, not a non-central moment.
Besides this, this code is called nowhere within distributions.py. Is it
dead?
--
Comment(by warren.weckesser):
Add markup to the description.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1650#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list