Home>

To do the weighted least squares method, we need to find the sigma of the following equation.
popt, pcov = curve_fit (func, x, y, sigma = sigma, absolute_sigma = True)

I would like to create this standard deviation sigma from the measured values ​​(x, y).

measured value
x = np.array ([6.26379, 8.57417, 8.66527, 8.75069, 11.6708, 12.3487, 14.5032, 15.7422, 21.7646, 23.0518, 26.5069, 26.4035, 26.321, 23.0045, 19.2654, 17.9425, 14.5669, 13.513, 10.4902, 9.95136, 9.77395])
y = np.array ([3.709910308, 3.300454417, 3.219869361, 2.879991517, 2.250120678, 2.24981186, 1.859931899, 1.839996231, 1.560029151, 1.360016958, 1.210037387, 1.527926405, 1.320005022, 1.340038138, 1.618120234, 1.410033737, 1.83006856, 1.849465)


I would like to define it as a sequence x sequence → sequence. Is that possible?
I don't understand.

  • Answer # 1

    I want to define as a sequence x sequence → sequence

    The standard deviation is the scalar value. It cannot be a sequence. Do you mean to find each standard deviation for x and y? In that case, it should be a function (use twice) of sequence → scalar value.

Related articles