Generates a set of Negative Binomial distributed values. Only two of r
,
prob
and mu
can be provided.
r_nbinom( r = NULL, prob = 0.5, ..., mu = NULL, n = default_n(r, prob, mu), .seed = NULL )
r | number of failure trials until stopping, strictly positive |
---|---|
prob | vector of probabilities of success on each trial, between 0 & 1 |
... | Unused |
mu | vector of means |
n | number of observations to generate. The |
.seed | One of the following:
To extract the random seed from a previously generated set of
values, use |
A numeric vector of length n
It is important to note that this is the number of failures,
and not the number of successes, as in rnbinom()
, so
rnbinom(prob = x,...)
is equivalent to r_nbinom(prob=1-x,...)
#> [1] 8 4 11 10 14r_nbinom(1:10, mu = 2)#> [1] 4 0 1 0 0 3 2 2 2 1#' r_nbinom(10, 0.2, n = 10)#> [1] 1 2 1 4 2 1 3 2 1 4