macro binomial x n p bxnp #Example call: # mtb> %binomial 3 20 0.10 k1 #Mathews and Malnar, Statistical Trainers and Consultants #217 Third Street, Fairport Harbor, OH 44077 #440-350-0911 pmathews@apk.net mconstant x n p bxnp i comb if (x<0) or (x>n) let comb=0 elseif x=0 let comb=1 else let comb=1 do i=1:x let comb=(n+1-i)/(x+1-i)*p*comb # print comb enddo endif let bxnp=comb*(1-p)**(n-x) endmacro