The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

weird statistics bug in wp34s
Message #1 Posted by Andrew Nikitin on 19 June 2013, 1:20 a.m.

Statistics subsystem does not like certain numbers in Y. For example,

350.33050223 ENTER 
3.265 [+/-] [EEX] 10 [+/-]
[+]
Cl[SIGMA]
1 [SIGMA]+
2 [SIGMA]+
3 [SIGMA]+
4 [SIGMA]+
5 [SIGMA]+
[g] [5]
Attempt to calculate s (standard deviation) gives domain error. This time, the effect is reproducible on emulator.

This is highly number-specific. Many numbers are breaking it, but many numbers pass through. Without that -3.265E-10 it does not give error.

      
Re: weird statistics bug in wp34s
Message #2 Posted by Walter B on 19 June 2013, 1:52 a.m.,
in response to message #1 by Andrew Nikitin

FWIW, it does return 1.581 and not give any error on the real thing (2.2 2738).

d:-)

      
Re: weird statistics bug in wp34s
Message #3 Posted by Paul Dale on 19 June 2013, 2:02 a.m.,
in response to message #1 by Andrew Nikitin

For each accumulation you made, the value in Y was unchanged so sy should be zero.

However, the problem is due to a rounding error during the calculation of sy. Sigma y2 - n * (sigma y)2 ends up being slightly negative.

I'd have preferred to use the robust formulas for this but was hamstrung by the need for backwards compatibility.

I've committed a fix which will be in the next firmware revision.

- Pauli

Edited: 19 June 2013, 2:08 a.m.

            
Re: weird statistics bug in wp34s
Message #4 Posted by Andrew Nikitin on 19 June 2013, 7:44 a.m.,
in response to message #3 by Paul Dale

And what are the robust formulas? And why they are not backward compatible?

                  
Re: weird statistics bug in wp34s
Message #5 Posted by Paul Dale on 19 June 2013, 5:24 p.m.,
in response to message #4 by Andrew Nikitin

Formulas for variance. Specifically, the on-line algorithm.

Recovering the various summation terms we had to support isn't trivial -- people expect the usual sums: x, x2, y, y2, xy and all the logarithmic variations. Far easier to just use the traditional method, albeit in double precision for some of the summations.

- Pauli

                        
Re: weird statistics bug in wp34s
Message #6 Posted by Namir on 20 June 2013, 1:54 p.m.,
in response to message #5 by Paul Dale

Thanks for the link Paul. I have been looking for robust algorithms to calculate the mean and standard deviation.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall