seaborn_objects_recipes.recipes.lowess#

Classes

Lowess([frac, gridsize, delta, it, ...])

Perform locally-weighted regression (LOWESS) to smooth data.

class seaborn_objects_recipes.recipes.lowess.Lowess(frac: float = 0.2, gridsize: int = 100, delta: float = 0.0, it: int = 0, num_bootstrap: int | None = None, alpha: float = 0.05)#

Bases: Stat

Perform locally-weighted regression (LOWESS) to smooth data. This statistical method allows fitting a smooth curve to your data using a local regression. It can be useful to visualize the trend of the data.

Note that while this is based on the statsmodels implementation of lowess, the default value of it is set to 0. For a more outlier robust model increase the value of it.

Parameters:
  • frac (float, 0.2) – The fraction of data used when estimating each y-value.

  • gridsize (int, 100) – The number of points in the grid to which the LOWESS is applied. Higher values result in a smoother curve.

  • delta (float, 0.0) – Distance within which to use linear-interpolation instead of weighted regression.

  • it (int, 0) – The number of iterations to perform. 0 = plain least-squares LOWESS; higher values re-weight outliers via a bisquare function at extra computational cost.

  • num_bootstrap (int, optional) – The number of bootstrap samples to use for confidence intervals.

  • alpha (float, 0.05) – Confidence level for the intervals.

Returns:

Columns “x”, “y” (smoothed) and, if bootstrapped, “ymin”/“ymax”.

Return type:

DataFrame

Attributes:
num_bootstrap

Methods

__call__(data, groupby, orient, scales)

Apply statistical transform to data subgroups and return combined result.