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

 From Steven Joel Hirsch Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: nl -choice between alternative parametrisations of sigmoid models Date Thu, 25 Oct 2007 17:08:43 -0400

Thanks for clarifying, Rosy. I didn't know this about the sigmoid model.

-Steven

On Oct 25, 2007, at 2:53 PM, Rosy Reynolds wrote:

Steven,
No, I'm not saying that the same data produce two curves.
What I'm saying is that you can have two different sets of coefficients to describe the same curve.
e.g.
b0= 2, b1 =8, b2 = 1, b3 = 5 will give the same curve as b0= 10, b1 = -8, b2 = -1, b3 = 5
I can show that algebraically, too, as a general case. (At least, I think I can.)
With the same data, -nl- produces one or other of those sets of coefficients, depending on the starting values. They are equivalent; I just have a preference for the set where b2 is positive.

Examples with synthetic data follow, but it applies to real data too.

* Example of identical curves with different coefficients as above.
. set obs 101
obs was 0, now 101
. gen x=(_n-1)/10
. gen y1= 2 + 8/(1 + exp(-(1)*(x-5)))
. gen y2= 10 + -8/(1 + exp(-(-1)*(x-5)))
. assert y1==y2

*Example of -nl- producing models with each of the coefficient sets, depending on starting values (using x and y1 generated above)
. nl ( y1= {b0} + {b1}/(1 + exp(-{b2}*(x-{b3}))) ), init(b0 1 b1 6 b2 0.5 b3 3)
(obs = 101)

[iterations snipped]

Source | SS df MS
-------------+------------------------------ Number of obs = 101
Model | 984.148347 3 328.049449 R-squared = 1.0000
Residual | 2.4290e-12 97 2.5042e-14 Adj R-squared = 1.0000
-------------+------------------------------ Root MSE = 1.58e-07
Total | 984.148347 100 9.84148347 Res. dev. = -2880.598

---------------------------------------------------------------------- --------
y1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
------------- +----------------------------------------------------------------
/b0 | 2 4.18e-08 4.8e+07 0.000 2 2
/b1 | 8 6.81e-08 1.2e+08 0.000 8 8
/b2 | 1 2.28e-08 4.4e+07 0.000 1 1
/b3 | 5 2.36e-08 2.1e+08 0.000 5 5
---------------------------------------------------------------------- --------
Parameter b0 taken as constant term in model & ANOVA table

. nl ( y1= {b0} + {b1}/(1 + exp(-{b2}*(x-{b3}))) ), init(b0 1 b1 -6 b2 -0.5 b3 3)
(obs = 101)

[iterations snipped]

Source | SS df MS
-------------+------------------------------ Number of obs = 101
Model | 984.148347 3 328.049449 R-squared = 1.0000
Residual | 2.4290e-12 97 2.5042e-14 Adj R-squared = 1.0000
-------------+------------------------------ Root MSE = 1.58e-07
Total | 984.148347 100 9.84148347 Res. dev. = -2880.598

---------------------------------------------------------------------- --------
y1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
------------- +----------------------------------------------------------------
/b0 | 10 4.18e-08 2.4e+08 0.000 10 10
/b1 | -8 6.81e-08 -1.2e+08 -8 -8
/b2 | -1 2.28e-08 -4.4e+07 -1 -1
/b3 | 5 2.36e-08 2.1e+08 0.000 5 5
---------------------------------------------------------------------- --------
Parameter b0 taken as constant term in model & ANOVA table

best wishes
Rosy Reynolds
BSAC Resistance Surveillance Co-ordinator
www.bsacsurv.org

----- Original Message ----- From: "Steven Joel Hirsch Samuels" <sjhsamuels@earthlink.net>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, October 25, 2007 5:05 PM
Subject: Re: st: nl -choice between alternative parametrisations of sigmoid models

Rosy, are you saying that the same set of data will produce two different curves? What conditions vary to do this? Exactly what are the data? Have you plotted the data? Are you sure that the curve is monotone?

-Steven

On Oct 25, 2007, at 11:41 AM, Rosy Reynolds 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/
```Steven  Samuels

18 Cantine's Island
Saugerties, NY 12477
Phone: 845-246-0774
EFax: 208-498-7441

*
*   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/
```
```Steven  Samuels

18 Cantine's Island
Saugerties, NY 12477
Phone: 845-246-0774
EFax: 208-498-7441

*
*   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/
```