Post Reply 
WP 34S binomial bug?
05-01-2015, 05:12 AM
Post: #1
WP 34S binomial bug?
When entering binomial upper tail calculations, I get 1.0 for success=0 which is expected, but also 1.0 for successes=1 for k trials where k>2+. For example, rolling a 6 sided die 6 times, I correctly get binomial upper for 2 or more success as ~.26, but for 1 or more success, it comes up with 1 instead of ~.6 This is on version 3.3.3774, same on iPad 3.3T.3775
Find all posts by this user
Quote this message in a reply
05-01-2015, 05:28 AM
Post: #2
RE: WP 34S binomial bug?
I meant that the correct answer for 1 or more successes would be ~.66 for tossing a 6 sided die.
Find all posts by this user
Quote this message in a reply
05-01-2015, 05:59 AM
Post: #3
RE: WP 34S binomial bug?
Yep, a bug. Fix committed. Will need a new build at some point.

- Pauli
Find all posts by this user
Quote this message in a reply
05-01-2015, 10:09 AM
Post: #4
RE: WP 34S binomial bug?
(05-01-2015 05:59 AM)Paul Dale Wrote:  Will need a new build at some point.

Done.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
05-01-2015, 03:43 PM
Post: #5
RE: WP 34S binomial bug?
Marcus & Paul;
That is simply amazing: A bug identified by a member, fixed, and new build done in four and a half hours, by people living in different hemispheres of the globe, in the middle of my night. When people say "In a perfect world......" this is what they are talking about. Corporations making a profit on their products should emulate you guys.
I'm looking forward to when Eric & Richard get you the 43 , even if it's only in that mylar slipcase at first. The original trinity, I'm sure with input from Jonathan, Sanjeev, bit, and others, will make THE perfect calculator.

Then of course, the rest of us will start modifying it and putting Eric Rechin's stickers all over it because that one thing wasn't just exactly perfect.
It's not OCD if it needs to be done.
Find all posts by this user
Quote this message in a reply
05-02-2015, 10:18 PM (This post was last modified: 05-02-2015 11:46 PM by BarryMead.)
Post: #6
RE: WP 34S binomial bug?
I did a complete "Electronic" search of my up-to-date personalilzed WP-34s PDF manual version 3.3 and discovered that NOWHERE does the manual define the upper bound statistical/probability functions like "Binomu". It describes all of the other probability functions like "Bionom", "Binomp", "Binom-1", and even shows the mathematical formula for each of them, but completely ignores "Binomu" the "Binomial Upper Bound" calculation, what it does, and how it is computed. I would think that this function should be explained in the manual like all of the others? The same omission occurs in the Cauch, Expon, F, LogNrm, Logis, Norml, Poiss, Poisλ, and t probability functions. Perhaps to those who use statistical/probability functions every day, this "upper bound" stuff is obvious/boring, but to me it was not. Does anyone have an explanation as to why the "probabilityu" definitions/formulas were omitted from the manual? I would think that if it is important enough to put in the CALCULATOR, it would also be worth mentioning in the MANUAL. If there is a lot of similarity between the upper bound calculations among the variety of probability functions then perhaps it would only need to be defined for one of these functions with a reference (see Binom), but I found NOTHING about any of the upper bound calculations ANYWHERE in the manual. I don't want this so sound like a complaint, just a helpful suggestion as to how the manual could be improved in the future.
Find all posts by this user
Quote this message in a reply
05-02-2015, 11:15 PM
Post: #7
RE: WP 34S binomial bug?
I had to deduce this.

It seems that Normalu = 1 - Normal.
Find all posts by this user
Quote this message in a reply
05-02-2015, 11:35 PM (This post was last modified: 05-02-2015 11:50 PM by BarryMead.)
Post: #8
RE: WP 34S binomial bug?
(05-02-2015 11:15 PM)CR Haeger Wrote:  I had to deduce this.

It seems that Normalu = 1 - Normal.

That rule may hold true for the Normalu function, but not for Binomu.

(1 - Binom) is not equal to Binomu

