Re: [R] fitting "power model" in nls()

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Mon, 3 Dec 2007 10:38:45 +1300

On 3/12/2007, at 9:26 AM, Joerg van den Hoff wrote:

        <snip>

> and, contrary to other assessments you've received, I definitely
> would prefer `nls'
> for least squares fitting instead of using `optim' or other general
> minimization routines.

Clearly you are far cleverer than I at getting nls() to work.

I attempted to replicate your recipe ***exactly***, right down to the very last
detail of notation and the ordering of terms in the expression:

  > x <- area
  > y <- richness
  > ml2 <- nls(y ~ B*x^A + C,start=c(A=3.2,B=0.002,C=0))

and got the following error:

Error in nls(y ~ B * x^A + C, start = c(A = 3.2, B = 0.002, C = 0)) :

   singular gradient

        cheers,

                Rolf Turner

P.S.:

Version information:

 > version

                _
platform       i386-apple-darwin8.10.1
arch           i386
os             darwin8.10.1
system         i386, darwin8.10.1
status
major          2
minor          6.0
year           2007
month          10
day            03
svn rev        43063
language       R

version.string R version 2.6.0 (2007-10-03)
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

R-help_at_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. Received on Sun 02 Dec 2007 - 21:42:13 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 03 Dec 2007 - 00:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.