| ztgeom | R Documentation |
Probability mass function, distribution function, and random generation for the zero-truncated geometric distribution.
dztgeom(x, prob, log = FALSE)
pztgeom(q, prob, lower.tail = TRUE, log.p = FALSE)
rztgeom(n, prob)
x, q |
integer vector of counts |
prob |
probability of success in each trial, in (0,1) |
log, log.p |
logical; return log-density if TRUE |
lower.tail |
logical; if |
n |
number of random values to return. |
This implementation allows for automatic differentiation with RTMB.
By definition, this distribution only has support on the positive integers (1, 2, ...). Any zero-truncated distribution is defined as
P(X=x | X>0) = P(X=x) / (1 - P(X=0)),
where P(X=x) is the probability mass function of the corresponding untruncated distribution.
For the geometric with success probability \pi this gives
P(X=x | X>0) = \pi\,(1-\pi)^{x-1}, \quad x = 1, 2, \ldots
dztgeom gives the probability mass function, pztgeom gives the distribution function, and rztgeom generates random deviates.
zigeom, hgeom, ztnbinom, ztpois
set.seed(123)
x <- rztgeom(5, prob = 0.3)
d <- dztgeom(x, prob = 0.3)
p <- pztgeom(x, prob = 0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.