mm_cebinomial() -- Conditional expectation of a binomial distributed random variable
real matrix mm_cebinomial(n, k, p)
n: real matrix n k: real matrix k p: real matrix p
mm_cebinomial() returns the expected value of a binomial distributed random variable conditional on the variable being equal to k or larger. That is, mm_cebinomial() returns
X ~ B(n, p)
and n is the number of trials and p is the success probability.
When n, k, and p are not scalar, mm_cebinomial() returns element-by-element results. n, k, and p are required to be r-conformable (see help [M-6] glossary).
The expectation of X ~ B(n, p) conditional on X>=k may be written as
E(X|X>=k) = k + [ P(X>=k+1) + ... + P(X=n) ] / P(X>=k)
where P(X>=k) is the probability of k or more successes, which is computed as Binomial(n, k, p) (see [M-5] normal()).
mm_cebinomial(n,k,p) requires n, k, and p be r-conformable (see help [M-6] glossary). Returned is a matrix of max(argument rows) rows and max(argument columns) columns containing element-by-element calculated results.
mm_cebinomial() returns missing if any of the arguments are missing.
mm_cebinomial() returns missing if arguments are out of range (p>1, p<0, n<=0, k<0, or k>n) or if n or k are non-integer.
Ben Jann, ETH Zurich, firstname.lastname@example.org