astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Models and Fitting (`astropy.modeling`) »
- leastsquare

# leastsquare

`astropy.modeling.statistic.``leastsquare`(measured_vals, updated_model, weights, x, y=None)

  Least square statistic with optional weights.

  Parameters:

  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.

  Returns:

  res : float

  > The sum of least squares.