dpower {sads}R Documentation

Power discrete distribution

Description

Density, distribution function, quantile function and random generation for discrete version of power distribution with parameter s.

Usage

dpower( x, s, log=FALSE)
ppower( q, s, lower.tail=TRUE, log.p=FALSE)
qpower( p, s, lower.tail= TRUE, log.p=FALSE)
rpower( n, s, bissection = FALSE, ...)

Arguments

x

vector of (integer x>0) quantiles. In the context of species abundance distributions, this is a vector of abundances of species in a sample.

q

vector of (integer x>0) quantiles. In the context of species abundance distributions, a vector of abundances of species in a sample.

n

number of random values to return.

p

vector of probabilities.

s

positive real s > 1; exponent of the power distribution.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

bissection

logical; uses the bissection method to generate random numbers? If FALSE calls poweRlaw::rpldis, which provides a faster, continuous approximation for large numbers (Gilliespie 2015).

...

further arguments to be passed to poweRlaw::rpldis when bissection = TRUE

Details

The power density is a discrete probability distribution defined for integer x > 0:

p(x) = \frac{x^{-s}}{\zeta (s)}

Hence p(x) is proportional to a negative power of 'x', given by the 's' exponent. The Riemann's \zeta function is the integration constant.

The power distribution can be used as a species abundance distribution (sad) model, which describes the probability of the abundance 'x' of a given species in a sample or assemblage of species.

Value

dpower gives the (log) density of the density, ppower gives the (log) distribution function, qpower gives the quantile function.

Invalid values for parameter s will result in return values NaN, with a warning.

Author(s)

Paulo I Prado prado@ib.usp.br and Murilo Dantas Miranda.

References

Johnson N. L., Kemp, A. W. and Kotz S. (2005) Univariate Discrete Distributions, 3rd edition, Hoboken, New Jersey: Wiley. Section 11.2.20.

Colin S. Gillespie (2015) Fitting Heavy Tailed Distributions: The poweRlaw Package. Journal of Statistical Software, 64(2), 1-16. URL http://www.jstatsoft.org/v64/i02/.

See Also

dzeta in VGAM package; poweRlaw package; fitpower for maximum likelihood estimation in the context of species abundance distributions.

Examples

x <- 1:20
PDF <- dpower(x=x, s=2)
CDF <- ppower(q=x, s=2)
par(mfrow=c(1,2))
plot(x,CDF, ylab="Cumulative Probability", type="b",
     main="Power distribution, CDF")
plot(x,PDF, ylab="Probability", type="h",
     main="Power distribution, PDF")
par(mfrow=c(1,1))

## The power distribution is a discrete PDF, hence:
all.equal( ppower(10, s=2), sum(dpower(1:10, s=2)) ) # should be TRUE

## quantile is the inverse of CDF
all.equal(qpower(CDF, s=2), x) 


[Package sads version 0.6.3 Index]