Rounding in different SPSS Versions

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Rounding in different SPSS Versions

Mary-54
I am running the same code on two different versions of SPSS.  6 and 15, and
am getting different results, and was wondering if it was due to rounding.
I am using exactly the same data inputs.  I read somewhere that SPSS
internally has 15 decimal places used in calculation (vs. display).  Is
there any way to find out what each version is using, and how to change it
so they match?

Thanks,
Mary

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Art Kendall
please cut-and-paste snippets from the two outputs so we can better
understand what you are saying?

Art Kendall
Social Research Consultants

Mary wrote:

> I am running the same code on two different versions of SPSS.  6 and 15, and
> am getting different results, and was wondering if it was due to rounding.
> I am using exactly the same data inputs.  I read somewhere that SPSS
> internally has 15 decimal places used in calculation (vs. display).  Is
> there any way to find out what each version is using, and how to change it
> so they match?
>
> Thanks,
> Mary
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Mary-54
In reply to this post by Mary-54
Well there's a lot of code across many programs that calculates these
variables.  We are running the same exact code, using the same exact data.
Basically, we're running a bunch of calculations, and then at the end, using
the rnd() function.

I think what's happening is, over numerous calculations, the different
versions are rounding differently and the changes are compounding and
resulting in different values.

So for example:

SPSS 15 rnd(var1) = 438
SPSS 6  rnd(var1) = 437

And the SPSS 6 value seems to be always lower, although I'm not sure.

What I'm wondering is if anyone else has come across this, and if there's
anything that can be done about it?

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Richard Ristow
In reply to this post by Mary-54
At 03:07 PM 6/22/2009, Mary wrote:

I read somewhere that SPSS internally has 15 decimal places used in calculation (vs. display).  Is there any way to find out what each version is using, and how to change it so they match?

To respond to this side issue: For many releases, all SPSS versions have calculated using 53 bits. There isn't an internal 'number of [decimal] digits'.

But SPSS 6 is a very old release, and I wouldn't be surprised if it calculated in a different format. Richard Oliver? Anyone from SPSS, Inc.?

At 05:23 PM 6/22/2009, Francine added that she's seeing:

SPSS 15 rnd(var1) = 438
SPSS 6  rnd(var1) = 437

Try printing the *unrounded* values, with format F24.15. That will give you exactly how large the computed difference is.
======================
FAQ: Precision, range, and leading zeroes on SPSS numbers

SPSS numbers never 'have' leading zeroes. They don't have any decimal digits at all, zero or otherwise; they are binary numbers. They can be displayed with leading zeroes by using an N format, or by converting them to character string of the desired form.

SPSS, like SAS and many other programs, stores numbers and calculates in the 64-bit format defined in IEEE standard 754. (Such numbers are often called, simply, 'IEEE 754 numbers'.) The IEEE 754 format is well regarded; and most current computers do arithmetic on IEEE 754 numbers in hardware.

This format can represent numbers as large as about 10**308 can be represented, as can all integers from 0 through 9,007,199,254,740,992. (But not all larger integers can be represented. Identifying numbers with more than 15 digits should be stored as character strings.)

Its precision is 53 bits. That is very close to 16 decimal digits, but it is not the same; each format can represent some numbers that the other cannot. It is unwise to count on fractions that are mathematically equal being exactly equal after calculations.
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Arthur Burke
In reply to this post by Mary-54
Mary ... There may have been advances in estimation algorithms from 6
through 15 for what you're doing or changes to defaults, so some of the
differences you're seeing may be due to that.

Art
__________________________________________________
Art Burke
Northwest Regional Educational Laboratory
101 SW Main St, Suite 500
Portland, OR 97204-3213

-----Original Message-----
From: Mary [mailto:[hidden email]]
Sent: Monday, June 22, 2009 12:07 PM
To: [hidden email]
Subject: Rounding in different SPSS Versions

I am running the same code on two different versions of SPSS.  6 and 15,
and am getting different results, and was wondering if it was due to
rounding.
I am using exactly the same data inputs.  I read somewhere that SPSS
internally has 15 decimal places used in calculation (vs. display).  Is
there any way to find out what each version is using, and how to change
it so they match?

Thanks,
Mary

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list
of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Mary-54
In reply to this post by Mary-54
Thanks for all your help.  I definitely think that there are differences
between the two versions, at least using the RND function.

Looking at our data, we found out that each version was rounding
differently.  I have no idea why it does that, but we ended up eliminating
the RND function and now our results match.

Thanks again~

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Peck, Jon
Look at the Data tab of Edit>Options in v17.  You will see a "fuzz bits" setting that applies to RND and TRUNC.  Here is part of the help text.

Rounding and Truncation of Numeric Values. For the RND and TRUNC functions, this setting controls the default threshold for rounding up values that are very close to a rounding boundary. The setting is specified as a number of bits and is set to 6 at install time, which should be sufficient for most applications. Setting the number of bits to 0 produces the same results as in release 10. Setting the number of bits to 10 produces the same results as in releases 11 and 12.

* For the RND function, this setting specifies the number of least-significant bits by which the value to be rounded may fall short of the threshold for rounding up but still be rounded up. For example, when rounding a value between 1.0 and 2.0 to the nearest integer this setting specifies how much the value can fall short of 1.5 (the threshold for rounding up to 2.0) and still be rounded up to 2.0.

And the RND function has an optional argument for fuzzbits as well.

These choices did not exist in older version.
HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Mary
Sent: Wednesday, June 24, 2009 12:38 PM
To: [hidden email]
Subject: Re: [SPSSX-L] Rounding in different SPSS Versions

Thanks for all your help.  I definitely think that there are differences
between the two versions, at least using the RND function.

Looking at our data, we found out that each version was rounding
differently.  I have no idea why it does that, but we ended up eliminating
the RND function and now our results match.

Thanks again~

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Mary-54
In reply to this post by Mary-54
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 :)

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Rounding in different SPSS Versions

Peck, Jon
In reply to this post by Mary-54
Re: 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 -----
From: SPSSX(r) Discussion <[hidden email]>
To: [hidden email] <[hidden email]>
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 :)

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD