(HP-65) Binomial distribution with large input support
|
01-05-2020, 06:37 PM
(This post was last modified: 01-05-2020 06:49 PM by Dave Britten.)
Post: #1
|
|||
|
|||
(HP-65) Binomial distribution with large input support
This program calculates the binomial probability mass function, or cumulative binomial probabilities, with support for large (>69) numbers of trials. To do this, it uses Nemes' formula to approximate ln(x!) rather than calculating x! directly and overflowing.
Recommended Key Labels A: CALC E: ln(x!) Usage There weren't enough steps left for a fancy user interface, so inputs must first be stored directly into R1-R4 before running the program. Store these values: R1: n - number of trials R2: p - percentage of success on a single trial R3: xmin - minimum number of successes R4: xmax - maximum number of successes Then press A to calculate the probability mass/cumulative probability. If xmin=xmax, the program calculates the probability mass for that value of x. If xmax>xmin, then the program calculates cumulative probability for the specified range of x values. If xmin>xmax, or xmax>n, you'll get an error. Note that Nemes' formula is an approximation, which means this program produces approximate results. Accuracy improves with larger inputs, but the worst-case scenario appears to be about 4 digits of accuracy (e.g. n=2, p=0.5, xmin=0, xmax=2 yields about 100.037%). So it's no worse than a slide rule! Probability mass is calculated in constant time - about 10 seconds - and a cumulative probability with xmax-xmin=10 takes about 30 seconds. Execution time in seconds can be estimated using 10 + 2(xmax - xmin). Also, you can press E to calculate ln(x!). Example If you roll a fair six-sided die 4000 times, what are the odds that you will get any given result between 662 and 672 times? (The mean of this distribution is 666.67.) 4000 STO 1 6 g 1/x STO 2 662 STO 3 672 STO 4 A: 0.1844 There is approximately an 18.44% chance that any specific result will be rolled between 662 and 672 times. Code: RCL 1 34 01 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(HP-65) Binomial distribution with large input support - Dave Britten - 01-05-2020 06:37 PM
RE: (HP-65) Binomial distribution with large input support - Thomas Klemm - 06-25-2022, 08:42 PM
RE: (HP-65) Binomial distribution with large input support - Thomas Klemm - 06-26-2022, 08:30 AM
|
User(s) browsing this thread: 1 Guest(s)