r_nbinom {rando} | R Documentation |
Generate Negative Binomial Distributed Values
Description
Generates a set of Negative Binomial distributed values. Only two of r
,
prob
and mu
can be provided.
Usage
r_nbinom(
r = NULL,
prob = 0.5,
...,
mu = NULL,
n = default_n(r, prob, mu),
.seed = NULL
)
Arguments
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 |
Value
A numeric vector of length n
Note
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,...)
Examples
set_n(5)
r_nbinom(10, 0.5)
r_nbinom(1:10, mu = 2)
#'
r_nbinom(10, 0.2, n = 10)