View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jerry W. Lewis Jerry W. Lewis is offline
external usenet poster
 
Posts: 837
Default calculating probabilty of x number of successes with multiple

"joeu2004" wrote:

Not to beat a dead horse and certainly not to promote this approach
more than it deserves (which is simply in the genre of quick-and-dirty
solutions), but it occurred to me that in the OP's original posting,
10 successes in 21 trials was merely an example, and iandjmsmith's
excellent "xtestc3" function provides the generality to solve any K-in-
N problem. So I wondered how much more effort it would take to hack a
general solution along the same (inelegant) lines of generating all
combinations.


I would still argue for the probability generating function as the simplest,
most elegant, and most general solution. In Maxima, only 2 lines of code are
required

p:[2,4,9,6,5,4,7,3,1,5,6,7,9,1,2,2,2,5,6,7,9]/10;
expand(product( 1-p[i]+p[i]*t, i,1,length(p)));

which returns a polynomial in t, where Pr(X=k) is the coefficient of t^k.
This also extends immediately to more complicated probability models as
described in the wikipedia article cited in my original post.

Jerry