This reminds me to share the nice response that Bobby Gutierrez provided
with respect to my -nlcom question from yesterday. As Bobby suspected,
the problem had to do with iterating to find optimal step sizes to
calculate numerical derivatives. Bobby provided me with modified
versions of -nlcom and -testnl that alllowed for user-specifed number of
digits of "accuracy" (see below) and when I used them with ",digits(6)"
as an option, the problem went away.
Since I can't post attachments, I am not including these modified ados,
but I suspect Bobby would be happy to provide them to anyone who asked.
It appears that eventually, these will be official updates (see below).
Al Feiveson
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Roberto G.
Gutierrez, StataCorp
Sent: Monday, January 07, 2008 3:51 PM
To: Feiveson, Alan H. (JSC-SK311)
Subject: RE: st: weird error in -nlcom-
Dear Al,
In a previous email, I send you nlcom2.ado and testnl2.ado which are
tweaked versions of the -nlcom- and -testnl- commands, noting that
-nlcom- is merely a front end for -testnl-.
These new programs have an added option -digits()- that can be used to
tweak the convergence criterion for optimal stepsize. By default and as
hardcoded in standard -nlcom-, digits is equal to 5 which translates
VERY roughly into wanting 5 significant digits for your numerical
derivative. When you have trouble converging you can change this to 4
or 6 to get convergence, with little impact on the statistical validity
of what you get. I would not advise going much beyond 4-6, however.
Example,
. nlcom2 exp([lnK]_cons)*(normal( (2038-[t0]_cons)/exp([lnsig]_cons)) -
normal( (1678-[t0]_cons)/exp([lnsig]_cons)))/5
won't work (same as regular -nlcom-), while
. nlcom2 exp([lnK]_cons)*(normal( (2038-[t0]_cons)/exp([lnsig]_cons)) -
normal( (1678-[t0]_cons)/exp([lnsig]_cons)))/5, digits(6)
works just fine. Imagine that:)
I am thinking seriously about making this tweak a permanent feature, but
need to do a little homework beforehand.
> 1. Can I assume that the results are "valid" if -nlcom- "runs"?
Yes.
> 2. Is there a way to change the number of step-size search iterations
> in -nlcom-?
Yes, option -iterate()- is part of standard -nlcom-; see help -nlcom-.
However, all the iterations in the world wouldn't have solved your
problem -- you were osciallating between several candidate step sizes
with no hope of convergence. This just happens sometimes, not often
though.
> 3. How come -nlcom- accepts "norm" in Version 10?
-nlcom- runs under version 8, hence it accepts -norm()- just fine. It
would probably be best if -nlcom- reverted to the current version when
calculating the expression, but in this case there is little harm done
by allowing a deprecated feature to keep working. If we were to change
the definition of
-norm()- in future versions of Stata I could see a danger, however.
I'll look into this closer as well.
Best,
--Bobby
------------------------------------------------------------------------
-----
Roberto G. Gutierrez, Ph.D. VOICE: 1-979-696-4600
Director of Statistics TOLL : 1-800-STATAPC
(1-800-782-8272)
4905 Lakeway Drive FAX : 1-979-696-4601
College Station, TX 77845 EMAIL: [email protected]
------------------------------------------------------------------------
-----
*
* 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/