Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The docstring of np.random.pareto (Version 1.8.0) contains multiple critical errors #4181

Closed
@ckuehne

Description

@ckuehne

The docstring of np.random.pareto (Version 1.8.0) contains multiple errors. In a nutshell np.random.pareto does not draw samples from the Pareto distribution shown under 'Notes' in the docstring. Instead it draws samples from a Lomax distribution (also stated in the docstring). However, the description in the docstring of how to convert those Lomax random variates to a Pareto distribution is wrong. Further, the examples are faulty.

More detailed:
The function np.random.pareto draws random variates from a Lomax distribution with shape a and location m'=1. To convert
those samples to a classical Pareto distribution with shape a and
location m you have to add 1 and multiply by m, instead of adding m as
stated in the docstring.

More specifically, the docstring says:
"The Lomax or Pareto II distribution is a shifted Pareto distribution. The
classical Pareto distribution can be obtained from the Lomax distribution
by adding the location parameter m, see below."

Instead, it should read "[..] by adding 1 and multiplying my m, see below."

The example at the bottom thereforeshould read:

a, m = 3., 1. # shape and mode
s = (np.random.pareto(a, 1000) + 1) * m

Maybe an example with m=10 makes it clearer

a, m = 3., 10. # shape and mode
s = (np.random.pareto(a, 1000) + 1) * m

Additionally, calling m the location parameter could be misleading.
For simple Pareto (Type I) distributions it is usually referred to as
the x_min or the scale parameter of the distribution. When discussing
generalized Pareto distributions m is also called the scale
parameter (a constant factor) while mu is the location (an additive
term) [1]. I assume the misleading naming could have caused some
confusion and lead to the errors described above.

Last but not least I think it might also cause confusion to call
a function 'random.pareto' while its meaning is 'shifted by -1 pareto'. :)

[1]http://en.wikipedia.org/wiki/Generalized_Pareto_distribution

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp