Skip to main content
`Ctrl`+`K`

# leastsquare_1d

astropy.modeling.statistic.leastsquare_1d(measured_vals, updated_model, weights, x)

  Least square statistic with optional weights. Safer than the general `leastsquare()` for 1D models by avoiding numpy methods that support broadcasting.

  Parameters:
    measured_vals `ndarray`

      Measured data values.

    updated_model `Model`

      Model with parameters set by the current iteration of the optimizer.

    weights `ndarray` or `python:None`

      Array of weights to apply to each residual.

    x `ndarray`

      Independent variable “x” on which to evaluate the model.

  Returns:
    res `python:float`

      The sum of least squares.

  See also

  `leastsquare()`