嗨,我想计算由 scipy.polyfit 函数计算的斜率和截距误差。我对 ydata 有 (+/-) 不确定性,那么如何将其包含在斜率和截距中计算不确定性?我的代码是,
from scipy import polyfit
import pylab as plt
from numpy import *
data = loadtxt("data.txt")
xdata,ydata = data[:,0],data[:,1]
x_d,y_d = log10(xdata),log10(ydata)
polycoef = polyfit(x_d, y_d, 1)
yfit = 10**( polycoef[0]*x_d+polycoef[1] )
plt.subplot(111)
plt.loglog(xdata,ydata,'.k',xdata,yfit,'-r')
plt.show()
非常感谢