mu
and variance
mu + mu^2/theta
.
rnegbin(n, mu=n, theta=stop("theta must be given"))
length(n)
is the number required and
n
is used as the mean vector if
mu
is not specified.
theta
parameter.
Short vectors are recycled.
.Random.seed
in the usual way.
The function uses the representation of the Negative Binomial distribution
as a continuous mixture of Poisson distributions with Gamma distributed means.
Unlike
rnbinom
the index can be arbitrary.
# Negative Binomials with means fitted(fm) and theta = 4.5 fm <- glm.nb(Days ~ ., data = quine) dummy <- rnegbin(fitted(fm), theta = 4.5)