| Statistics Toolbox | ![]() |
Mean and variance for the binomial distribution.
Syntax
[M,V] = binostat(N,P)
Description
[M,V] = binostat(N,P)
returns the mean and variance for the binomial distribution with parameters specified by N and P. Vector or matrix inputs for N and P must have the same size, which is also the size of M and V. A scalar input for N or P is expanded to a constant matrix with the same dimensions as the other input.
The mean of the binomial distribution with parameters n and p is np. The variance is npq, where q = 1-p.
Examples
n = logspace(1,5,5)
n =
10 100 1000 10000 100000
[m,v] = binostat(n,1./n)
m =
1 1 1 1 1
v =
0.9000 0.9900 0.9990 0.9999 1.0000
[m,v] = binostat(n,1/2)
m =
5 50 500 5000 50000
v =
1.0e+04 *
0.0003 0.0025 0.0250 0.2500 2.5000
See Also
binocdf, binofit, binoinv, binopdf, binornd
| binornd | bootstrp | ![]() |