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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Re: STATA mistakes divisions! |

Date |
Fri, 16 Mar 2012 18:36:44 +0000 |

I said precision of 1 part in 10^7, meaning relative precision. I didn't mean absolute values of that order (or finer). Nick On Fri, Mar 16, 2012 at 5:40 PM, Tiago V. Pereira <tiago.pereira@mbe.bio.br> wrote: > Some general comments/questions: > > (1) Nick has asked "What science are you in that needs precision to 1 part > in 10^7? Particle physics?" > > I can comment on my area: genetics. We routinely need calculations with > very high precision (1-10^8 often) > > That's EXACTLY why I am using Stata. > > (2) Maarten wrote: "Some computations are even done in quad precision > (approximately 34 decimal digits)." > > > Question: Can one perform every calculation in quad precision? I would > very interested in that. Thu, Mar 15, 2012 at 3:48 PM, Francesco Vidoli wrote: >> But therefore by default, without writing in every division "float", >> STATA mistake divisions? >> It's not only a visualization problem, we are trying to compare a SAS >> OLS regression and results simply do not add up if you calculate the >> variables of SAS or STATA ... > > No, there is no mistake. This is a phenomenon known as precision, and > it is a result of the fact that computers cannot store most numbers > with infinite precision. Stata (note: not STATA) has some smart > defaults on how much precision to use for variables, computations, > scalars, etc. In short data is by default stored with less precision > (about 7-8 decimal digits) than computations (about 17-18 decimal > digits). This is smart as even the 7-8 digits is complete overkill for > real world data. Some nice examples of this can be found here: > <http://blog.stata.com/2011/06/17/precision-yet-again-part-i/>. > > However if you want to do computations with variables than you want to > overwrite this default, as many tiny rounding errors can start to add > up to a large or at least noticeable error. You do so as follows: > > gen double varname = expression > > The key part is -double-, that tells you that the variable is supposed > to be stored in double precision, i.e. about 18 decimal digits, which > corresponds to the precision used by SAS and others. This is also what > Stata programs do internally when they are using variables to do > computations. Some computations are even done in quad precision > (approximately 34 decimal digits). > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: Re: STATA mistakes divisions!***From:*"Roger B. Newson" <r.newson@imperial.ac.uk>

**References**:**RE: st: RE: Re: STATA mistakes divisions!***From:*"Tiago V. Pereira" <tiago.pereira@mbe.bio.br>

- Prev by Date:
**Re: st: Too many values error** - Next by Date:
**Re: st: ARIMA model in time-series panel data** - Previous by thread:
**RE: st: RE: Re: STATA mistakes divisions!** - Next by thread:
**Re: st: RE: Re: STATA mistakes divisions!** - Index(es):