numpy.random.RandomState.pareto

方法

random.RandomState.pareto(a, size=None)

从指定形状的Pareto II或Lomax分布中提取样品。

Lomax或Pareto II分布是一个移位的Pareto分布。经典的帕累托分布可以从lomax分布中通过加1和乘以尺度参数得到。 m (见注释)。Lomax分布的最小值是零,而对于经典的Pareto分布,它是零。 mu ,其中标准帕累托分布有位置 mu = 1 . Lomax也可以被视为广义帕累托分布的简化版本(在Scipy中可用),比例设置为1,位置设置为零。

帕累托分布必须大于零,并且在上面是无界的。它也被称为“80-20法则”。在这个分布中,80%的权重在最小的20%范围内,而其他20%则填充剩余的80%范围。

注解

新代码应该使用 pareto A方法 default_rng() 请参阅 快速启动 .

参数
a浮点数或类似浮点数的数组

分布的形状。必须是肯定的。

sizeint或int的元组,可选

输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。如果尺寸是 None (默认),如果 a 是标量。否则, np.array(a).size 取样。

返回
outndarray或scalar

从参数化帕累托分布中提取样本。

参见

scipy.stats.lomax

概率密度函数、分布或累积密度函数等。

scipy.stats.genpareto

概率密度函数、分布或累积密度函数等。

Generator.pareto

应该用于新代码。

笔记

帕累托分布的概率密度是

System Message: WARNING/2 (p(x)=\frac am^a x ^ a+1)

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...lit}p(x)=\frac am^a x ^ a+1\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...lit}p(x)=\frac am^a x ^ a+1\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...lit}p(x)=\frac am^a x ^ a+1\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...lit}p(x)=\frac am^a x ^ a+1\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 408 bytes). Transcript written on math.log.

在哪里? a 是形状和 m 规模。

帕累托分布,以意大利经济学家维尔弗雷多·帕累托的名字命名,是一种适用于许多现实世界问题的幂律概率分布。在经济学领域之外,它通常被称为布拉德福德分布。帕累托发展了分布来描述经济中财富的分布。它还可以用于保险、网页访问统计、油田规模和许多其他问题,包括SourceForge项目的下载频率。 [1]. 它是所谓的“肥尾”分布之一。

工具书类

1

Francis Hunt和Paul Johnson,关于SourceForge项目的帕累托分布。

2

Pareto,V.(1896年)。政治经济学课程。洛桑。

3

Reiss,R.D.,Thomas,M.(2001),《极值统计分析》,Birkhauser Verlag,巴塞尔,第23-30页。

4

维基百科,“帕累托分布”,https://en.wikipedia.org/wiki/pareto_distribution

实例

从分发中抽取样本:

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

显示样本的直方图,以及概率密度函数:

>>> import matplotlib.pyplot as plt
>>> count, bins, _ = plt.hist(s, 100, density=True)
>>> fit = a*m**a / bins**(a+1)
>>> plt.plot(bins, max(count)*fit/max(fit), linewidth=2, color='r')
>>> plt.show()
../../../_images/numpy-random-RandomState-pareto-1.png