Binom 1 (with .166666 J, 6 K) = .736, and Binomu 1 (with .166666 J and 6 K) = .665 ..... (1 - .736) is .263 not .665 so that rule does not work for Binom.

So that general rule clearly does not apply to all probability functions.
Find all posts by this user
Quote this message in a reply
05-03-2015, 12:24 AM
Post: #9
RE: WP 34S binomial bug?
(05-02-2015 10:18 PM)BarryMead Wrote:  Does anyone have an explanation as to why the "probabilityu" definitions/formulas were omitted from the manual? I would think that if it is important enough to put in the CALCULATOR, it would also be worth mentioning in the MANUAL.

Walter is on Vacation for some time, it will likely have to wait for his return to know why it was omitted, and to hopefully have it added for future printings.

In the interim, perhaps someone that knows how these items are defined could provide them here for others to reference?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-03-2015, 01:10 AM
Post: #10
RE: WP 34S binomial bug?
The upper functions are the probability that the distribution is greater than or equal to the given argument.

Binom returns the probability for less than or equal to the given value from X.
Binomu returns the probability for greater than or equal to the given value from X.

For continuous distributions ABCDu = 1 - ABCD, although they are not computed this way for accuracy reasons. For discrete distributions this relationship doesn't hold for integral arguments since the argument's probability is counted both ways.


- Pauli
Find all posts by this user
Quote this message in a reply
05-03-2015, 01:41 AM (This post was last modified: 05-03-2015 02:45 AM by BarryMead.)
Post: #11
RE: WP 34S binomial bug?
(05-03-2015 01:10 AM)Paul Dale Wrote:  The upper functions are the probability that the distribution is greater than or equal to the given argument.

Binom returns the probability for less than or equal to the given value from X.
Binomu returns the probability for greater than or equal to the given value from X.

For continuous distributions ABCDu = 1 - ABCD, although they are not computed this way for accuracy reasons. For discrete distributions this relationship doesn't hold for integral arguments since the argument's probability is counted both ways.


- Pauli
Thanks for clearing up some of the mud for me. Now all I need to know is which distributions are "Discrete" and which are "Continuous". From tested case values, I would guess that Binom is discrete, and Norml is continuous, but what about the others?
Find all posts by this user
Quote this message in a reply
05-03-2015, 03:17 AM
Post: #12
RE: WP 34S binomial bug?
(05-03-2015 01:41 AM)BarryMead Wrote:  Thanks for clearing up some of the mud for me. Now all I need to know is which distributions are "Discrete" and which are "Continuous". From tested case values, I would guess that Binom is discrete, and Norml is continuous, but what about the others?

I'd posit that if you don't know which is which, you really shouldn't be using them Smile These aren't functions you can just sit down and use blindly, you need some degree of understanding. That's true for pretty much all functions of course, there isn't anything special about these.

It is easy to find out which are discrete.

Binomial, Poisson & geometric are discrete, the rest are continuous.


- Pauli
Find all posts by this user
Quote this message in a reply
05-03-2015, 04:09 AM
Post: #13
RE: WP 34S binomial bug?
(05-03-2015 03:17 AM)Paul Dale Wrote:  Binomial, Poisson & geometric are discrete, the rest are continuous.
Thanks, Pauli, I added one more for completeness.

Binomial, Poisson, Poissonλ, and Geometric are discrete, the rest are continuous.
Find all posts by this user
Quote this message in a reply
05-03-2015, 05:10 AM
Post: #14
RE: WP 34S binomial bug?
Poisson & Poissonλ are one and the same distribution.


Pauli
Find all posts by this user
Quote this message in a reply
05-03-2015, 07:23 AM
Post: #15
RE: WP 34S binomial bug?
(05-03-2015 05:10 AM)Paul Dale Wrote:  Poisson & Poissonλ are one and the same distribution.

Pauli
After carefully reading Appendix I it is obvious that Poisson and Poissonλ are the same distribution handling the input parameters slightly differently. When I initially scanned through the "prob" catalog entries, they appeared to be two separate functions. That is why for "Completeness" I posted the previous comment including Poissonλ as one of the discrete probability functions. If that annoyed anyone, I am sincerely sorry.
Find all posts by this user
Quote this message in a reply
05-03-2015, 01:17 PM (This post was last modified: 05-03-2015 01:18 PM by Dieter.)
Post: #16
RE: WP 34S binomial bug?
(05-03-2015 12:24 AM)rprosperi Wrote:  In the interim, perhaps someone that knows how these items are defined could provide them here for others to reference?

