help mata mm_cebinomial()-------------------------------------------------------------------------------

Title

mm_cebinomial() -- Conditional expectation of a binomial distributedrandom variable

Syntax

real matrixmm_cebinomial(n,k,p)where

n:real matrix nk:real matrix kp:real matrix p

Description

mm_cebinomial()returns the expected value of a binomial distributed random variable conditional on the variable being equal tokor larger. That is,mm_cebinomial()returnsE(

X|X>=k)where

X~ B(n,p)and

nis the number of trials andpis the success probability.When

n,k, andpare not scalar,mm_cebinomial()returns element-by-element results.n,k, andpare required to be r-conformable (see help[M-6] glossary).

RemarksThe expectation of

X~ B(n,p) conditional onX>=kmay be written asE(

X|X>=k) =k+ [ P(X>=k+1) + ... + P(X=n) ] / P(X>=k)where P(

X>=k) is the probability ofkor more successes, which is computed asBinomial(n,k,p)(see[M-5] normal()).

Conformability

mm_cebinomial(n,k,p)requiresn,k, andpbe 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.

Diagnostics

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, ork>n) or ifnorkare non-integer.

Source codemm_cebinomial.mata

AuthorBen Jann, ETH Zurich, jann@soz.gess.ethz.ch

Also see