[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,
20088720,18774883,18415648,17103717,13580739,12350767,
8682289,7496355,7248810,7022120,6396495,6262477,6005496,
5065887,4594147,2853307,2745322,454572,448397,275136,268771)
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?
Thanks,
Andrew Wilson
More information about the R-help
mailing list