linefit

linefit(x, y, /, axis=0)[source]

Get linear regression along axis, ignoring NaNs. Uses polyfit.

Parameters
  • x (array-like) – The x coordinates.

  • y (array-like) – The y coordinates.

  • axis (int, optional) – Regression axis

Returns

  • slope (array-like) – The slope estimates. The shape is the same as y but with dimension axis reduced to length 1.

  • stderr (array-like) – The standard errors of the slope estimates. The shape is the same as slope.

  • bestfit (array-like) – The reconstructed best-fit line. The shape is the same as y.