"Corey Bradshaw" <[EMAIL PROTECTED]> writes: > Hello colleagues, > > > > I am attempting to determine the nonlinear least-squares estimates of > the nonlinear model parameters using nls. I have come across a common > problem that R users have reported when I attempt to fit a particular > 3-parameter nonlinear function to my dataset: > > > > Error in nls(r ~ tlm(a, N.fix, k, theta), data = tlm.data, start = > list(a = a.st, : > > step factor 0.000488281 reduced below `minFactor' of 0.000976563 > > .... > My function is: > > > > tlm <- function(a,N,k,theta) (a*(1-((N/k)^theta))) > > > > The nls fit I've coded is: > > > > tlm.fit <- try(nls(r~tlm(a,N.fix,k,theta), data=tlm.data, > start=list(a=a.st,k=k.st,theta=1), > > trace=TRUE, > control=nls.control(maxiter=6000,tol=1e-05,minFactor=1/1024)))
When you wrap the expresssion to fit in the tlm function, you are effectively keeping nls from using algebraic derivatives and forcing it to do something like dtlm/da =~ (tlm(a+1e-7,...) - tlm(a,...))/1e-7. So you might try sticking in the actual expression r ~ a * (1 - (N.fix/k)^theta) or modify tlm to return a gradient attribute. Reparametrizing in terms of log(k) might also help keeping you out fo trouble. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [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
