| geom.ad | R Documentation |
Density and distribution function for the geometric distribution, written so
that they can be taped by RTMB.
dgeom.ad(x, prob, log = FALSE)
pgeom.ad(q, prob, lower.tail = TRUE, log.p = FALSE)
x, q |
integer vector of counts |
prob |
probability of success in each trial, in (0,1] |
log, log.p |
logical; if |
lower.tail |
logical; if |
stats already provides the geometric distribution, but its versions
cannot be differentiated. These are AD-compatible replacements, reached
automatically whenever an argument is an AD variable, so stats::dgeom
and stats::pgeom are left untouched for ordinary use.
The parameterisation is the same as in stats: X is the number of
failures before the first success, so
P(X = x;\,\pi) = \pi\,(1 - \pi)^{x}, \quad x = 0, 1, 2, \ldots
The density is obtained from the negative binomial with size = 1, for
which RTMB provides an AD method; the distribution function
1 - (1-\pi)^{x+1} is elementary.
dgeom.ad gives the probability mass function and pgeom.ad gives the distribution function.
zigeom, ztgeom, hgeom
dgeom.ad(0:5, prob = 0.3)
pgeom.ad(0:5, prob = 0.3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.