stable
dist_negative_binomial(size, prob)
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.
probability of success in each trial. 0 < prob <= 1
.
A generalization of the geometric distribution. It is the number
of failures in a sequence of i.i.d. Bernoulli trials before
a specified number of successes (size
) occur. The probability of success in
each trial is given by prob
.
We recommend reading this documentation on https://pkg.mitchelloharawild.com/distributional/, where the math will render nicely.
In the following, let prob
= size
=
Support:
Mean:
Variance:
Probability mass function (p.m.f):
Cumulative distribution function (c.d.f):
Too nasty, omitted.
Moment generating function (m.g.f):
# NOT RUN {
dist <- dist_negative_binomial(size = 10, prob = 0.5)
dist
mean(dist)
variance(dist)
skewness(dist)
kurtosis(dist)
generate(dist, 10)
density(dist, 2)
density(dist, 2, log = TRUE)
cdf(dist, 4)
quantile(dist, 0.7)
# }
Run the code above in your browser using DataLab