powered by
Probability mass function, distribution function, quantile function, and random generation for the negative binomial distribution reparameterised in terms of mean and size.
dnbinom2(x, mu, size, log = FALSE)pnbinom2(q, mu, size, lower.tail = TRUE, log.p = FALSE)qnbinom2(p, mu, size, lower.tail = TRUE, log.p = FALSE)rnbinom2(n, mu, size)pnbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE)
pnbinom2(q, mu, size, lower.tail = TRUE, log.p = FALSE)
qnbinom2(p, mu, size, lower.tail = TRUE, log.p = FALSE)
rnbinom2(n, mu, size)
pnbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE)
dnbinom2 gives the density, pnbinom2 gives the distribution function, qnbinom2 gives the quantile function, and rnbinom2 generates random deviates.
dnbinom2
pnbinom2
qnbinom2
rnbinom2
vector of quantiles
mean parameter, must be positive.
size parameter, must be positive.
logical; if TRUE, probabilities/ densities \(p\) are returned as \(\log(p)\).
TRUE
logical; if TRUE, probabilities are \(P[X \le x]\), otherwise, \(P[X > x]\).
vector of probabilities
number of random values to return.
probability of success in each trial. 0 < prob <= 1.
This implementation allows for automatic differentiation with RTMB.
RTMB
pnbinom is an AD-compatible implementation of the standard parameterisation of the CDF, missing from RTMB.
pnbinom
set.seed(123) x <- rnbinom2(1, 1, 2) d <- dnbinom2(x, 1, 2) p <- pnbinom2(x, 1, 2) q <- qnbinom2(p, 1, 2)
Run the code above in your browser using DataLab