Just noticed that you say the variable "continuous" is a double - in this case you should check how the value 0.1 was put into this variable - has it come from another variable which is a float? (the precision will not improve by reclassifying as a double post calculation)
David
-----Original Message-----
From: David Harrison
Sent: 04 November 2004 09:59
To: [email protected]
Subject: st: RE: Bugs in generating variables?
Fabrice
See my post a few seconds ago on floating point precision...!
In a float variable, 0.1 is 0.10000000149... and therefore evaluates as >0.1
David
[email protected]
-----Original Message-----
From: Fabrice Etile [mailto:[email protected]]
Sent: 04 November 2004 10:03
To: [email protected]
Subject: st: Bugs in generating variables?
Dear Stata Users,
Here is a strange output, which shows that Stata 8 has some problems for
dealing with inequalities:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
log: c:\data\aninserm\inserm03\countmodels\logforstata.smcl
log type: smcl
opened on: 4 Nov 2004, 10:53:51
[added comment : continuous is a continuous (formatted double) variable in
the range 0-1.1]
. ta continuous
continuous | Freq. Percent Cum.
------------+-----------------------------------
0 | 7,156 92.55 92.55
.1 | 241 3.12 95.67
.2 | 150 1.94 97.61
.3 | 99 1.28 98.89
.4 | 48 0.62 99.51
.5 | 23 0.30 99.81
.6 | 6 0.08 99.88
.7 | 6 0.08 99.96
.9 | 2 0.03 99.99
1.1 | 1 0.01 100.00
------------+-----------------------------------
Total | 7,732 100.00
. g discrete=(continuous>0.1)
[added comment : I generate a discrete variable which takes value 1 if
continuous is strictly greater than 0.1]
. ta continuous discrete
| discrete
continuous | 0 1 | Total
-----------+----------------------+----------
0 | 7,156 0 | 7,156
.1 | 0 241 | 241
.2 | 0 150 | 150
.3 | 0 99 | 99
.4 | 0 48 | 48
.5 | 0 23 | 23
.6 | 0 6 | 6
.7 | 0 6 | 6
.9 | 0 2 | 2
1.1 | 0 1 | 1
-----------+----------------------+----------
Total | 7,156 576 | 7,732
As you can see, observations with continuous==0.1 should have discrete==0
and this is not what happens!!
Has someone an answer to that?
Cheers
Fabrice Etil�
PS: note that one of my colleague showed me a similar bug, so that it is
not a hardware-related problem.
Fabrice Etil�
INRA-CORELA
65, Bvd. de Brandebourg
94205, Ivry-sur-Seine cedex
T�l: 01 49 59 69 86
Fax: 01 49 59 69 90
E-mail: [email protected]
Web: http://www.ivry.inra.fr/corela/membres/etile.php
"L'ennui dans ce monde, c'est que les idiots sont s�rs d'eux et les gens
sens�s pleins de doutes." - Bertrand Russell
*
* 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/
*
* 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/
*
* 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/