Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.random.RandomState.logseries

RandomState.logseries(p,size=None)

Draw samples from a logarithmic series distribution.

Samples are drawn from a log series distribution with specifiedshape parameter, 0 <p < 1.

Parameters:

p : float or array_like of floats

Shape parameter for the distribution. Must be in the range (0, 1).

size : int or tuple of ints, optional

Output shape. If the given shape is, e.g.,(m,n,k), thenm*n*k samples are drawn. If size isNone (default),a single value is returned ifp is a scalar. Otherwise,np.array(p).size samples are drawn.

Returns:

out : ndarray or scalar

Drawn samples from the parameterized logarithmic series distribution.

See also

scipy.stats.logser
probability density function, distribution or cumulative density function, etc.

Notes

The probability density for the Log Series distribution is

P(k) = \frac{-p^k}{k \ln(1-p)},

where p = probability.

The log series distribution is frequently used to represent speciesrichness and occurrence, first proposed by Fisher, Corbet, andWilliams in 1943 [2]. It may also be used to model the numbers ofoccupants seen in cars [3].

References

[R171]Buzas, Martin A.; Culver, Stephen J., Understanding regionalspecies diversity through the log series distribution ofoccurrences: BIODIVERSITY RESEARCH Diversity & Distributions,Volume 5, Number 5, September 1999 , pp. 187-195(9).
[R172]Fisher, R.A,, A.S. Corbet, and C.B. Williams. 1943. Therelation between the number of species and the number ofindividuals in a random sample of an animal population.Journal of Animal Ecology, 12:42-58.
[R173]D. J. Hand, F. Daly, D. Lunn, E. Ostrowski, A Handbook of SmallData Sets, CRC Press, 1994.
[R174]Wikipedia, “Logarithmic distribution”,http://en.wikipedia.org/wiki/Logarithmic_distribution

Examples

Draw samples from the distribution:

>>>a=.6>>>s=np.random.logseries(a,10000)>>>count,bins,ignored=plt.hist(s)

# plot against distribution

>>>deflogseries(k,p):...return-p**k/(k*log(1-p))>>>plt.plot(bins,logseries(bins,a)*count.max()/             logseries(bins, a).max(), 'r')>>>plt.show()

Previous topic

numpy.random.RandomState.lognormal

Next topic

numpy.random.RandomState.multinomial

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp