Statalist


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

Re: st: Precision for locals?


From   Sergiy Radyakin <[email protected]>
To   [email protected]
Subject   Re: st: Precision for locals?
Date   Wed, 12 Aug 2009 11:17:08 -0400

Thank you Maarten and Kit.
Maarten points to the "ML estimation with Stata" book here:
http://books.google.com/books?id=6OH1LtY7e-AC&lpg=PP1&ots=2j4cUJwGkA&dq=Gould%20Pitblado%20Sribney&pg=PA83#v=onepage&q=&f=false

The precision however has changed between the versions 9 and 10. Below
you will see a trivial code illustrating this.
In a strange way the precision depends on how the value got into the
local - with direct assignment or with -syntax- if the version is 9,
and is same (for assignment and -syntax-) if the version is 10 and
above.

Stata's tech support suggested using the exact numeric representation
of the missing value in the syntax statement to make the default value
of an option be missing (as is required in my program). I am very
thankful for this advice. The corresponding values can be found in
[help dta].

Best regards, Sergiy


Here is an example.
****************************
clear

version 9.2
syntax [, value(real 1.23456789e300)]
display `"In Stata 9 the value is: `value'"'

version 10.1
syntax [, value(real 1.23456789e300)]
display `"In Stata 10 the value is: `value'"'

capture version 11.0
if !_rc {
	syntax [, value(real 1.23456789e300)]
	display `"In Stata 11 the value is: `value'"'
}

version 9.2
local a 1.23456789e300
di `a'

version 10.1
local a 1.23456789e300
di `a'

capture noi {
version 11.0
local a 1.23456789e300
di `a'
}

version 9.2
local a=1.23456789e300
di `a'

version 10.1
local a=1.23456789e300
di `a'

capture noi {
version 11.0
local a=1.23456789e300
di `a'
}

version 9.2
scalar sa=1.23456789e300
di `sa'

version 10.1
scalar sa=1.23456789e300
di `sa'

capture noi {
version 11.0
scalar sa=1.23456789e300
di `sa'
}

**************************************************









On Wed, Aug 12, 2009 at 6:26 AM, Maarten buis<[email protected]> wrote:
> --- On Wed, 12/8/09, Sergiy Radyakin wrote:
>> what is the precision with which the locals are stored in
>> Stata? Help page for datatypes lists precision for
>> doubles. Does it apply to locals? Help page for limits
>> does not answer this either.
>
> A discussion of this can be found in (Gould, Pitblado, and
> Sribney 2003) page 83: "Macros provide about 12 digits of
> accuracy, sometimes more but never less. Scalars are full
> double-precision binary numbers, meaning they provide about
> 16.5 digits of accuracy in all cases"
>
> Hope this helps,
> Maarten
>
> William Gould, Jeffrey Pitblado, and William Sribney (2003)
> Maximum Likelihood Estimation with Stata, second edition.
> College Station: Stata Press.
>
> -----------------------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
>
>
> *
> *   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/
>

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



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