<< distfun_nbinrnd Negative Binomial Noncentral F Distribution >>

distfun >> distfun > Negative Binomial > distfun_nbinstat

distfun_nbinstat

Negative Binomial mean and variance

Calling Sequence

M = distfun_nbinstat(R,P)
[M,V] = distfun_nbinstat(R,P)

Parameters

R :

a matrix of doubles, the number of successes. R belongs to the set {0,1,2,3,4,.......}

P :

a matrix of doubles, the probability of getting success in a Bernoulli trial. P in [0,1].

M :

a matrix of doubles, the mean

V :

a matrix of doubles, the variance

Description

Computes statistics from the Negative Binomial distribution.

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

The Mean and Variance of the Negative Binomial Distribution is:

\begin{eqnarray}
M &=& R \frac{1-P}{P} \\
V &=& R \frac{1-P}{P^2}
\end{eqnarray}

Examples

// Check with expanded R
R = [1 2 3 4 5]
P = 0.1
[M,V] = distfun_nbinstat(R,P)
me = [9.    18.    27.    36.    45.]
ve = [90.    180.    270.    360.    450.]

//Check with expanded P
R = 5
P = [0.1 0.2 0.3 0.4]
[M,V] = distfun_nbinstat(R,P)
me = [45.    20.    11.666667    7.5]
ve = [450.    100.    38.888889    18.75]

//Check with both R and P expanded
R = [1 2 3 4]
P = [0.1 0.2 0.3 0.4]
[M,V] = distfun_nbinstat(R,P)
me = [9.    8.    7.    6.]
ve = [90.    40.    23.333333    15.]

Bibliography

http://en.wikipedia.org/wiki/Negative_binomial_distribution

Authors


Report an issue
<< distfun_nbinrnd Negative Binomial Noncentral F Distribution >>