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

Rolf Turner r.turner at auckland.ac.nz
Sun Dec 2 22:38:45 CET 2007


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}}



More information about the R-help mailing list