Date: Fri, 15 Jun 2001 02:37:34 +0100 John Whittington "SAS(r) Discussion" John Whittington Re: Round up Not down To: Dale McLerran text/plain; charset="us-ascii"

At 15:49 14/06/01 -0700, Dale McLerran wrote (in part):

>John, >Let me try to explain the rounding rule that I was taught. Suppose >that X falls within the range (XL, XU). ... what about the >situation where X-XL=XU-X? If we always round X to XU for all >intervals (XLi,XUi), then Y=round(X, <round-off-unit>) has the >property that E(Y)>E(X).

Indeed. As I said in my previous message, I certainly accept that shortcoming, even though I've never thought of it, or had it brought to my attention, before. Ironically, one of my tutors whilst I was doing my masters degree in statistics had done his PhD thesis on the effects of rounding errors - so I'm amazed he never mentioned this to us!

>So, what is the rule that I suggest should be employed when X-XL=XU-X? >....one of XL or XU will be even and the other odd. Choose >whichever of XL, XU is even as the value to round off to. >... Is this clear as mud?

Only if you have very clear mud in your part of the world :-)

Yes, I should have realised that your 'round to even' proposal only applied to the 'mid-interval cases' - and what you are suggesting now makes total sense.

As I said in my last message, the performance of this 'better' form of rounding would appear to be data-dependent, in that the desired E[round(x)]=E[x] performance will presumably only exist if the distribution of the data is such that there is an equal number (or equal probabilities, if a sample) of 'mid-interval cases' which are above and below the nearest 'even' rounding interval boundary. Although probably not practical for general use, random handling of 'mid-interval cases' would presumably be theoretically better.

In any event, even though I agree that the method you were taught will nearly always be 'better' than 'my' method, I have to ask (real, not rhetorical, question!!) how widespread is the use of this method - and, in particular which (and/or what proportion of) computer languages (and even pocket calculators) have rounding algoritms which follow 'your' rules?

Kind Regards,

John

---------------------------------------------------------------- Dr John Whittington, Voice: +44 (0) 1296 730225 Mediscience Services Fax: +44 (0) 1296 738893 Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk Buckingham MK18 4EL, UK mediscience@compuserve.com ----------------------------------------------------------------

Back to: Top of message | Previous page | Main SAS-L page