Poisson
The Poisson Distribution
Description
Calculates density, cumulative probability, quantile, and
generate random sample for the Poisson distribution (discrete).
Usage
dpois(x, lambda, log = FALSE) # density
ppois(q, lambda, lower.tail = TRUE, log.p = FALSE) # probability
qpois(p, lambda, lower.tail = TRUE, log.p = FALSE) # quantile
rpois(n, lambda) # random
Arguments
x, q |
numeric vectors in the range [0, Inf) that specify the quantiles.
|
p |
a numeric vector in the range [0, 1] that specifies the probabilities.
|
n |
an integer value in the range [0, Inf) that specifies the number of random samples requested.
If the input value is not an integer, it is truncated.
If length(n) is greater than 1,
the random function returns length(n) random samples.
|
lambda |
a numeric vector in the range [0, Inf) that specifies the means.
|
log |
a logical value.
If FALSE (default), the density function returns the density itself.
If TRUE, it returns the log of the density.
|
lower.tail |
a logical value.
If TRUE (default), the probability supplied to the quantile function
or returned by the probability function is P[X <= x].
If FALSE, it is P[X > x].
|
log.p |
a logical value.
If FALSE (default), the probability supplied to the quantile function
or returned by the probability function is the probability itself.
If TRUE, it is the log of the probability.
|
Details
The distribution parameter(s) are replicated cyclically to be the same length as
the input x, q, p, or the number of random samples requested.
Missing values (NAs) in the input or the distribution parameter(s)
will cause the corresponding elements of the result to be missing.
Value
returns density (dpois),
cumulative probability (ppois),
quantile (qpois), or
random sample (rpois)
for the Poisson distribution with parameter lambda.
The quantile is defined as the smallest value q such that Pr(Poisson random variate <= x) >= p.
Side Effects
If the .Random.seed dataset exists, the random sample function updates its value.
The random sample function creates the .Random.seed dataset if it does not exist.
Background
The Poisson distribution is the discrete probability distribution of
the number of events occurring in a fixed period of time
if these events occur with a known average rate lamda
and independently of the time since the last event.
It has support on the set {0, 1, 2, 3, …}.
See Also
Examples
rpois(20,3) #sample of size 20 with a mean of 3