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

Rogers, James A [PGRD Groton] James_A_Rogers at groton.pfizer.com
Tue Aug 17 15:43:24 CEST 2004

```Shalini,

I think your "hill equation" is meant to just be an alternative
parameterization of the four parameter logistic (BTW, the "hill
*coefficient*" is a function of the slope parameter of the FPL, but I don't
believe "hill equation" is standard terminology). Note "conc" is the input
in this parameterization, not "log(conc)".

> nls(log(il10)~A+(B-A)/(1+(conc/xmid )^scal),data=test,
+             start = list(A=3.5, B=15,
+               xmid=600,scal=1/2.5))
Nonlinear regression model
model:  log(il10) ~ A + (B - A)/(1 + (conc/xmid)^scal)
data:  test
A           B        xmid        scal
14.7051665   3.7964534 607.9822962   0.3987786
residual sum-of-squares:  0.1667462

To see the equivalence to the other parametrization that you used, note

> 1/2.507653
 0.3987793
> log(607.9822962)
 6.410146

--Jim

> Message: 17
> Date: Mon, 16 Aug 2004 11:25:57 -0500
> From: sraghavan at mmm.com
> Subject: [R] using nls to fit a four parameter logistic model
> To: r-help at stat.math.ethz.ch
> Message-ID:
> 	<OF24E63BBE.69F12D62-ON86256EF2.005A3E49-86256EF2.005A448D at mmm.com>
> Content-Type: text/plain; charset=US-ASCII
>
> 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)))
> 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

James A. Rogers
Manager, Nonclinical Statistics
PGR&D Groton Labs