Re: [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 Bxmidscal 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: [EMAIL PROTECTED] Subject: [R] using nls to fit a four parameter logistic model To: [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] 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(10), + 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(10), 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 James A. Rogers Manager, Nonclinical Statistics PGRD 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}} __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] using nls to fit a four parameter logistic model
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 [EMAIL PROTECTED] wrote: Shalini Raghavan 3M Pharmaceuticals Research Building 270-03-A-10, 3M Center St. Paul, MN 55144 E-mail: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 6781.000 13256 7391.000 7255 8195.000 3049 9 97.700 1849 1048.400743 1124.000480 1212.000255 13 6.000241 14 3.000128 15 1.500103 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(10), + 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(10), 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[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: [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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 6781.000 13256 7391.000 7255 8195.000 3049 9 97.700 1849 1048.400743 1124.000480 1212.000255 13 6.000241 14 3.000128 15 1.500103 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(10), + 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(10), 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 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html