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

Stephen P. Jenkins <stephenj@essex.ac.uk> 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.
--Jeff
jpitblado@stata.com
*
* 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/