Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Jennyfer Wolf <jennyfer.wolf@googlemail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: RE: nl-function log4-formula |
Date | Wed, 16 Nov 2011 16:10:17 +0100 |
Dear Nick, dear Brian, thanks a lot for your answers which were of big help! Jennyfer 2011/11/16 Brian P. Poi <bpoi@stata.com>: > Jennyfer Wolf wrote: >> >> Dear Nick, >> >> thanks for your answer. >> I tried with the parantheses outside: >> >> 2. nl(VAR1={b0}+{b1}/(1+exp(-{b2}*(VAR2-{b3})))) if VAR3=="xxx" >> >> It does not change anything. Still I don't get same reults as with >> log4 and only an estimate for b0. >> Would you have another idea? >> >> Thank you! >> Jennyfer > > The difference between using -nl-'s log4 routine and typing in the > substitutable expression yourself lies with the starting values that -nl- > uses in its optimization routine. The logistic function that -nl- calls > log4 is somewhat sensitive to the starting values you use. When you type in > your own substitutable expression, unless you specify your own starting > values, -nl- initializes all the parameters to zero. On the other hand, > -nl-'s log4 routine examines your data to come up with better starting > values. With sensitive nonlinear functions, it's not unheard of for the > optimizer to find a different value for the constant term but leave all the > other parameters at zero; "strange" results like that are usually a good > indication that you should try different starting values. > > For the log4 function y = b0 + b1/(1 + exp(-b2*(x-b3))), -nl- sets b0 to > slightly less than the smallest value of y in your data and sets b1 to > slightly more than the difference between the largest and smallest values of > y. b2 and b3 are initialized based on a linear regression that uses a > transformation of y as the dependent variable. To see the nitty gritty > details, you can type in > > . viewsource nllog4.ado > > The program code in between the -quietly- braces gets the initial values. > > > Brian P. Poi > Senior Economist > StataCorp LP > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/