I usually fit the most commonly known growth models using the FSA library and with the function selfStart.

Now, I am trying to test some models with the Original Gompretz vbFuns("Ricker2") and the Richards model with inflection point ("Richards") and I don't manage to get initial values to run my model.

I've tried getInitial (), I tried everything I understand and read all web pages and blogs but comments are usually for commonly used models. I tried getting log values but I guess I am not writing the code correctly for it. I have been attempting several codes using Bates and Pinheiro (2000), p. 345 but It is not clear for me which variables are given in the functions and which ones I should adapt to my model (mCall, LHS, Asym, xmid, scal...). I am uterly confused by now. How do I get initial values for:

GompR2 <- GompertzFuns("Ricker2") 

Which looks like:

function (t, L0, a = NULL, gi = NULL) 
    if (length(L0) == 3) {
        a <- L0[[2]]
        gi <- L0[[3]]
        L0 <- L0[[1]]
    L0 * exp(a * (1 - exp(-gi * t)))

This doesn't work:

initial <- logistInit
function(mCall, LHS, data)
  xy <- sortedXyData(mCall[["Age"]], LHS, data)
  if(nrow(xy) < 3) {
    stop("Too few distinct input values to fit a logistic")
  Asym <- max(abs(xy[,"TotalLength"]))
  if (Asym != max(xy[,"TotalLength"])) Asym <- -Asym # negative asymptote
  xmid <- NLSstClosestX(xy, 0.5 * Asym)
  scal <- NLSstClosestX(xy, 0.75 * Asym) - xmid
  value <- c(Asym, xmid, scal)
  names(value) <- mCall[c("Asym", "xmid", "scal")]

ssGompR2 <- selfStart(~L0 * exp(a * (1 - exp(-gi * t))), initial = GompR2, parameters = c("Asym","xmid","scal"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.