[comp.sys.handhelds] Another ROM Rev D Bug

gschmitt@i50s8.ira.uka.de (G.Schmitt) (03/08/91)

BINS BUG in Revision D ROM

The "bug" (if it really is one, but to me it seems so) I want to describe here has
probably been announced before. It concerns the BINS algorithm on page 2 of the STATISTIC menu. I noticed the error doing some statistic stuff with measurement data. The easiest way to explain is to give a short example showing the same error effect.

Consider the folowing example:
Create a statistical matrix (which is a vector in this special case) containing only the
5 integer values    
		  1  2  3  4  5 .

Now try the following argument sequence for BINS:

	2	as the minimal x-value in level 3
	1	as the class width in level 2
	3	as the number of classes you want in level 1.

This means a division into 3 classes:


        1		|   2   |   3   |   4   |		5

lower outside          3 classes with 1 value each           upper outside value.
value


Performing the BINS routine now yields the two vectors (a matrix and a vector)

	[ [1] [1] [2] ]		the class frequencies and

	[1 0]			the frequencies outside, which is not the correct result I 										     think.

I expected the following as the correct result:

	[ [1] [1] [1] ]		and

	[1 1].


The problem always arises if the first upper outside value (the value 5 in the former example) lies on the edge of the last class (the effect is independent of class width of course). A repetition of the above example with the slight modification of writing the integer value 6 instead of the 5 in the statistical matrix gives the correct result

	[ [1] [1] [1] ]		and

	[1 1].


The bug (if it really is one; what says the statistic expert?) is easy to fix.
Repeating the example with the first statistical matrix, which showed the error effect
(1 2 3 4 5) but with the following parameters for BINS:

	1.5	(or any other value near but smaller than 2, the originally intended minimal 										    x-value)
	1	as class width

	3	as the number of classes

yields the correct result.


The above handling also works with non integer values of course, as long as the numbers you
deal with, don`t claim the full fractional range of the HP for their representation.
Would be interesting to hear from a REV E owner, whether or not the same effect occurs on his machine.

Gerard

dianab@hpcvra.cv.hp.com. (Diana Byrne) (03/12/91)

BINS was designed to treat the interval from xmin to xmax on the real
number line as a CLOSED interval (where xmax = xmin + width * N).

Thus, it divides the interval into N-1 half-open intervals of the form
{x : xi <= x < xi+width} and 1 closed interval {x : xmax-width <= x <= xmax}.
xmax is included in the last interval.

Your example can be depicted as follows:

      [----)[----)[----]
1     2     3     4    5
     xmin             xmax


xmin=2, width=1, N=3, xmax=5, there is one value (1) which is less than xmin 
and no values which are greater than xmax.