I am using nls to fit a non linear function to some data.

The non linear function is:

y= 1- exp(-(k0+k1*p1+ .... + kn*pn))

I have chosen algorithm "port", with lower boundary is 0 for all of the ki parameters, and I have tried many start values for the parameters ki (including generating them at random).

If I fit the non linear function to the same data using an external algorithm, it fits perfectly and finds the parameters.

As soon as I come to my R installation (2.10.1 on Kubuntu Linux 910 64 bit), I keep getting the error:

Error in nlsModel(formula, mf, start, wts, upper) : singular gradient matrix at initial parameter estimates

I have read all the previous postings and the documentation, but to no avail: the error is there to stay. I am sure the problem is with nls, because the external fitting algorithm perfectly fits it in less than a second. Also, if my n is 4, then the nls works perfectly (but that excludes all the k5 .... kn).

Can anyone help me with suggestions? Thanks in advance.

Alternatively, what do you suggest I should do? Shall I abandon nls in favour of optim?

Regards

--
Corrado Topi
PhD Researcher
Global Climate Change and Biodiversity
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk

______________________________________________
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.

Reply via email to