Previous: Hypergeometric Random Variable, Up: Functions and Variables for discrete distributions [Contents][Index]
The negative binomial distribution is a discrete probability distribution. Suppose we have a sequence of Bernoulli trials where each trial has two outcomes called “success” and “failure” where “success” occurs with probablity p and “failure” with probability 1-p. We observe the sequence until a predefined number r of sucesses have occurred. Then the number of failures seen will have a \({\it NegativeBinomial}(r,p)\) distribution.
Returns the value at x of the probability function of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The pdf is $$ f(x; n, p) = {x+n-1 \choose n-1} (1-p)^xp^n $$
Returns the value at x of the distribution function of a \({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number.
The cdf is $$ F(x; n, p) = I_p(n,\lfloor x \rfloor + 1) $$
where \(I_p(a,b)\) is the beta_incomplete_regularized function.
(%i1) load ("distrib")$
(%i2) cdf_negative_binomial(3,4,1/8); 3271 (%o2) ------ 524288
Returns the q-quantile of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number; in other words, this is the inverse of cdf_negative_binomial
. Argument q must be an element of [0,1]. To make use of this function, write first load("distrib")
.
Returns the mean of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The mean is $$ E[X] = {n(1-p)\over p} $$
Returns the variance of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The variance is $$ V[X] = {n(1-p)\over p^2} $$
Returns the standard deviation of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The standard deviation is $$ D[X] = {\sqrt{n(1-p)}\over p} $$
Returns the skewness coefficient of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The skewness coefficient is $$ SK[X] = {2-p \over \sqrt{n(1-p)}} $$
Returns the kurtosis coefficient of a
\({\it NegativeBinomial}(n,p)\) random variable, with 0 < p \leq 1 and n a positive number. To make use of this function, write first load("distrib")
.
The kurtosis coefficient is $$ KU[X] = {p^2-6p+6 \over n(1-p)} $$
Returns a
\({\it NegativeBinomial}(n,p)\) random variate, with 0 < p \leq 1 and n a positive number. Calling random_negative_binomial
with a third argument m, a random sample of size m will be simulated.
Algorithm described in Devroye, L. (1986) Non-Uniform Random Variate Generation. Springer Verlag, p. 480.
To make use of this function, write first load("distrib")
.