Error support
It is now possible to do least squares fitting with weights. Two keywords have been included to make this possible: weights
and sigma
. Only one of the two can be provided, and they must have the same shape as ydata
.
Example:
from symfit.api import Variable, Parameter, Fit
t_data = np.array([1.4, 2.1, 2.6, 3.0, 3.3])
y_data = np.array([10, 20, 30, 40, 50])
sigma = 0.2
n = np.array([5, 3, 8, 15, 30])
sigma_t = sigma / np.sqrt(n)
# We now define our model
y = Variable()
g = Parameter()
t_model = (2 * y / g)**0.5
fit = Fit(t_model, y_data, t_data, sigma=sigma_t)
fit_result = fit.execute()