| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: local variables program
On Jun 25, 2007, at 9:22 AM, Nachbar, Dirk wrote:
global minRMSE=999999999999999999
[snip]
if e(rmse) < $minRMSE {
global minRMSE = e(rmse)
[snip]
}
If I'm not mistaken, you can improve this code slightly by
exploiting the fact that Stata sees "missing" (i.e. "global minRMSE
= .") as an infinitely large number. Thus, the first time through
your loop, e(rmse) < . ("missing") should always evaluate to "true",
and then the rest of your code will identify any smaller RMSE values
within the loop.
Again, it's clearly not a big deal, but infinity is always greater
than any finite large number. So while it is unlikely that your code
will fail with "global minRMSE=999999999999999999", I suspect it
would never fail with "global minRMSE = ."
Hope this helps.
-- Mike
*
* 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/