Pauli already noted the essential point, but let me add a more general explanation.

The cumulative distributions calculate the probability that the random variable is ≤ a given value (Norml, Binom, Poiss etc.) resp. that it's ≥ this value (Normlu, Binomu, Poissu etc.). The suffix u was chosen since the result mathematically is the upper tail integral (resp. the upper sum) of the probability density/mass function.

If the random variable is continuous (i.e. it can have real values like 3.7 or –1.638) the lower integral is bounded by –infinity and x, and the upper integral is bounded by x and +infinity. Both sum up to 1, so e.g. Normlu(x) = 1 – Norml(x).

If the random variable is discrete its can take only integer values: a random experiment may have three or four successes, but not 3.74. Here the lower CDF (Binom, Poiss etc.) is the sum of the probabilities for 0, 1, 2, .... x successes, while the upper CDF (Binomu, Poissu etc.) is the sum for x, x+1, x+2, ... n successes. You see that the probabilty for exactly x successes occurs in both sums, so they do not sum up to 1. However Binom(x) + Binomu(x+1) = 1. In other words: the probabilty for "up to 4 successes" is 1 – the probability for "5 and more successes".

Re. Poiss and Poissλ: Yes, the former version (with two parameters whose product is λ again) actually is less common, and it could have been omitted. The one-parameter Poissλ is the usual way the Poisson distribution is defined. I learned the two-parameter version was included because this way it could be used with the same parameters (p and n) as the Binomial distribution. Since for large n and small p the Binomial approaches the Poisson distribution I do not see much sense in this, but I don't think this will get changed.

BTW Pauli: I am still working on the Poisson and Binomial quantile functions, and I think they work quite well now. At least they are more accurate and faster than the current code, and they work even in some border cases. Which does not mean they are perfect. ;-) The complete code for both cases now has 260 lines. This includes real results. I think I'll find some time later this month to take a closer look at this so that the 34s may get an update. In this case Walter will have to update the manual because there is a new feature that allows both integer and real results for the quantile (user selectable by setting a flag).

Dieter
Find all posts by this user
Quote this message in a reply
05-03-2015, 06:19 PM (This post was last modified: 05-04-2015 05:36 AM by BarryMead.)
Post: #17
RE: WP 34S binomial bug?
The cumulative distributions calculate the probability that the random variable is ≤ a given value (Norml, Binom, Poiss etc.). The upper variants calculate the probability that the random value is ≥ the given value (Normlu, Binomu, Poissu etc.). The suffix u was chosen since the result mathematically is the upper tail integral of the probability function.

If the distribution is continuous (i.e. it can have real values like 3.7 or –1.638) the lower integral is bounded by –infinity and x, and the upper integral is bounded by x and +infinity. Both sum up to 1, so e.g. Normlu(x) = 1 – Norml(x).

If the distribution is discrete it can take only integer values: a random experiment may have three or four successes, but not 3.74. Here the lower CDF (Binom, Poiss etc.) is the sum of the probabilities for 0, 1, 2, .... x successes, while the upper CDF (Binomu, Poissu etc.) is the sum for x, x+1, x+2, ... n successes. The probabilty for exactly x successes occurs in both cases, so the upper and lower probabilities do not sum up to 1. However Binom(x) + Binomu(x+1) = 1. The Binom, Poiss (Poissλ), and Geom distributions operate on discrete random variables, while the rest operate on continuous random values. Throughout Appendix I, the distribution plots show dots along the curve for the discrete distributions and smooth lines for the continuous distributions.


If the paragraph above (or something similar) were included in Appendix I of the manual as part of the explanation of the first (Binom) distribution, that would completely answer all of the questions I had about the probability distribution functions. Thank you ever so much Dieter, Pauli ,Walter and lrdheat for constantly improving the WP-34s and its documentation.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)