# [R] using nls to fit a four parameter logistic model

sraghavan@mmm.com sraghavan at mmm.com
Mon Aug 16 18:25:57 CEST 2004

```

Shalini Raghavan
3M Pharmaceuticals Research
Building 270-03-A-10, 3M Center
St. Paul, MN  55144
E-mail: sraghavan at mmm.com
Tel:  651-736-2575
Fax:  651-733-5096

----- Forwarded by Shalini Raghavan/US-Corporate/3M/US on 08/16/2004 11:25
AM -----

Shalini
Raghavan/US-Corpo
rate/3M/US                                                 To
r-help at stat.math.ethz.ch.
08/16/2004 08:57                                           cc
AM
Subject
Fw: using nls to fit a four
parameter logistic model

I am working on what appears to be a fairly simple problem for the
following data

test=data.frame(cbind(conc=c(25000, 12500, 6250, 3125, 1513, 781, 391,
195, 97.7, 48.4, 24, 12, 6, 3, 1.5, 0.001),
il10=c(330269, 216875, 104613, 51372, 26842, 13256, 7255, 3049, 1849, 743,
480, 255, 241, 128, 103, 50)))
> test
conc   il10
1  25000.000 330269
2  12500.000 216875
3   6250.000 104613
4   3125.000  51372
5   1513.000  26842
6    781.000  13256
7    391.000   7255
8    195.000   3049
9     97.700   1849
10    48.400    743
11    24.000    480
12    12.000    255
13     6.000    241
14     3.000    128
15     1.500    103
16     0.001     50

I am able to fit the above data to the equation

> nls(log(il10)~A+(B-A)/(1+exp((xmid-log(conc))/scal)),data=test,
+  start = list(A=log(0.001), B=log(100000),
+ xmid=log(6000),scal=0.8))
Nonlinear regression model
model:  log(il10) ~ A + (B - A)/(1 + exp((xmid - log(conc))/scal))
data:  test
A         B      xmid      scal
3.796457 14.705159  6.410144  2.507653
residual sum-of-squares:  0.1667462

But in attempting to achieve a fit to what is commonly known as the hill
equation, which is a four parameter fit that is used widely in biological
data analysis

nls(log(il10)~A+(B-A)/(1+(log(conc)/xmid )^scal),data=test,
+ start = list(A=log(0.001), B=log(100000),  xmid=log(6000),scal=0.8))

Nonlinear regression model
model:  log(il10) ~ A + (B - A)/(1 + (log(conc)/xmid )^scal)

Error in numericDeriv(form[], names(ind), env) :
Missing value or an Infinity produced when evaluating the model

Please would someone offer a suggestion

Shalini

```