[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Christopher F Baum <baum@bc.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: NaN (the inedible kind) |

Date |
Thu, 26 Sep 2002 08:18:13 -0400 |

--On Thursday, September 26, 2002 2:33 -0400 Roger wrote:

NaN is geekspeak for Not a Number. SeeWhat precisely is a NaN? And does it have any connection with missing values, or with the "magic number" 1e300 mentioned in -[R] tabstat-? I can't find any reference to NaNs in -[R] matrix define-.

http://www.psc.edu/general/software/packages/ieee/ieee.html

IMHO Stata does NOT make use of NaNs, which have the properties that missing values should have (i.e. any op involving a NaN evaluates to a NaN). If I say

use auto

g byte badrep = (rep78>3)

I get 5 obs of badrep=1 corresponding to rep78==. whereas in true NaN arithmetic they would be discarded as having no defined value. (As the IEEE std says, there are differences between three constructs, none of which can be represented in finite arithmetic: NaN, +Inf, and -Inf). To do this right in Stata, I would have to say

g byte badrep = (rep78>3 & rep78<.)

and forgetting the second clause will bite you (well, in this case maybe byte you).

Most lower-level programming languages (and some higher-level languages, e.g. Mathematica, MATLAB) support NaNs per the IEEE standard. Stata does not--it allows missing values to be treated as a very large positive number--and that has been the topic of discussion at 'wishes and grumbles' sessions at SUG meetings.

I don't know whether Bill Gould is saying that tabstat's 'magic number' behavior is inappropriate, but it is established and well defined. Nick Cox and I mimicked it in statsmat. It is very useful to be able to indicate that a certain matrix cell is not zero but rather not defined.

Kit *

* 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/

**Follow-Ups**:**st: RE: Re: NaN (the inedible kind)***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: Re: NaN (the inedible kind)***From:*Brendan Halpin <brendan.halpin@ul.ie>

**Re: st: Re: NaN (the inedible kind)***From:*Roger Newson <roger.newson@kcl.ac.uk>

- Prev by Date:
**st: Re: roblpr: fractional integration test** - Next by Date:
**st: Re: cleaning panel data** - Previous by thread:
**st: Re: roblpr: fractional integration test** - Next by thread:
**Re: st: Re: NaN (the inedible kind)** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |