bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / random / _generator / Generator / pareto
cython_function_or_method
numpy.random._generator:Generator.pareto
Signature
def pareto ( a , size = None ) Summary
Draw samples from a Pareto II (AKA Lomax) distribution with specified shape.
Parameters
a: float or array_like of floatsShape of the distribution. Must be positive.
size: int or tuple of ints, optionalOutput shape. If the given shape is, e.g.,
(m, n, k), thenm * n * ksamples are drawn. If size isNone(default), a single value is returned ifais a scalar. Otherwise,np.array(a).sizesamples are drawn.
Returns
out: ndarray or scalarDrawn samples from the Pareto II distribution.
Notes
The probability density for the Pareto II distribution is
where is the shape.
The Pareto II distribution is a shifted and scaled version of the Pareto I distribution, which can be found in scipy.stats.pareto.
Examples
Draw samples from the distribution:a = 3. rng = np.random.default_rng() s = rng.pareto(a, 10000)✓
import matplotlib.pyplot as plt x = np.linspace(0, 3, 50) pdf = a / (x+1)**(a+1)✓
plt.hist(s, bins=x, density=True, label='histogram') plt.plot(x, pdf, linewidth=2, color='r', label='pdf') plt.xlim(x.min(), x.max()) plt.legend()✗
plt.show()
✓
See also
- scipy.stats.genpareto
Generalized Pareto distribution
- scipy.stats.lomax
Lomax (Pareto II) distribution
- scipy.stats.pareto
Pareto I distribution
Aliases
-
numpy.random.Generator.pareto