Binomial mean and variance
[M,V] = binostat(N,P)
[M,V] = binostat(N,P) returns
the mean of and variance for the binomial distribution with parameters
specified by the number of trials,
N, and probability
of success for each trial,
be vectors, matrices, or multidimensional arrays that have the same
size, which is also the size of
A scalar input for
expanded to a constant array with the same dimensions as the other
The mean of the binomial distribution with parameters n and p is np. The variance is npq, where q = 1 – p.
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
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).