FW: Re: [SPSSX-L] Rounding in different SPSS Versions

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FW: Re: [SPSSX-L] Rounding in different SPSS Versions

SPSS Support
Re: Re: [SPSSX-L] Rounding in different SPSS Versions
I've been trying to get this response posted since Friday morning. Acting on Jean Snow's (the list administrator) advice I'm trying it having deleted some of the header information from prior notes.
 
 
Yes, the FUZZBITS option was added in Release 17. In releases 11-16, if you want the same results as you got on releases up through 10, which all used the native Fortran rounding function DNINT without any adjustments, equivalent to using 0 bits for fuzz, you can use the following expression in place of RND to round non-negative values of a variable x:

compute x_rounded = trunc(x) + (x - trunc(x) >= .5).

 

If the numbers involved can be negative, then you can use:

compute x_rounded = ((-1)**(x < 0)) * (trunc(abs(x)) + (abs(x) - trunc(abs(x)) >= .5).

 

The second expression simply replicates the first on absolute values of x and then multiplies them by -1 if the original number was negative and 1 if it wasn't.

 

To Richard Ristow's question about changes over versions, general computations haven't changed, but the RND and TRUNC functions, which used simply the native Fortran functions with no fuzz accomodations, have been changed multiple times. In releases up through 10, SPSS used those native functions unaltered. That meant that the internal binary floating point number was compared with the cutpoint x.5 or x.0, for RND or TRUNC, and if it was less than the cutpoint, the rounding or truncation went down. Nothing was done to accomodate the possibility that the computed number was slightly smaller due to precision issues. We got many complaints from people who had numbers rounding down that would have rounded up if computed with infinite precision.So beginning with Release 11, we tried to accomodate those concerns.

In Releases 11-16 you have several different attempts to accomodate complaints and expectations about rounding behavior, all of which essentially boiled down to us chasing our tails, as it's impossible to implement a solution that will produce what everyone wants under all circumstances. So in Release 17 we added the FUZZBITS option, assigning what we think is a reasonable default, and giving the user the ability to control things.

The bottom line on this is that any time you make equality comparisons involving numbers computed using finite precision, you need to be careful. The loss of precision typically associated with computations in SPSS/PASW Statistics and other packages is typically small and inconsequential for most purposes, but when you impose cutpoints or make equality comparisons, it matters and you have to be careful.

David Nichols


On Behalf Of Peck, Jon
Sent: Thursday, June 25, 2009 10:21 AM
Subject: Re: [SPSSX-L] Rounding in different SPSS Versions

Sorry, but I don't know the answer.  I'd guess that the info in the help for the oldest version it discusses would be the closest.

Bear in mind that as cpu's, compilers, algorithms, and code change over time, it is common for output values to change slightly - usually for the better,i.,e., more accuracy.

This is especially true for the floating point numbers used in scientific computation.

Also, if you want slightly different rounding behavior from rnd in v15, you can just add or subtract a tiny value to the argument.

HTH,
Jon

----- Original Message -----
Sent: Thu Jun 25 09:16:53 2009
Subject:      Re: [SPSSX-L] Rounding in different SPSS Versions

Thanks Jon,

Unfortunately, I'm running SPSS 15, and the fuzzbits option only came out in
v17 right?  If I set the fuzzbits to 0, would it produce the same results as
versions 10 and below?  Or is v6 so old, nobody knows :)