[R] Parameter estimation in nls

Dr Andrew Wilson eia018 at comp.lancs.ac.uk
Tue Nov 25 10:09:06 CET 2003

I am trying to fit a rank-frequency distribution with 3 unknowns (a, b
and k) to a set of data.

This is my data set:

y <- c(37047647,27083970,23944887,22536157,20133224,

and this is the fit I'm trying to do:

nlsfit <- nls(y ~ a * x^k * b^x, start=list(a=5,k=1,b=3))

(It's a Yule distribution.)

However, I keep getting:

"Error in nls(y ~ a * x^k * b^x, start = list(a = 5, k = 1, b = 3)) : 
singular gradient"

I guess this has something to do with the parameter start values.

I was wondering, is there a fully automated way of estimating parameters
which doesn't need start values close to the final estimates?  I know
other programs do it, so is it possible in R?

Andrew Wilson

More information about the R-help mailing list