0
我已經寫在R上的下面的代碼來估計三個係數(A,B和C):如何使python適合非線性函數?
y <- c(120, 125, 158, 300, 350, 390, 2800, 5900, 7790)
t <- 1:9
fit <- nls(y ~ a * (((b + c)^2/b) * exp(-(b + c) * t))/(1 + (c/b) *
exp(-(b + c) * t))^2, start = list(a = 17933, b = 0.01, c = 0.31))
,我得到這樣的結果
> summary(fit)
Formula: y ~ a * (((b + c)^2/b) * exp(-(b + c) * t))/(1 + (c/b) * exp(-(b +
c) * t))^2
Parameters:
Estimate Std. Error t value Pr(>|t|)
a 2.501e+04 2.031e+03 12.312 1.75e-05 ***
b 1.891e-05 1.383e-05 1.367 0.221
c 1.254e+00 1.052e-01 11.924 2.11e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 248.8 on 6 degrees of freedom
Number of iterations to convergence: 33
Achieved convergence tolerance: 6.836e-06
如何讓同樣的事情,與Python?
翻譯請求是題外話。 – Roland
我投票結束這個問題作爲脫離主題,因爲翻譯請求是脫離主題 – MLavoie