Least square statistic with optional weights.
measured_vals : ndarray
Measured data values.
updated_model : Model
Model with parameters set by the current iteration of the optimizer.
weights : ndarray
Array of weights to apply to each residual.
x : ndarray
Independent variable “x” to evaluate the model on.
y : ndarray, optional
Independent variable “y” to evaluate the model on, for 2D models.
res : float
The sum of least squares.