Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -ml- evaluation: tempvars as doubles

From (Jeff Pitblado, StataCorp LP)
Subject   Re: st: -ml- evaluation: tempvars as doubles
Date   Thu, 22 Sep 2005 13:43:11 -0500

Stephen P. Jenkins <> asks about advice on Stata variable
types given in the ML book:

> The Gould et al. book on /Maximum Likelihood Estimation with Stata/
> emphasises that temporary variables in a maximum likelihood evaluation
> program should be created as doubles, and provides a salutary example of
> what can happen if you don't create them thus.
> As it happens, all the temporary variables cited in the illustration are
> continuous (a.k.a. metric) variables, in which case the book's advice is
> well-taken.
> But what if you know that the temporary variable will only take on a
> small number of discrete values (e.g. 0 or 1, or -1, 0, + 1)?  In
> standard Stata contexts the variable could be held as a byte variable.
> In the -ml- evaluator context, however, should one generate them as
> doubles?
> [I suspect that this is no big deal either way, though the two
> strategies have different implications for memory usage and
> requirements, which may bite in some applications.]

Stephen suspects correctly.  Provided you have a temporary variable that truly
takes on a small number of discrete values, you can code it as a byte
variable without adverse effects.

Based on the following two points, we did not make the above qualification in
the book.

1.  It seems reasonable to assume that users who run into an error message due
    to memory requirements will just bump up Stata's memory usage with
    -set memory-.

2.  It is a rare event that using -generate byte- for discrete temporary
    variables in the likelihood evaluator will prevent the need for resetting
    Stata's memory usage.

*   For searches and help try:

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