Ok, seriously, rounding

For the discussion of the sciences. Physics problems, chemistry equations, biology weirdness, it all goes here.

Moderators: gmalivuk, Moderators General, Prelates

User avatar
agelessdrifter
Posts: 225
Joined: Mon Oct 05, 2009 8:10 pm UTC

Ok, seriously, rounding

Postby agelessdrifter » Tue Aug 24, 2010 2:59 am UTC

I know this is a pretty mundane topic for the science forum, but I figured a significant number of you must be actual researchers in scientific fields, and I want to know how the real world handles this minute detail:

When I was growing up, when the last digit before the round-off (that is, the digit to the right of the last digit that will remain after the rounding) was five or greater than five, you rounded up, unconditionally.

eg. 2.45-->2.5, 2.55-->2.6

Recently it has been brought to my attention that you should round a five "to the nearest even number," which I take to mean you round *down* if the digit to the left of the five is an even number already, and up if it's odd, in order to make it even.

eg. 2.45-->2.4, 2.55-->2.6

I have no idea why this would be the rule, but when I heard it, I accepted it, and have tried to apply it ever since.


However, the science classes at my school (my school where I first learned this "new" rule of rounding, I might add) all use these online tools now, where problem sets are given online and answers must be submitted in text fields, which are then immediately evaluated as "right or wrong".

*Every* time I have tried this rule of rounding fives, on several different online homework sites now, it has been marked wrong, with the correct answer being indicated as a round up, as in the "old rule" of rounding a five up unconditionally.

How is this handled in the real world? And (rhetorically) if the new rule is right, why won't the damn text book companies catch on and quit making me do my homework twice?

User avatar
Charlie!
Posts: 2035
Joined: Sat Jan 12, 2008 8:20 pm UTC

Re: Ok, seriously, rounding

Postby Charlie! » Tue Aug 24, 2010 3:22 am UTC

Yeah, 2.45->2.5

Although note that this does not mean that 2.45->2.5->3. Once a number is rounded, you have to go back to the original if you want to round it any further.
Some people tell me I laugh too much. To them I say, "ha ha ha!"

User avatar
Interactive Civilian
Posts: 468
Joined: Sun Jan 06, 2008 7:53 am UTC
Location: Bangkok, Krung Thep, Thailand
Contact:

Re: Ok, seriously, rounding

Postby Interactive Civilian » Tue Aug 24, 2010 3:29 am UTC

agelessdrifter wrote:Recently it has been brought to my attention that you should round a five "to the nearest even number," which I take to mean you round *down* if the digit to the left of the five is an even number already, and up if it's odd, in order to make it even.

eg. 2.45-->2.4, 2.55-->2.6

I have no idea why this would be the rule, but when I heard it, I accepted it, and have tried to apply it ever since.


It's the rule because it tends to remove rounding bias in large sets of numbers, such as in data sets (e.g. if you have a large data set and you always round up, then you will introduce a positive bias).

I tend to use the "round away from zero" rule myself (like your first rule, except negative numbers get rounded the other way, e.g. -22.5 rounds to -23), just because its what I'm used to, and its what most people know, so it doesn't cause confusion. Also, when I'm using rounding for personal reasons like estimating prices while shopping, I'd rather err on the large side to decide whether or not I have enough money than err on the small side. It would suck if rounding to even turned out to give me a lower estimate of the total price and make me think I have enough money when I actually don't. However, that's not exactly a scientific application. ;)

I'm not sure how I feel about the "round to even" (or its equivalent "round to odd") rules. It all really depends on the precision of your data and how much bias could be introduced by rounding (which, hopefully someone who actually does this for a living will tell us about, because I, too, am interested). If you have more precision in the numbers you need to round, then the problem often goes away. For example, while it may be difficult to decide whether or not to round 2.5 to 2 or 3, there is no doubt that 2.51 is closer to 3 than it is to 2, so rounding it up makes sense. Of course, you are still stuck if you have a 2.50 measurement.

Anyway, the Wikipedia article on Rounding may give you some more insight about the methods, though it doesn't really describe how and when they are best applied.

So, I'd like to echo your interest in finding out for sure how it is most commonly done in the real world of science research (especially in biology, which is my personal interest). :)
I (x2+y2-1)3-x2y3=0 science.

