Bookmark and Share

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

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

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

From   "Roger B. Newson" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Re: STATA mistakes divisions!
Date   Fri, 16 Mar 2012 19:55:20 +0000

The phrase 1-1e-8 (which I think Tiago really meant) seems to imply RELATIVE rather than ABSOLUTE precision to me, ie numbers VERY close to 1, which are routinely encountered in genome scan calculations. Given an uncorrected P-value of 1e-8, the expression 1-1e-8 will appear in the formula for the q-values generated by the Sidak and Holland-Copenhaver methods. See Newson (2010) for these formulas.



Newson RB. Frequentist q-values for multiple-test procedures. The Stata Journal 2010; 10(4): 568-584.

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

On 16/03/2012 18:36, Nick Cox wrote:
I said precision of 1 part in 10^7, meaning relative precision.

I didn't mean absolute values of that order (or finer).


On Fri, Mar 16, 2012 at 5:40 PM, Tiago V. Pereira
<[email protected]>  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:

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:
*   For searches and help try:

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