| rpoistrunc | R Documentation |
Generate random realisations, or calculate probability distribution or quantiles, of a Poisson random variable which is conditioned to be nonzero, or conditioned to be at least a given number.
dpoisnonzero(x, lambda, log=FALSE)
ppoisnonzero(q, lambda, lower.tail=TRUE, log.p=FALSE)
qpoisnonzero(p, lambda, lower.tail=TRUE, log.p=FALSE)
rpoisnonzero(n, lambda, method=c("harding", "transform"), implem=c("R", "C"))
dpoistrunc(x, lambda, minimum=1, log=FALSE)
ppoistrunc(q, lambda, minimum=1, lower.tail=TRUE, log.p=FALSE)
qpoistrunc(p, lambda, minimum=1, lower.tail=TRUE, log.p=FALSE)
rpoistrunc(n, lambda, minimum=1, method=c("harding", "transform"), implem=c("R", "C"))
x |
Vector of quantiles. |
q |
Vector of quantiles. |
p |
Vector of probabilities. |
n |
Number of random values to be generated. |
lambda |
Mean value of the un-truncated Poisson distribution. A nonnegative number, or vector of nonnegative numbers. |
minimum |
Minimum permitted value for the random variables. A nonnegative integer, or vector of nonnegative integers. |
lower.tail |
Logical value. If |
log, log.p |
Logical value. If |
method |
Character string (partially matched) specifying the simulation algorithm to be used. See Details. |
implem |
Character string specifying whether to use the implementation
in interpreted R code ( |
rpoisnonzero
generates realisations of the
Poisson distribution with mean lambda
conditioned on the event that the values are not equal to zero.
The functions dpoisnonzero, ppoisnonzero,
qpoisnonzero calculate the probability mass function,
cumulative distribution function, and quantile function, respectively.
rpoistrunc
generates realisations of the
Poisson distribution with mean lambda
conditioned on the event that the values are greater than
or equal to minimum.
The default minimum=1 is equivalent to
generating zero-truncated Poisson random variables
using rpoisnonzero.
The value minimum=0 is equivalent to
generating un-truncated Poisson random variables
using rpois.
The functions dpoistrunc, ppoistrunc,
qpoistrunc calculate the probability mass function,
cumulative distribution function, and quantile function, respectively.
The arguments lambda and minimum can be
vectors of length n, specifying different means
for the un-truncated Poisson distribution, and different
minimum values, for each of the n random output values.
For the random generators,
if method="transform" the simulated values are generated
by transforming a uniform random variable using the quantile function
of the Poisson distribution.
If method="harding" (the default) the simulated values are
generated using an algorithm proposed by E.F. Harding which exploits
properties of the Poisson point process. The Harding algorithm seems
to be faster.
Numerical vector.
, after ideas of Ted Harding and Peter Dalgaard.
E.F. Harding (2005) Email to R-help email group, 01 May 2005.
P. Dalgaard (2005) Email to R-help email group, 01 May 2005.
rpois for Poisson random variables.
recipEnzpois for the reciprocal moment of rpoisnonzero.
rpoisnonzero(10, 0.8)
rpoistrunc(10, 1, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.