(27S) Probability Formulas - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (27S) Probability Formulas (/thread-8458.html) |
(27S) Probability Formulas - Dave Britten - 06-05-2017 02:19 PM Note: These should also work on the 19B and palmtops (95LX/100LX/200LX). The 17B lacks the COMB function needed for several of these, but it can make use of Balls & Urns, and Birthday Paradox. All example results are displayed as in FIX 6. Binomial Probability Distribution Code: 0*(N+P1+MIN+MAX)+Σ(X:MIN:MAX:1:COMB(N:X)*P1^X*(1-P1)^(N-X))=ΣP Calculates the total probability of achieving a number of successes within a desired range from a fixed number of independent trials with known probability of success. Variables: N - Number of trials P1 - Probability of success for a single trial MIN - Minimum desired number of successes MAX - Maximum desired number of successes Enter the above four variables, and solve for ΣP. MIN and MAX may be set equal to each other to calculate the probability of a specific number of successes. Example: I roll a fair, six-sided die 10 times. What is the percent chance that I get a 6 at least 4 times? 10 {N} 1÷6 {P1} 4 {MIN} 10 {MAX} {ΣP} 0.069728 (i.e. 6.9728%) Negative Binomial Probability Distribution Code: Σ(X:IF(NEED>MIN:NEED:MIN):MAX:1:COMB(X-1:NEED-1)*P1^NEED*(1-P1)^(X-NEED))=ΣP Calculates the total probability of achieving a set number of successes in an indefinite number of independent trials, continuing until the desired number of successes has been reached. Variables: NEED - Target number of successes MIN - Minimum number of trials MAX - Maximum number of trials P1 - Probability of success for a single trial Enter the above four variables, then solve for ΣP. MIN may be set equal to NEED if you don't want a lower bound on the number of trials, i.e. compute the probability of any number of trials less than or equal to MAX. MIN and MAX may be set equal to calculate the odds of finishing at a specific number of trials. Example: I will keep rolling a die until I've gotten a 6 four times. What is the percent chance that I will be finished within 20 rolls? 4 {NEED} 4 {MIN} 20 {MAX} 1÷6 {P1} {ΣP} 0.433454 (i.e. 43.3454%) Hypergeometric Probability Distribution Code: 0*(POP+GOOD+SAM+MIN+MAX)+Σ(X:MIN:MAX:1:COMB(POP-GOOD:SAM-X)*COMB(GOOD:X)÷COMB(POP:SAM))=ΣP In repeated trials of sampling without replacement what are the odds of achieving a target number of successes? Variables: POP - Population size GOOD - Number of items among the population considered to be a success SAM - Number of trials/samples MIN - Minimum number of successes MAX - Maximum number of successes Enter the above five variables, and solve for ΣP. As in the binomial probability distribution formula, MIN and MAX may be set equal to test a specific number of successes rather than a range. Example: From a shuffled deck of 52 standard playing cards, I will draw 6 cards. What is the percent chance that at least 2 of them are face cards? 52 {POP} 12 {GOOD} (Three face cards in each of four suits.) 6 {SAM} 2 {MIN} 6 {MAX} {ΣP} 0.423609 (i.e. 42.3609%) Balls & Urns (Also sometimes called Stars & Bars) Code: COMB(U+B-(1*ZER?):B-1+ZER?)=C How many ways are there to sort a given number of indistinct items into a given number of distinct categories? Variables: U - Number of urns (categories) B - Number of balls (items) ZER? - Allow categories with zero items? (1 for yes, 0 for no) Enter the above three variables and solve for C. Example: How many different combinations can be rolled with 5 six-sided dice? Note that 1,1,1,2,2 is equivalent to 2,1,2,1,1, and that some combinations will be more likely to occur than others. 6 {U} 5 {B} 1 {ZER?} {C} 330.000000 Birthday Paradox Code: 0*L(T:1)*Σ(C:1:N-1:1:L(T:(P-C)÷P*G(T)))+1-G(T)=PCOL When sampling with replacement from a fixed pool of items, what are the odds that an item will be taken more than once? (e.g. What are the odds that at least two people in a room of 25 will share the same birthday?) Variables: N - Number of samples P - Population size (i.e. number of items to choose from) Enter the above two variables, and solve for PCOL (probability of at least one collision). Example: Assuming a uniform distribution of birthdays among the population, and ignoring Feb. 29, what is the percent chance that, in a room of 26 people, at least two people will share the same birthday? 26 {N} 365 {P} {PCOL} 0.598241 (i.e. 59.8241%) RE: (27S) Probability Formulas - rprosperi - 06-05-2017 10:32 PM Thanks for sharing these Dave, any opportunity to play with a 27S is worthwhile (something not often said about an Algebraic machine; 10BII+ is another exception). One minor suggestion for these is to include a sample problem with answer to quickly verify the equation is entered correctly. This is often not needed, but the incredibly arcane syntax of the Pioneer Solver makes it very easy to enter these incorrectly. RE: (27S) Probability Formulas - Dave Britten - 06-05-2017 11:01 PM I'm really impressed with how capable this 27S is so far. For a "non-programmable" algebraic, it can sure do a heck of a lot. I might even be able to get it to do quadratic regression with enough solver tricks. I'll add some more fleshed-out examples; these are pretty short formulas, but it's always reassuring to know you're getting the expected results. RE: (27S) Probability Formulas - rprosperi - 06-06-2017 02:39 AM I agree, it's a great machine, but I constantly hit [CLR] when looking for [EXIT] after so many years of using a 42S. The 27S nickname of the 'Do Everything Machine' is well deserved. If HP released the much rumored (back then) HP-27SII adding RPN (like they did with the 17B/17BII and 19B/19BII), this likely would have become my primary machine for years. No need to carry a 12C AND a 42S! RE: (27S) Probability Formulas - Dave Britten - 06-06-2017 12:24 PM (06-06-2017 02:39 AM)rprosperi Wrote: I agree, it's a great machine, but I constantly hit [CLR] when looking for [EXIT] after so many years of using a 42S. As a 48 user, I can sympathize. But I've used a 17BII enough that it doesn't take much effort to adjust. (06-06-2017 02:39 AM)rprosperi Wrote: The 27S nickname of the 'Do Everything Machine' is well deserved. If HP released the much rumored (back then) HP-27SII adding RPN (like they did with the 17B/17BII and 19B/19BII), this likely would have become my primary machine for years. No need to carry a 12C AND a 42S! It's too bad they didn't just make a 47S by taking the 42S and tacking on the solver, TVM/amort, RTC, and list editor, plus an additional 8 KB or so. Maybe it's time to fork off Free47. |