为什么 R 的 logistic growth output 和另一个有区别?

Why is there a difference between logistic growth output of R and another one?

df <- data.frame(
  time = c(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17),
  var = c(12.69,16.35,20.29,25.08,30.81,38.75,45,49.16,55.15,62.852,68.63,76.64,82.47,85.68,89.14,91.86,95.28,98.17)
)

logisticmodel <- nls(var ~ SSlogis(time, phi1, phi2, phi3), data = df)
summary(logisticmodel)
coef(logisticmodel)
#predict(logisticmodel, data.frame(time = 18))

R给出的输出如下:

      phi1       phi2       phi3 
105.737368   7.432555   3.852865

但是 the website 给了我们:

我知道有些语言有不同的输出。这很正常,但我想知道你的想法是什么?

提前致谢。

问题是正在拟合不同的模型。

nls带自启动功能SSlogis适配机型(见help('SSlogis')

Asym/(1+exp((xmid-input)/scal))

或者,使用您的符号,

phi1/(1 + exp((phi2 - input)/phi3))

纸笔显示,以下变换给出了网页中的结果。

fit <- nls(var ~ SSlogis(time, phi1, phi2, phi3), data = df)

kappa <- coef(fit)[1]
alpha <- exp(coef(fit)[2]/coef(fit)[3])
beta <- 1/coef(fit)[3]
c(kappa = unname(kappa), alpha = unname(alpha), beta = unname(beta))
#      kappa       alpha        beta 
#105.7373679   6.8832991   0.2595471 

所以,为了自动化这个,写一个简单的函数。

transf <- function(x){
  kappa <- coef(x)[1]
  alpha <- exp(coef(x)[2]/coef(x)[3])
  beta <- 1/coef(x)[3]
  c(kappa = unname(kappa), alpha = unname(alpha), beta = unname(beta))
}

transf(fit)