#' @noRd
ssq <- function(par, size1,td,size2,model,fixed.A=NULL) {
  if (is.null(fixed.A)) {
    A <- par[1]
    k <- par[2]
  } else {
    A <- fixed.A      # use the fixed value
    k <- par[1]       # only k is estimated
  }
  if(model=="gompertz"){pred <- gompertz(A=A,k=k,size1=size1,td=td)}else{
    if(model=="logistic"){pred <- logistic(A=A,k=k,size1=size1,td=td)}else{
      pred <- vb(A=A,k=k,size1=size1,td=td)
    }
  }
  sum((size2 - pred)^2)
}

