[R] start values for nls() that don't yield singular gradients?

James Salsman james at bovik.org
Sat Apr 23 10:04:20 CEST 2005


I'm trying to fit a Gompertz sigmoid as follows:

x <- c(15, 16, 17, 18, 19)      # arbitrary example data here;
y <- c(0.1, 1.8, 2.2, 2.6, 2.9) # actual data is similar

gm <- nls(y ~ a+b*exp(-exp(-c*(x-d))), start=c(a=?, b=?, c=?, d=?))

I have been unable to properly set the starting value '?'s.  All of
my guesses yield either a "singular gradient" error if they are
decent guesses, or a "singular gradient matrix at initial parameter
estimates" error if they are bad guesses like all zeros.

How can I pick starting values that don't result in singular gradients?

I have had no luck with the "selfStart" models, e.g., "SSgompertz"
-- the formula in "SSgompertz" is not the same as the one I need
above, since it has three parameters instead of four.  I've tried
it and SSfpl thusly:

 > getInitial(y ~ SSfpl(x,a,b,c,d),data=data.frame(x=x,y=y))
Error in nls(y ~ cbind(1, 1/(1 + exp((xmid - x)/exp(lscal)))), data = 
xy,  :
         step factor 0.000488281 reduced below `minFactor' of 0.000976563

And this:

 > getInitial(y ~ SSgompertz(x,a,b,c),data=data.frame(x=x,y=y))
Error in nls(y ~ cbind(1, 1 - exp(-exp(lrc) * x)), data = xy, start = 
list(lrc = as.vector(log(-coef(lm(log(abs(y -  :
         singular gradient

Thanks for any help.

Sincerely,
James Salsman




More information about the R-help mailing list