1

I'm trying to fit my data to a user defined Gompertz equation. However, I received an error as follows:

Error in nls(Eq, data = GPdata, start = list(K = 1), algorithm = "default", : singular gradient

I know this probably means my starting value is not good enough for convergence, but is there any way around this other than guessing? I also tried using the nls2 function (brute force), expanding a huge vector of possible K values to try but received the same error.

Here is my code, including sample data.

t = c(0, 2.4, 4, 5.9, 8.3, 10.2, 12, 14.5, 16.1, 17.8, 19, 21.1, 23, 24.7, 26.4, 28.3,
    30.4, 32.3, 34.2, 36)
Cells = c(14619994708, 18945074477, 19999450160, 23461507263, 22803949639, 19400861775,
        19806214226, 17390826226, 17390826226, 18186961935, 14066488593,
        13285017004, 11058253613, 8085853098, 9168523935, 8435042020, 
        8560592341, 7734294268, 7720887693, 7503367578)

GPdata = data.frame(t, Cells)

Ninf = (1 * 10 ^ 6) * (1 / 0.001)
Eq <- Cells ~ exp(log(Ninf) * (1 - exp(-K * t)))
Gompstart = nls(Eq, data = GPdata, start = list(K = 1), 
        algorithm = "default", trace = TRUE)

Any help or suggestions would be greatly appreciated.

Thanks!

crazian
  • 649
  • 4
  • 12
  • 24
  • 1
    You might want to consider a Weibull fit. It can handle both increasing and decreasing hazard functions. – IRTFM Apr 30 '13 at 19:56
  • 1
    More accurately Weibull can model _either_ increasing or decreasing dependence of hazard on time. – IRTFM Apr 30 '13 at 20:26

1 Answers1

3

1) Note that for all t and K:

LHS >= min(LSH) = min(Cells) = 7503367578 > 1e9 = Ninf = max(RHS) >= RHS

hence the LHS > RHS for all t and K so the model does not work.

2) An exponential is not going to model a rising and then falling phenomenon.

G. Grothendieck
  • 254,981
  • 17
  • 203
  • 341