Js.*_*Cao 2 python curve-fitting scipy data-fitting standard-deviation
我正在尝试使用 ipython --pylab 将数据集拟合到超策略方程中:y = ax / (b + x)
from scipy import optimize as opti
import numpy as np
from pandas import DataFrame
x = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8])
y = np.array([0.375, 0.466, 0.509, 0.520, 0.525, 0.536, 0.541])
y_stdev = np.array([0.025, 0.016, 0.009, 0.009, 0.025, 0.019])
def func(x, a, b):
return a*x / (b + x)
popt, pcov = opti.curve_fit(func, x, y)
print(popt)
print("a = ", popt.ix[0])
print("b = ", popt.ix[1])
Run Code Online (Sandbox Code Playgroud)
a和b的值应该在 popt 参数内。我想问的是,a和b的值是在将数据集拟合到func(x, a, b)时推断出来的,那么,我们如何估计a和b的标准差呢? 谢谢你。