qetzal
Posts: 862
Joined: Thu May 01, 2008 12:54 pm UTC

Re: Ok, seriously, rounding

Postby qetzal » Tue Aug 24, 2010 3:44 am UTC

Well, as one biologist, I always round 5s up. E.g. 2.35 -> 2.4, 2.45 -> 2.5, etc. I've heard of the odd/even rule, and I get that it eliminates a slight positive rounding bias, but honestly that's never been an issue for me. If I ever did think there was a problem with rounding bias, I'd simply include one more significant figure in my value.

I don't know anyone who uses the even/odd round up/down method in biology. My guess is it might make more sense if you were dealing with large number sets AND where even a small bias could be an issue. Maybe some biologists run into that, but I don't.

User avatar
Ulc
Posts: 1301
Joined: Sun Jun 21, 2009 8:05 pm UTC
Location: Copenhagen university

Re: Ok, seriously, rounding

Postby Ulc » Tue Aug 24, 2010 7:29 am UTC

The different rule on rounding is meant only to avoid rounding bias in large datasets. In smaller datasets it will only cause confusion without actually gaining anything.

Also keep in mind that it only makes sense to care about this, if the potential rounding bias isn't significantly smaller than your error. If you have a data point with a value of 2.347650 with a error of +/- 2%, the bias that can potentially be introduced by rounding either way is in the order of 10^-3% of your total error. Meaning that it doesn't matter at all.

Personally, I often deal with large datasets, but I don't know which method for rounding is used, by the software I use. And I don't really care either, since my measurements often have 5-6 significant numbers, while I can usually only report my results with 3-4 significant numbers, as that's the limit of how precise I know the concentrations of things in my sample.

Well, then it could potentially be a issue if I get the result of x.xxx00, but that is fairly rare.
It is the mark of an educated mind to be able to entertain a thought without accepting it - Aristotle

A White Russian, shades and a bathrobe, what more can you want from life?

dimaG
Posts: 8
Joined: Tue Aug 24, 2010 9:52 am UTC

Re: Ok, seriously, rounding

Postby dimaG » Tue Aug 24, 2010 10:02 am UTC

As far as I know, accountants tend to use the odd/even rule. The first time I heard about this rule was from an accountant (in UK, in case that matters) and I thought that maybe during reconciliation, when they work out VAT (or whatever else that requires division/multiplication) this might help eliminate lost pennies. I'm coding an order processing system for a shop right now but the way I try to deal with "lost pennies" problem is by using more decimal places instead of weird rounding, I suspect this would've been useful to accountants before calculators/spreadsheets were invented.

letterX
Posts: 535
Joined: Fri Feb 22, 2008 4:00 am UTC
Location: Ithaca, NY

Re: Ok, seriously, rounding

Postby letterX » Tue Aug 24, 2010 3:48 pm UTC

It has a name (several, apparently): Banker's Rounding.

Also, apparently it is the rounding method specified by IEEE 754, and thus is used in most programming languages (in particular C), so you are likely using it somewhere along the line, even if you didn't realize it. Not introducing bias unnecessarily is actually a pretty good thing. It may matter very little for individual calculations, but if you have a big chain of calculations, then the drift of other methods may actually grow large enough to matter.

hemhhr
Posts: 84
Joined: Wed Aug 04, 2010 6:19 pm UTC

Re: Ok, seriously, rounding

Postby hemhhr » Tue Aug 24, 2010 5:21 pm UTC

help me out, I don't understand how the standard round to nearest (.0 to .4 down, .5 to .9 up) introduces a positive bias.
.0 to .4 is five situations
.5 to .9 is five situations
and unless you're getting measurements that are about the same over and over again all these ten situations should be about as likely. So where's the bias?

User avatar
Ulc
Posts: 1301
Joined: Sun Jun 21, 2009 8:05 pm UTC
Location: Copenhagen university

Re: Ok, seriously, rounding

Postby Ulc » Tue Aug 24, 2010 5:54 pm UTC

hemhhr wrote:help me out, I don't understand how the standard round to nearest (.0 to .4 down, .5 to .9 up) introduces a positive bias.
.0 to .4 is five situations
.5 to .9 is five situations
and unless you're getting measurements that are about the same over and over again all these ten situations should be about as likely. So where's the bias?


