Function to generate random outcomes from a Negative Binomial distribution,
mu and variance
mu + mu^2/theta.
rnegbin(n, mu = n, theta = stop("'theta' must be specified"))
If a scalar, the number of sample values required. If a vector,
The vector of means. Short vectors are recycled.
Vector of values of the
The function uses the representation of the Negative Binomial distribution
as a continuous mixture of Poisson distributions with Gamma distributed means.
rnbinom the index can be arbitrary.
Vector of random Negative Binomial variate values.
.Random.seed in the usual way.
# Negative Binomials with means fitted(fm) and theta = 4.5 fm <- glm.nb(Days ~ ., data = quine) dummy <- rnegbin(fitted(fm), theta = 4.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.