方法
random.Generator.
logseries
从对数序列分布中提取样本。
从具有指定形状参数0的对数序列分布中提取样本< p < 1。
p
分布的形状参数。必须在范围(0,1)内。
输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。如果尺寸是 None (默认),如果 p 是标量。否则, np.array(p).size 取样。
(m, n, k)
m * n * k
None
np.array(p).size
从参数化对数序列分布中提取样本。
参见
scipy.stats.logser
概率密度函数、分布或累积密度函数等。
笔记
对数级数分布的概率质量函数是
System Message: WARNING/2 (p(k)=\frac-p^k k\ln(1-p),)
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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\end{split} ! Package inputenc Error: Unicode character , (U+FF0C) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\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 ...k)=\frac-p^k k\ln(1-p),\end{split} ! Package inputenc Error: Unicode character , (U+FF0C) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...k)=\frac-p^k k\ln(1-p),\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 460 bytes). Transcript written on math.log.
其中p=概率。
对数序列分布常被用来表示物种丰富度和发生率,这是Fisher、Corbet和Williams于1943年首次提出的。 [2] . 它也可以用来模拟在汽车中看到的乘客数量。 [3] .
工具书类
Buzas,Martin A.;Culver,Stephen J.,通过出现的对数序列分布了解区域物种多样性:生物多样性研究多样性和分布,第5卷,第5号,1999年9月,第187-195(9)页。
Fisher,R.A.、A.S.Corbet和C.B.Williams。1943。动物种群随机抽样中物种数量与个体数量之间的关系。动物生态学杂志,12:42-58。
D.J.Hand,F.Daly,D.Lunn,E.Ostrowski,《小数据集手册》,CRC出版社,1994年。
维基百科,“对数分布”,https://en.wikipedia.org/wiki/logaritic_distribution
实例
从分发中抽取样本:
>>> a = .6 >>> s = np.random.default_rng().logseries(a, 10000) >>> import matplotlib.pyplot as plt >>> count, bins, ignored = plt.hist(s)
#按分布绘制
>>> def logseries(k, p): ... return -p**k/(k*np.log(1-p)) >>> plt.plot(bins, logseries(bins, a) * count.max()/ ... logseries(bins, a).max(), 'r') >>> plt.show()