Skip to content
Prev 131044 / 398506 Next

fitting "power model" in nls()

On Sun, Dec 02, 2007 at 11:08:01AM -0800, Milton Cezar Ribeiro wrote:
for easier notation, let y=richness, x=area, C=const in the following.

then 

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

converges alright. where's the problem (apart from this being not a very good
model for the data)? the critical point is to provide some reasonable estimate
of the parameters as starting values.

to get reasonable start values, I'd use:


y = B*x^A + C --> log(y-C) = log(B) + A*log(x) --> ly = b + a*lx,

estimate C from the x -> 0 asymptotic value (approx. 0)

and use lm(ly~lx) which yields a and b estimates which you could use in `nls'.

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.

hth

joerg