rnbinom_new {HelpersMG} | R Documentation |
Random numbers for the negative binomial distribution.
Description
See rnbinom
.
Usage
rnbinom_new(n, size = NULL, prob = NULL, mu = NULL, sd = NULL, var = NULL)
Arguments
n |
number of observations. |
size |
target for number of successful trials, or dispersion parameter (the shape parameter of the gamma mixing distribution). Must be strictly positive, need not be integer. |
prob |
probability of success in each trial. 0 < prob <= 1. |
mu |
alternative parametrization via mean. |
sd |
alternative parametrization via standard deviation. |
var |
alternative parametrization via variance. |
Details
rnbinom_new returns random numbers for the negative binomial distribution
Value
Random numbers for the negative binomial distribution
Author(s)
Marc Girondot marc.girondot@gmail.com
See Also
Other Distributions:
cutter()
,
dSnbinom()
,
dbeta_new()
,
dcutter()
,
dggamma()
,
logLik.cutter()
,
plot.cutter()
,
print.cutter()
,
r2norm()
,
rcutter()
,
rmnorm()
Examples
## Not run:
library("HelpersMG")
set.seed(1)
x <- rnbinom_new(n=1000, prob=6.25/(5+6.25), size=6.25)
mean(x)
sd(x)
set.seed(1)
x <- rnbinom_new(n=1000, mu=5, sd=3)
mean(x)
sd(x)
set.seed(1)
x <- rnbinom_new(n=1000, mu=5, var=3^2)
mean(x)
sd(x)
set.seed(1)
x <- rnbinom_new(n=1000, mu=5, size=6.25)
mean(x)
sd(x)
set.seed(1)
x <- rnbinom_new(n=1000, size=6.25, var=3^2)
mean(x)
sd(x)
set.seed(1)
x <- rnbinom_new(n=1000, prob=6.25/(5+6.25), var=3^2)
mean(x)
sd(x)
# Example of wrong parametrization
set.seed(1)
x <- rnbinom_new(n=1000, sd=3, var=3^2)
set.seed(1)
x <- rnbinom_new(n=1000, mu=10, var=3^2)
## End(Not run)
[Package HelpersMG version 6.1 Index]