Imagine you have the range of 0.00 to 1.00, and you are to round them to one significant number. In all but one case it is clear what the result would be.

If between 0.00 and 0.49 (including both numbers) the result is 0
If between 0.51 and 1.00 (including both numbers) the result is 1

It should be obvious that those two ranges are equally large. Now add

If exactly 0.50 the result is 1

And you have more numbers resulting in rounding up, than you have in rounding down.

Now imagine that we pick a very large amount of numbers*, randomly between 0.00 and 1.00 (both numbers included), can we then agree that there will be a certain amount of randomly picked out numbers that will return as 0.50?

That means that in the end there will be slightly more results of 1.0 than there will 0.0, which means that we have a bias in our rounding.

if we instead let every second 0.50 result be rounded to 0.0, then said bias will be much smaller (it will still be present if we get a uneven number of 0.5 results, but that is significantly less of a bias)


Basically, your error is that you only take into account .0 in one end of your scale.
It is the mark of an educated mind to be able to entertain a thought without accepting it - Aristotle

A White Russian, shades and a bathrobe, what more can you want from life?

User avatar
evilbeanfiend
Posts: 2650
Joined: Tue Mar 13, 2007 7:05 am UTC
Location: the old world

Re: Ok, seriously, rounding

Postby evilbeanfiend » Tue Aug 24, 2010 8:45 pm UTC

Bankers rounding is particularly good at eliminating bias from sums of numbers, assuming they aren't distributed to favour rounding in a particular direction, a rounding bias on a single numebr is small but if you have a bias in the same direction on potentially every number in a sum you accumulate the errors.

but there are also other ways of eliminating rounding bias, different methods are useful in different circumstances, in general you either need to accept some bias (rounding up) make an assumption about your data set (round to even) or except some non-determinism (stochastic rounding).

also if you are performing a series of operations you can pick different rounding rules for each operation which, when combined in series can remove bias.
in ur beanz makin u eveel

hemhhr
Posts: 84
Joined: Wed Aug 04, 2010 6:19 pm UTC

Re: Ok, seriously, rounding

Postby hemhhr » Wed Aug 25, 2010 12:18 am UTC

Ulc wrote:Basically, your error is that you only take into account .0 in one end of your scale.

aight now I feel really out of the loop. This is what I imagined rounding to an integer to be.
You've got some number N, and you remove 1 from it as many times as you can without it going negative (N%1), and you're left with a remainder R. Then, depending on what R is, you either end up with (N-R)+1 or (N-R), and the goal is to have each of those answers exactly half the time.
So, imagining rounding this way, it's nonsensical to count .0 twice. If you're rounding off two digits, they'll vary from .00 to .99, not .00 to 1.00. So what am I doing wrong?

User avatar
The Scyphozoa
Posts: 2871
Joined: Sun Jun 01, 2008 6:33 pm UTC
Location: Sector 5

Re: Ok, seriously, rounding

Postby The Scyphozoa » Wed Aug 25, 2010 12:25 am UTC

Funny, I just learned about this today, in my first day of AP Chemistry.

The even/odd rule makes sense to me. 2.35->2.4, 2.45->2.4. (Should be noted that 2.351, or even 2.3500000000001 or whatever, does get rounded to 2.4).
Image
3rdtry wrote:If there ever is another World War, I hope they at least have the decency to call it "World War 2: Episode One"

doogly wrote:murder is a subset of being mean

User avatar
Charlie!
Posts: 2035
Joined: Sat Jan 12, 2008 8:20 pm UTC

Re: Ok, seriously, rounding

Postby Charlie! » Wed Aug 25, 2010 4:50 am UTC

Ulc wrote:Basically, your error is that you only take into account .0 in one end of your scale.

Nope. Although extending it periodically does remove any tendency to favor one number over another, it doesn't remove the overall upward bias.

What DOES remove the upward bias is if you were working with arbitrarily finely-divided numbers. As long as the order you round at is far away from either the minimum precision or the order you report at, you're fine. And if it doesn't satisfy either of those, why do you need to round it in the first place?
Some people tell me I laugh too much. To them I say, "ha ha ha!"

