# Re: st: nl -choice between alternative parametrisations of sigmoid models

 From "Rosy Reynolds" To "statalist" Subject Re: st: nl -choice between alternative parametrisations of sigmoid models Date Fri, 26 Oct 2007 10:40:35 +0100

Austin,
Many thanks for the thought, and a neat trick. I could do as you suggest, but as that would be a 'home-grown' rather than a built-in function, I would have to take responsibility for choosing the starting values myself. The built-in -log4- function does something very neat about selecting starting values, and I appreciate that. (When I started out, I experimented with fitting the log4
model by typing it in myself like this
nl ( y1= {b0} + {b1}/(1 + exp(-{b2}*(x-{b3}))) )
It kept producing crazy results with a lot of dots in the tables, or failing to converge at all, and it took me a while to work out that it was not a mistake in my syntax but a need for good starting values.)
I would be interested to see how -log4- does pick its starting values, but I haven't found the code for it. -viewsource nl.ado- brings up the code for nl, but nothing to link up with the built-in functions. Do you have any idea where I could find the code for them?
best wishes
Rosy

----- Original Message ----- From: "Austin Nichols" <austinnichols@gmail.com>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, October 25, 2007 5:03 PM
Subject: Re: st: nl -choice between alternative parametrisations of sigmoid
models

```Rosy--
I haven't used -nl- in a while, but it seems to me that a model like
y= b0 + b1/(1 + exp(-b2*(x-b3))) +error
where b2>0 can be written
y= b0 + b1/(1 + exp(-b^2*(x-b3))) +error
with new parameter b, and b2=b^2 has to be positive.

On 10/25/07, Rosy Reynolds <rr@dandr.demon.co.uk> wrote:
```
```Hello,
I am fitting 4-parameter logistic (sigmoid Emax) dose-response models
using
the built-in -log4- feature of -nl-.

The model is  y= b0 + b1/(1 + exp(-b2*(x-b3))) + error
and the coefficients can be interpreted as
b0 = baseline outcome
b1 = Emax i.e. largest change from baseline
b2 = Hill or slope coefficient
b3 = ED50 i.e. value of x (dose) required to produce half-maximal effect,

The same curve can actually be produced with two different sets of these
parameters.
In one set, the Hill slope b2 is positive and the other parameters
intuitively have the interpretations above.
In the other set, b2 is negative, the sign of b1 is reversed, and b0
becomes
the outcome at infinitely high dose instead of at the lowest doses. The
lowest-dose outcome is now given by b0+b1.

With our data, -nl- naturally produces the set of coefficients with
negative
b2.
For ease of interpretation, I would prefer the set with positive b2.
I can push -nl- into doing that by supplying carefully chosen starting
values close to the desired coefficients. I could even run -nl- ,
manipulate
the coefficients it obtains, and use those as starting values. That would
always work, I suppose, but it seems long-winded.

Please could you tell me an easier way to make -nl- parametrise the model
in
the preferred way, if you know of one? I haven't found anything about it
in
the manual.

best wishes
Rosy Reynolds
BSAC Resistance Surveillance Co-ordinator
www.bsacsurv.org
```
```*
*   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/
```
```
*
*   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/
```