Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: help on round function


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   RE: st: help on round function
Date   Tue, 13 Dec 2005 04:35:34 -0000 (GMT)

Svend Juul replied to Fred Wolfe:

> Fred gave some good explanations. The problem is that 8.765 is as close
> to 8.76 as to 8.77, so both results are equally valid. If you for some
> reason feel that this result MUST be rounded up, you can:
>    gen y=round(x+0.00001, 0.01).

At this stage, Stata has done its job and it falls to the user to make a
judgement. One way of making a good and informed judgement is to use
rounding rules. A good summary of such rules is provided by Pagano (1994:
29-30). In particular, he argues that where the decimal remainder is dead
on .5, the greater part is only rounded up if the last digit before the
decimal remainder is an odd number. In the above example, we have 8.765,
so if we're rounding up to two decimal points, we leave it at 8.76. If it
was 8.775, we would, of course, have rounded up to 8.78. It would be
interesting to know of ways whereby one could 'fix' Stata to use this rule
permanently.

I hope this helps. :)

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps

Reference:

Pagano RR (4th ed, 1994) UNDERSTANDING STATISTICS IN THE BEHAVORIAL
SCIENCES, St Paul, MN: West.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index