Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: rounding the minimum of a negative number


From   annoporci <[email protected]>
To   [email protected]
Subject   Re: st: rounding the minimum of a negative number
Date   Thu, 10 Jan 2013 23:32:57 +0800

Thanks Maarten, your explanations do help.

Patrick.



On Thu, 10 Jan 2013 22:53:46 +0800, Maarten Buis <[email protected]> wrote:

On Thu, Jan 10, 2013 at 3:19 PM, annoporci wrote:
Yes. I guess another way of expressing my puzzlement is that Stata does
not display, by default, to a greater number of decimal places.

Stata is a program for statistical analysis. In any real statistical
analysis involving real data, any number beyond the first (maybe, if
you are lucky the second) is in essence random noice. So from that
perspective Stata is reporting way too many digits.

This is not to say that precision is not a problem. During
computations numerical precision is a major issue. However, my
impression, based on the couple of contacts I have had with the people
from StataCorp (mainly at Stata Users' Group meetings and just reading
what they have written), is that StataCorp tends to take this
extremely seriously.

I don't know anything about this, but in Python, for instance, according
to the documentation: "On a typical machine running Python, there are 53
bits of precision available for a Python float." And, to quote more:

If Python were to print the true decimal value of the binary approximation
stored for 0.1, it would have to display:

0.1000000000000000055511151231257827021181583404541015625

So that's still quite a few zeros after the first 1.

Compare that with Stata:
. di %30.25f 0.1
0.1000000000000000100000000

Does not look too different to me.

 > Would I get a more accurate approximation of "-1.981" with Stata if I
input "-1.981000000001" than if I input "-1.981" ? in the sense that it
would "force" Stata to store the zeros after 981? (or am I
misunderstanding the whole issue?)

If you want to store a number equivalent to -1.981 exactly than you
need think in terms of integers, as computers can store integers up to
a given size(*) exactly. In this case you would store the number 1981.

Hope this helps,
Maarten

(*) To see the limits see the the reference Nick gave you:
<http://blog.stata.com/2012/04/02/the-penultimate-guide-to-precision/>
and the references therein.



--
Patrick Toche.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index