Hi I´m trying to fit a nonlinear model to a derivative of the logistic function
y = a/(1+exp((b-x)/c)) (this is the parametrization for the SSlogis function with nls) The derivative calculated with D function is: > logis<- expression(a/(1+exp((b-x)/c))) > D(logis, "x") a * (exp((b - x)/c) * (1/c))/(1 + exp((b - x)/c))^2 So I enter this expression in the nls function: ratelogis <- nls(Y ~ a*(exp((b-X)/c)*(1/c))/(1 + exp((b-X)/c))^2, start=list(a = 21.16322, b = 8.83669, c = 2.957765), ) The data is: > Y [1] 5.5199668 1.5234525 3.3557000 6.7211704 7.4237955 1.9703127 [7] 4.3939336 -1.4380091 3.2650180 3.5760906 0.2947972 1.0569417 > X [1] 1 0 0 4 3 5 12 10 12 100 100 100 The problem is that I got the next error: Error en nls(Y ~ a * (exp((b - X)/c) * (1/c))/(1 + exp((b - X)/c))^2, : step factor 0.000488281 reduced below 'minFactor' of 0.000976563 I trien to change the minFactor using the control argument inside nls control=nls.control(maxiter=50, tol=1e-5, minFactor = 1/2048 but got a new error message: Error en nls(Y ~ a * (exp((b - X)/c) * (1/c))/(1 + exp((b - X)/c))^2, : step factor 0.000244141 reduced below 'minFactor' of 0.000488281 So it seems that as I modify minFactor, the step factor reduces also and I can never reach a solution. Does anybody Know what am I doing wrong? Is there a problem with the formula? How can I solve it? I tried some suggestions on R-help related topics but did not work. Thanks Francisco ---------------------- Francisco Mora Ardila Estudiante de Doctorado Centro de Investigaciones en Ecosistemas Universidad Nacional Autónoma de México ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.