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: A bug in egen and gen?

From   Maarten buis <>
Subject   Re: st: A bug in egen and gen?
Date   Thu, 17 Feb 2011 20:50:56 +0000 (GMT)

--- On Thu, 17/2/11, Nick Cox wrote:
> As said, do read Bill Gould's blog entries on precision.

Couldn't agree more, see below, also for links to these

--- Liao, Junlin wrote:
> appropriate data type. Therefore, my recommendation for
> Stata to use double as default calculation and finally
> select the appropriate type to store data is sensible.

This would not be my recommendation. 

I see roughly three different roles for variables:

o an identification number: these can get sometimes 
  very large and you really want to strore the number 
  exactly, so you should consider storing those as 
  either doubles or strings.

o an intermediate result in a computation: you should 
  try to minimize rounding error in a computation, so
  go for doubles.

o real data: there is no way you collected to such a 
  degree of precision that you would need more than 
  float to store it. doubles are real overkill and 
  only give you a false sense of precision.

Bill just posted on how ridiculous the degree of 
overkill this really is. I'll just repeat one example:

"The U.S. deficit in 2011 is projected to be $1.5 
trillion. One hopes that a grand total of $26,624 — 
the error that would be introduced by storing this 
projected deficit in float precision — would not be 
a significant factor in any lawmaker’s decision 
concerning the issue." 

For this quote and many more see:


-- Maarten

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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