User avatar
nash1429
Posts: 190
Joined: Tue Nov 17, 2009 3:06 am UTC
Location: Flatland
Contact:

Re: Ok, seriously, rounding

Postby nash1429 » Wed Aug 25, 2010 5:02 am UTC

hemhhr wrote:
Ulc wrote:Basically, your error is that you only take into account .0 in one end of your scale.

aight now I feel really out of the loop. This is what I imagined rounding to an integer to be.
You've got some number N, and you remove 1 from it as many times as you can without it going negative (N%1), and you're left with a remainder R. Then, depending on what R is, you either end up with (N-R)+1 or (N-R), and the goal is to have each of those answers exactly half the time.
So, imagining rounding this way, it's nonsensical to count .0 twice. If you're rounding off two digits, they'll vary from .00 to .99, not .00 to 1.00. So what am I doing wrong?


Consider the digits 1-100; the mean is 50.5, but if each digit is rounded to the nearest hundred the mean becomes 51. Essentially the point is that the range is not equal to exactly 1; any digit that will be the last remaining one after rounding could stay the same or become the next higher natural number.

RonWessels
Posts: 43
Joined: Tue Aug 24, 2010 8:40 pm UTC
Location: Mississauga, ON, CA

Re: Ok, seriously, rounding

Postby RonWessels » Thu Aug 26, 2010 4:16 pm UTC

Forgive me for going back several posts, but using this one illustrates my point best.
hemhhr wrote:help me out, I don't understand how the standard round to nearest (.0 to .4 down, .5 to .9 up) introduces a positive bias.
.0 to .4 is five situations
.5 to .9 is five situations
and unless you're getting measurements that are about the same over and over again all these ten situations should be about as likely. So where's the bias?

The problem is that you are counting the .0 case. In the .0 case, there is no rounding needed, so the number doesn't change from its "true" value. Let's examine the cases where the number does change: 0.1 to 0.9. Now 0.1 to 0.4 are 4 cases and 0.5 to 0.9 are 5 cases. Similarly, when rounding away 2 decimal places, 0.01 to 0.49 (rounding to 0) are 49 cases, whereas 0.50 to 0.99 (rounding to 1) are 50 cases. And so on for any finite number of decimal places you are rounding away.

hemhhr
Posts: 84
Joined: Wed Aug 04, 2010 6:19 pm UTC

Re: Ok, seriously, rounding

Postby hemhhr » Sat Aug 28, 2010 12:40 am UTC

okay, I read what RonWessels said and I almost got it. Then I came up with the following way of proving to myself that standard rounding causes a positive bias.

Assuming equal probability of each digit:

if .0, remove .0
.1, remove .1
.2, remove .2
.3, remove .3
.4, remove .4
Average negative change per ten numbers: (.0+.1+.2+.3+.4)/5 = .2

.5, add .5
.6, add .4
.7, add .3
.8, add .2
.9, add .1
Average positive change per ten numbers: (.5+.4+.3+.2+.1)/5 = .3

That's valid, right?

RonWessels
Posts: 43
Joined: Tue Aug 24, 2010 8:40 pm UTC
Location: Mississauga, ON, CA

Re: Ok, seriously, rounding

Postby RonWessels » Sat Aug 28, 2010 1:57 pm UTC

hemhhr wrote:That's valid, right?

Yes. You could also write it as:
.0, +0.0 change, 10% chance
.1, -0.1 change, 10% chance
.2, -0.2 change, 10% chance
.3, -0.3 change, 10% chance
.4, -0.4 change, 10% chance
.5, +0.5 change, 10% chance
.6, +0.4 change, 10% chance
.7, +0.3 change, 10% chance
.8, +0.2 change, 10% chance
.9, +0.1 change, 10% chance

Expected change = 0.0*10% - 0.1*10% - 0.2*10% - 0.3*10% - 0.4*10% + 0.5*10% + 0.4*10% + 0.3*10% + 0.2*10% + 0.1*10% = 0.01 (per number).

This formulation makes explicit the assumption that each decimal value is equally likely.


Return to “Science”

Who is online

Users browsing this forum: No registered users and 7 guests