hyperspy.misc.lowess_smooth module

This module implements the Lowess function for nonparametric regression. Functions: lowess Fit a smooth nonparametric regression curve to a scatterplot. For more information, see William S. Cleveland: “Robust locally weighted regression and smoothing scatterplots”, Journal of the American Statistical Association, December 1979, volume 74, number 368, pp. 829-836. William S. Cleveland and Susan J. Devlin: “Locally weighted regression: An approach to regression analysis by local fitting”, Journal of the American Statistical Association, September 1988, volume 83, number 403, pp. 596-610.

hyperspy.misc.lowess_smooth._lowess(y, x, f=0.6666666666666666, n_iter=3)

Lowess smoother requiring native endian datatype (for numba).

hyperspy.misc.lowess_smooth.lowess(y, x, f=0.6666666666666666, n_iter=3)

Lowess smoother (robust locally weighted regression).

Fits a nonparametric regression curve to a scatterplot.

Parameters
  • y (np.ndarrays) – The arrays x and y contain an equal number of elements; each pair (x[i], y[i]) defines a data point in the scatterplot.

  • x (np.ndarrays) – The arrays x and y contain an equal number of elements; each pair (x[i], y[i]) defines a data point in the scatterplot.

  • f (float) – The smoothing span. A larger value will result in a smoother curve.

  • n_iter (int) – The number of robustifying iteration. Thefunction will run faster with a smaller number of iterations.

Returns

yest – The estimated (smooth) values of y.

Return type

np.ndarray