rtpois {random.cdisc.data} | R Documentation |
Zero-Truncated Poisson Distribution
Description
This generates random numbers from a zero-truncated Poisson distribution,
i.e. from X | X > 0
when X ~ Poisson(lambda)
. The advantage here is that
we guarantee to return exactly n
numbers and without using a loop internally.
This solution was provided in a post by
Peter Dalgaard.
Usage
rtpois(n, lambda)
Arguments
n |
( |
lambda |
( |
Value
The random numbers.
Examples
x <- rpois(1e6, lambda = 5)
x <- x[x > 0]
hist(x)
y <- rtpois(1e6, lambda = 5)
hist(y)
[Package random.cdisc.data version 0.3.15 Index]