0+0+0+0=-.1215????
April 13, 2011 10:44 AM   Subscribe

What is wrong with my composite z scores?

I am computing a composite z score using various neuropsych test variables. I converted each raw score into a z-score, then summed the z-scores to create the composite. I thought I had done everything correctly, but when I checked the mean of the composite score it came out to -.1215 instead of 0. The weird thing is that all of the individual z scores have means of 0, so why on earth would a composite score made up of only those variables have a mean that does not equal zero?

One possibility is that one case is missing a test score, but I tried plugging the mean into the missing cell (i.e. substituting with the mean) and it didn't help. I also tried using the "missing values" capability in SPSS, but that didn't help either. There are no obvious miscalculations (i.e. all individual z-score data falls within a range of -3 to 3) and all the correct tests have been reversed (ones where a high score = poor performance). I'm fairly confident that my procedure is correct because I created 4 composite z scores before this one, and they all came out fine (i.e. mean = 0).

Why, oh why, oh why would 0+0+0+0=-.1215?
posted by Mrs.Spiffy to Science & Nature (7 answers total)
 
This kind of thing can happen with computer floating point. Intel was embarrassed when one version of the Pentium floating point gave the wrong answer to certain math operations.

It derives from two things: floating point representations of numbers have a finite number of bits, and it's binary rather than decimal. Some decimal values which can be expressed exactly in a finite number of digits would take an infinite number of bits to represent in binary, so any time you do math using such numbers, the result will be a little bit off.

But even if you are not dealing with those kinds of constants, there is a small error in floating point math which accumulate as you do further operations on the results of previous operations.

The classic manifestation of this problem is: 1 - ((1 / 3) * 3) != 0

To cope with that or variations of it, calculation programs often have override code which decide that if the value is small enough, it's "close enough" and will be corrected to be exactly zero. But depending on the kinds of operations being done, it may be that the "close enough" nonzero value is actually what you were looking for, so not all programs do that.
posted by Chocolate Pickle at 10:54 AM on April 13, 2011


Or, consider doing rational math all the way through. Or fixed point.
posted by rr at 11:32 AM on April 13, 2011 [1 favorite]


Rational math all the way through is the way to go.
posted by phrontist at 12:17 PM on April 13, 2011


Best answer: I would bet money that you haven't dealt with missing data correctly. You plugged in zero for all the missing (non-composite) z?
posted by a robot made out of meat at 12:28 PM on April 13, 2011


I vote against a floating-point error. You will tend to see (relatively large) floating point errors if you are adding or subtracting numbers that differ greatly in magnitude. If the numbers are of comparable magnitude, you may see small floating point errors (such as Chocolate Pickle describes): 1-((1/3)*3) may not be zero, but it will be very close to zero to multiple decimal places.

The discrepancy in your calculation is 12%. That is a large floating point error.

Also, you say yourself that your calculations have come out well before doing something similar.

I think you have made a mistake. Can you easily compute the mean of each of the sets of z-scores just to make sure that those have been calculated correctly?
posted by Maxwell_Smart at 12:28 PM on April 13, 2011


Response by poster: a robot was right. I made a mistake when I tried plugging in zero for the missing case. Fixing that one case seemed to do the trick.

Thanks for your help!
posted by Mrs.Spiffy at 1:53 PM on April 13, 2011


Exactly, floating point errors would show as much smaller values. I too vote against blaming the tool.
posted by CautionToTheWind at 3:30 AM on April 14, 2011


« Older Does shortest always take the middle?   |   Looking for a sewing pattern to match the USA... Newer »
This thread is closed to new comments.