sraghavan@mmm.com
2004-Aug-16 16:25 UTC
[R] using nls to fit a four parameter logistic model
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)))> testconc 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[[3]], names(ind), env) : Missing value or an Infinity produced when evaluating the model Please would someone offer a suggestion Shalini
Rogers, James A [PGRD Groton]
2004-Aug-17 13:43 UTC
[R] using nls to fit a four parameter logistic model
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[1] 0.3987793> log(607.9822962)[1] 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[[3]], names(ind), env) : > Missing value or an Infinity produced when evaluating the model > > > > Please would someone offer a suggestion > > ShaliniJames A. Rogers Manager, Nonclinical Statistics PGR&D Groton Labs Eastern Point Road (MS 260-1331) Groton, CT 06340 office: (860) 686-0786 fax: (860) 715-5445 LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}
In your second model, log(conc) is negative for conc = 0.001. This observation will generate NA for (log(conc)/xmid)^scal unless scal is an integer or xmid is also negative. In the latter case, (log(conc)/xmid)^scal will be NA for all but that last value unless scal is an integer. What do your biological references do with this model for concentrations less than 1? If you delete that observation, the algorithm can still die testing a value for xmid <= 0. To avoid these cases, I routine parameterize problems like this in terms of ln.xmid, something like the following: log(il10)~A+(B-A)/(1+(log(conc)/exp(ln.xmid))^scal). hope this helps. spencer graves sraghavan at mmm.com wrote:> >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[[3]], names(ind), env) : > Missing value or an Infinity produced when evaluating the model > > > >Please would someone offer a suggestion > >Shalini > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >