```Date: Thu, 14 Jun 2001 22:05:28 +0100 Reply-To: John Whittington Sender: "SAS(r) Discussion" From: John Whittington Subject: Re: Round up Not down Comments: To: Dale McLerran In-Reply-To: Content-Type: text/plain; charset="us-ascii" At 11:24 14/06/01 -0700, Dale McLerran wrote: >You and I apparently have different rounding rules. Consider x=i+.5 >for i an integer value. Also, let y=round(x). I was always taught >that we should round to the nearest even value so that in expectation, >the mean of y is equal to the mean of x (assuming that the probability >of an odd value for i is 1/2). Hmmmm - yes, we do have different rounding rules - and the one I (and I think most other people, as well as, it seems, SAS) were taught is far less sophisticated than yours. In essence I was never taught anything more sophisticated that the 'elementary school' rule (for 'conventional rounding' to whole numbers of significant digits) that one 'rounded up' if the the first 'insignificant' digit was EQUAL TO OR greater than 5, otherwise one 'rounded down'. I'm not sure that I completely understand the rule you have described. I can't really believe that you are suggesting that, say, 0.49 'rounded to one decimal place' should be 0.4 (clearly the nearest even most significant digit); I think I must be undertsanding you. >I note, though, that SAS does not implement my rule, but rather >implements your rule as demonstrated in the following program. Indeed - and if one really wants to see where the transition (between rounding up and rounding down) occurs, it can be demonstrated with a program such as: data test; do i=0.499999 to 0.5000003 by 0.0000001; x = round(i); put i= x= ; end; run; >Personally, I do not like this behavior. Always rounding up for the >value that is halfway through the interval will result in a mean >value that is always larger than the true mean in any set of data. >Arrrrggggghhhhh!!!! Well, not ANY set of data - only sets that contain values exactly halfway through rounding intervals - but, yes, in such sets of data I agree with what you are saying, and also agree that the ideal method of rounding would be such that E[round(x)] = E[x]. I'm surprised that neither I nor anyone who has ever taught me has even raised this issue before, let alone proposed a better method of rounding! That better method (and I'm sure that 'your' method is an example of that) is one which results in equal probabilities of a 'halfway value' being rounded up or down. Random would be one (probably the best) way, but your method (when I understand it properly) presumably does it in a more structured, and therefore more readily applied, (albeit data-dependent) fashion. Perhaps you could explain 'your' rule in a little more detail, because I clearly have not understood it. 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