Statalist The Stata Listserver

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

st: Re: problems in maximizing a likelihood fn

From   Kit Baum <>
Subject   st: Re: problems in maximizing a likelihood fn
Date   Fri, 16 Jun 2006 07:39:51 -0400

Although I do not doubt that Deepankar stumbled onto some alteration of his program that made it work, the conclusion drawn below is absolutely invalid. Stata scalars have EXACTLY the same precision as variables, temporary or permanent, of data type double. Try

set obs 100
scalar p = _pi
gen double pp = _pi
gen double diff = pp - p
summ pp diff
di %20.16f p
format pp %20.16f
l pp in 1

and you will see that the two have identical capabilities in terms of precision. So the advice below -- which could be moderately disastrous to a user with a large N, counseled to create 10 or 20 variables of length N to hold 10 or 20 constant values in her ML evaluator -- should be disregarded.

Kit Baum, Boston College Economics

On Jun 16, 2006, at 2:33 AM, Deepankar wrote:

Moral of the story: never use scalars in -ml- estimation; use temporary
variables (if you need them) and generate them as -double-. And only as
- -double-.
*   For searches and help try:

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