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
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
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
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
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
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
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
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")
.