|
STK++ 0.9.13
|
NegativeBinomial probability law. More...
#include <STK_Law_NegativeBinomial.h>

Public Types | |
| typedef IUnivLaw< Integer > | Base |
Public Member Functions | |
| NegativeBinomial (int size=1, Real const &prob=0.5) | |
| constructor | |
| virtual | ~NegativeBinomial () |
| destructor | |
| Real const & | prob () const |
| int | size () const |
| void | setProb (Real const &prob) |
| void | setSize (Integer size) |
| virtual Integer | rand () const |
| virtual Real | cdf (Real const &t) const |
| compute the cumulative distribution function Give the probability that a NegativeBinomial random variate is less or equal to t. | |
| virtual Real | pdf (Integer const &x) const |
| compute the probability distribution function (density) Give the value of the pdf at the point x. | |
| virtual Real | lpdf (Integer const &x) const |
| compute the log probability distribution function Give the value of the log-pdf at the point x. | |
| virtual Integer | icdf (Real const &p) const |
| inverse cumulative distribution function The quantile is defined as the smallest value x such that F(x) >= p , where F is the cumulative distribution function. | |
Public Member Functions inherited from STK::Law::IUnivLaw< Integer > | |
| virtual | ~IUnivLaw () |
| Virtual destructor. | |
| virtual Real | lcdf (Real const &t) const |
| compute the lower tail log-cumulative distribution function Give the log-probability that a random variate is less or equal to t. | |
| virtual Real | cdfc (Real const &t) const |
| calculate the complement of cumulative distribution function, called in statistics the survival function. | |
| virtual Real | lcdfc (Real const &t) const |
| calculate the log-complement of cumulative distribution function Give the log-probability that a random variate is greater than t. | |
Public Member Functions inherited from STK::Law::ILawBase | |
| String const & | name () const |
Static Public Member Functions | |
| static Integer | rand (int size, Real const &prob) |
| static Real | pdf (Integer x, int size, Real const &prob) |
| compute the probability distribution function (density) Give the value of the pdf at the point x. | |
| static Real | lpdf (Integer x, int size, Real const &prob) |
| compute the log probability distribution function Give the value of the log-pdf at the point x. | |
| static Real | cdf (Real const &t, int size, Real const &prob) |
| compute the cumulative distribution function Give the value of the cdf at the point t. | |
| static Integer | icdf (Real const &p, int size, Real const &prob) |
| inverse cumulative distribution function The quantile is defined as the smallest value x such that F(x) >= p , where F is the cumulative distribution function. | |
Protected Attributes | |
| int | size_ |
| number of successes | |
| Real | prob_ |
| probability of success in a Bernoulli trial | |
Protected Attributes inherited from STK::Law::ILawBase | |
| String | name_ |
| Name of the Law. | |
Additional Inherited Members | |
Protected Member Functions inherited from STK::Law::IUnivLaw< Integer > | |
| IUnivLaw (String const &name) | |
| Constructor. | |
| IUnivLaw (IUnivLaw const &law) | |
| copy Constructor. | |
Protected Member Functions inherited from STK::Law::ILawBase | |
| ILawBase (String const &name) | |
| Constructor. | |
| ~ILawBase () | |
| destructor. | |
NegativeBinomial probability law.
In probability theory and statistics, the negative binomial distribution is a discrete probability distribution of the number of successes in a sequence of independent and identically distributed Bernoulli trials before a specified (non-random) number of failures (denoted r) occurs.
Suppose there is a sequence of independent Bernoulli trials, each trial having two potential outcomes called “success” and “failure”. In each trial the probability of success is p and of failure is (1 − p). We are observing this sequence until a predefined number r of failures has occurred. Then the random number of successes we have seen, X, will have the negative binomial (or Pascal) distribution: 
The probability mass function of the negative binomial distribution is
![\[
f(k; r, p) = \Pr(X = k) = \binom{k+r-1}{k} p^k(1-p)^r \quad\text{for }
k = 0, 1, 2, \dots
\]](form_248.png)
Definition at line 68 of file STK_Law_NegativeBinomial.h.
Definition at line 71 of file STK_Law_NegativeBinomial.h.
constructor
| prob,size | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 75 of file STK_Law_NegativeBinomial.h.
|
inlinevirtual |
compute the cumulative distribution function Give the probability that a NegativeBinomial random variate is less or equal to t.
| t | a real value |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 76 of file STK_Law_NegativeBinomial.cpp.
compute the cumulative distribution function Give the value of the cdf at the point t.
| t | a real value |
| size,prob | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 123 of file STK_Law_NegativeBinomial.cpp.
inverse cumulative distribution function The quantile is defined as the smallest value x such that F(x) >= p , where F is the cumulative distribution function.
| p | a probability number |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 85 of file STK_Law_NegativeBinomial.cpp.
inverse cumulative distribution function The quantile is defined as the smallest value x such that F(x) >= p , where F is the cumulative distribution function.
| p | a probability number |
| prob,size | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 132 of file STK_Law_NegativeBinomial.cpp.
compute the log probability distribution function Give the value of the log-pdf at the point x.
| x | a binary value |
Reimplemented from STK::Law::IUnivLaw< Integer >.
Definition at line 66 of file STK_Law_NegativeBinomial.cpp.
compute the log probability distribution function Give the value of the log-pdf at the point x.
| x | an integer value |
| prob,size | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 113 of file STK_Law_NegativeBinomial.cpp.
compute the probability distribution function (density) Give the value of the pdf at the point x.
| x | a binary value |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 57 of file STK_Law_NegativeBinomial.cpp.
compute the probability distribution function (density) Give the value of the pdf at the point x.
| x | an integer value |
| prob,size | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 103 of file STK_Law_NegativeBinomial.cpp.
Definition at line 81 of file STK_Law_NegativeBinomial.h.
References prob_.
Referenced by setProb().
|
virtual |
Implements STK::Law::IUnivLaw< Integer >.
Definition at line 48 of file STK_Law_NegativeBinomial.cpp.
| prob,size | probability of success and number of successes in a NegativeBinomial trial |
Definition at line 93 of file STK_Law_NegativeBinomial.cpp.
| prob | the probability of success to set |
Definition at line 85 of file STK_Law_NegativeBinomial.h.
References prob(), prob_, setProb(), and STKDOMAIN_ERROR_1ARG.
Referenced by setProb().
| size | the number of successes to set |
Definition at line 92 of file STK_Law_NegativeBinomial.h.
References setSize(), size(), size_, and STKDOMAIN_ERROR_1ARG.
Referenced by setSize().
|
inline |
Definition at line 83 of file STK_Law_NegativeBinomial.h.
References size_.
Referenced by setSize().
|
protected |
probability of success in a Bernoulli trial
Definition at line 172 of file STK_Law_NegativeBinomial.h.
|
protected |
number of successes
Definition at line 170 of file STK_Law_NegativeBinomial.h.