Binomial Probability Distribution
|
05-24-2015, 05:58 PM
(This post was last modified: 05-26-2015 03:46 PM by Dave Britten.)
Post: #1
|
|||
|
|||
Binomial Probability Distribution
This program calculates the odds of a specified number of successes from independent trials with a known probability of success.
This requires a combinations function named COMB that calculates nCr. If you need one, see here for a few options. Inputs: t: Number of trials z: Individual probability of success y: Minimum number of successes x: Maximum number of successes Probability will be returned to x. Example: What is the probability of obtaining at least two even numbers when rolling five standard 6-sided dice? 5 ENTER .5 ENTER 2 ENTER 5 XEQ BINPR Result: 0.8125 (81.25%) Edit: Rewritten with Dieter's suggested optimizations. It's a bit longer, but faster. I'm sure there's still room for more elegant stack/register use here. I'll wait until those shake out before I pencil the new listing into my Moleskine. Running it with inputs 120, 1/6, 40, 120 yields 6.419629920E-6 in just over a minute. Compare to the version on my 48 using a direct summation of terms and repeated COMB calls returning 6.4196298769E-6. That's an error of 6.71E-7%, which isn't a terrible sacrifice for having the program finish inside of a lunar cycle (or possibly solar orbit) now. Code: t: Number of trials |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Binomial Probability Distribution - Dave Britten - 05-24-2015 05:58 PM
RE: Binomial Probability Distribution - Dieter - 05-25-2015, 09:51 PM
RE: Binomial Probability Distribution - Dave Britten - 05-25-2015, 10:11 PM
RE: Binomial Probability Distribution - Dieter - 05-25-2015, 10:38 PM
RE: Binomial Probability Distribution - Dave Britten - 05-25-2015, 10:51 PM
RE: Binomial Probability Distribution - Dave Britten - 05-26-2015, 03:47 PM
RE: Binomial Probability Distribution - Dieter - 05-27-2015, 12:51 PM
RE: Binomial Probability Distribution - Dieter - 05-26-2015, 10:38 PM
RE: Binomial Probability Distribution - Dave Britten - 05-28-2015, 01:44 AM
RE: Binomial Probability Distribution - Dieter - 05-28-2015, 11:11 AM
|
User(s) browsing this thread: 4 Guest(s)